marcy-terui / serverless-alexa-skills

Manage your Alexa Skills with Serverless Framework
https://www.npmjs.com/package/serverless-alexa-skills
MIT License
71 stars 13 forks source link

alexa auth command not working #24

Open goldytech opened 5 years ago

goldytech commented 5 years ago

Hi, In AWS Security profile following are my settings

Allowed Origins  
http://127.0.0.1:9000/
Allowed Return URLs  
http://127.0.0.1:9000/cb

now when I run the command sls alexa auth. I don't see any listener process / webserver getting started which listens on 9000 port.

Hence after the Amazon consent screen The redirect uri not working in browser. I've been following this link https://medium.com/@rupakg/how-to-build-a-serverless-alexa-skill-51d8479e0432 to build my custom skill.

Please help

brunotag commented 5 years ago

+1 same problem

brunotag commented 5 years ago

@goldytech it must be related with the versions 1.33.x of the serverless package: they must have changed the way they load/unload the plugins, or something like that - basically the command is terminated and the server is killed too early.

Workaround: npm install -g serverless@1.32.0

that should make sls alexa auth work afterwards (at least, it worked for me, node version 8.10).

brunotag commented 5 years ago

ok, my guess is that this fix https://github.com/serverless/serverless/pull/5349 is actually breaking the sls alexa auth command for serverless 1.33.x.

Ironic :)

brunotag commented 5 years ago

Yup, locally tested. If you wanna give it a shot, install serverless 1.33.x, open the node_modules/serverless/bin/serverless file, delete this line https://github.com/serverless/serverless/blob/master/bin/serverless#L45 and you'll see sls alexa auth waiting for the connection.

dschep commented 5 years ago

@marcy-terui, to fix this, make the command that's getting killed return a promise that doesn't resolve until the work is done. See serverless/serverless#5503 for how I fixed sls log being broken by the same change.

brunotag commented 5 years ago

An imperfect but easy to implement fix could be adding a .delay(someTensOfSeconds) at the end of this chain of then's. https://github.com/marcy-terui/serverless-alexa-skills/blob/master/index.js#L152

Stackclash commented 5 years ago

Any update to this? I'm still seeing the issue with the latest version of serverless. @dschep I tried your fix by trying to install the fix, but the branch has been deleted.

zaunermax commented 5 years ago

+1 same problem