jovotech/jovo-framework

Deploying to Alexa fails with headers.find is not a function

anneleenscholts opened this issue · 4 comments

I'm submitting a...

  • Bug report
  • Feature request
  • Documentation issue or request
  • Other... Please describe:

Expected Behavior

When I do jovo build:platform alexa I expect the skill to be deployed to the alexa platform.

Current Behavior

Currently I get:

🚀 Deploying Alexa Skill
  ✖ Uploading skill package
                                                                                
x Error: --------------------------------------------------------------------------------
›                                                                                 
› Message:
›  headers.find is not a function
›                                                                                 
› Module:
›  JovoCliCore
›                                                                                 
›                                                                                 
› If you think this is not on you, you can submit an issue here: https://github.com/jovotech/jovo-cli/issues.

The behaviour seems to originate in platforms/platform-alexa/src/cli/smapi/SkillPackageManagement.ts line 96 (function parseImportUrl) where the headers value is of type object but is treated like an array. I can open a PR for this if desired.

Your Environment

@jovotech/cli: 4.1.8 

Jovo packages of the current project :
  - @jovotech/db-filedb: 4.5.10  
  - @jovotech/framework: 4.5.10  
  - @jovotech/platform-alexa: 4.5.10  
  - @jovotech/plugin-debugger: 4.5.10  
  - @jovotech/server-express: 4.5.10  
  - @jovotech/cli-command-build: 4.1.8 [dev] 
  - @jovotech/cli-command-deploy: 4.1.8 [dev] 
  - @jovotech/cli-command-get: 4.1.8 [dev] 
  - @jovotech/cli-command-new: 4.1.8 [dev] 
  - @jovotech/cli-command-run: 4.1.9 [dev] 
  - @jovotech/cli-core: 4.1.9 [dev] 
  - @jovotech/filebuilder: 0.0.1 [dev] 
                                                                                
Environment:
  System:
    OS: macOS 13.4
  Binaries:
    Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
    npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
jrglg commented

I'm having the same issue.

it works via ask-cli ask deploy -p profile but fails using jovo deploy.

x Error: --------------------------------------------------------------------------------
›
› Message:
›  headers.find is not a function
›
› Module:
›  JovoCliCore
›
›
› If you think this is not on you, you can submit an issue here: https://github.com/jovotech/jovo-cli/issues.

any thoughts @jankoenig ?

jrglg commented

this change in platforms/platform-alexa/src/cli/smapi/SkillPackageManagement.ts would do it

function parseImportUrl({ headers }: ImportResponse): string | undefined {
  const headersArray = Object.entries(headers);
  const locationHeader = headersArray.find(([key]) => key === 'location');

  if (locationHeader) {
    const [, value] = locationHeader;
    return value.split('/').pop();
  }

  return undefined;
}

It is fixed now. Thank you for your patience.

Please update your Jovo project (jovo update) and the aws-cli to 2.30.x