Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix Alexa import status error message retrieval #1606

Conversation

sadlowskij
Copy link
Contributor

@sadlowskij sadlowskij commented Dec 6, 2023

Proposed Changes

Currently Jovo assumes ImportStatus.skill.resources to never have a length > 1. Therefore, if the array is not empty, it tries to look the error property in the first element of resources. In reality however, the resources can consist of >1 elements, where the error property might not be present in the first element. This leads to the folowing error:

🚀 Deploying Alexa Skill
  ✖ Uploading skill package
                                                                                
x Error: --------------------------------------------------------------------------------
›                                                                                 
› Message:
›  Cannot read properties of undefined (reading 'length')
›                                                                                 
› Module:
›  JovoCliCore
›                                                                                 
›                                                                                 
› If you think this is not on you, you can submit an issue here: https://github.com/jovotech/jovo-cli/issues.

This is caused by this expression: status.skill.resources[0].errors.length.

This is the resources property in my test, when I set privacyPolicyUrl to abc to test this behaviour:

[
    {
        "action": "UPDATE",
        "info": [
            {
                "message": "No change in resource and its dependencies detected. Resource version is up to date with imported package version. Update skipped."
            }
        ],
        "name": "InteractionModel.en-US",
        "status": "SKIPPED"
    },
    {
        "action": "UPDATE",
        "errors": [
            {
                "message": "String instance with value \"abc\" at property path \"$.manifest.privacyAndCompliance.locales.en-US.privacyPolicyUrl\" is not a valid URL."
            }
        ],
        "name": "Manifest",
        "status": "FAILED"
    }
]

Here you can see the error property being present on resources[1] instead of resources[0].

Therefore I changed the type of resources to a normal array instead of a tuple with one element. Also it now looks up the element with an error present instead of assuming it to be the first element.

With these changes you get the following output in the cli:

🚀 Deploying Alexa Skill
  ✖ Uploading skill package
                                                                                
x Error: --------------------------------------------------------------------------------
›                                                                                 
› Message:
›  Errors occured while importing your skill package
›                                                                                 
› Module:
›  JovoCliCore
›                                                                                 
› Hint:
›  String instance with value "abc" at property path "$.manifest.privacyAndCompliance.locales.en-US.privacyPolicyUrl" is not a valid URL.
›                                                                                 
›                                                                                 
› If you think this is not on you, you can submit an issue here: https://github.com/jovotech/jovo-cli/issues.

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

@sadlowskij sadlowskij changed the title V4/bugfix/alexa get import status error message 🐛 Fix Alexa import status error message retrieval Dec 20, 2023
Copy link
Member

@jankoenig jankoenig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @sadlowskij!

@jankoenig jankoenig requested a review from aswetlow January 18, 2024 14:59
@jankoenig jankoenig merged commit 7c1d5bc into jovotech:v4/dev Jan 29, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants