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

setting "verify: true" is causing alexa app to timeout from echo devices #52

Closed
cpup22 opened this issue Jan 31, 2017 · 7 comments

Comments

Projects
None yet
4 participants
@cpup22
Copy link

commented Jan 31, 2017

When I set the flag for verify to be true it works when I try to check my endpoint from a non-echo device. It properly returns a 401 error message:

{
  "status": "failure",
  "reason": "The signaturecertchainurl HTTP request header is invalid!"
}

However, when I try to test the app from the Amazon Alexa dev website or any echo devices, it throws an error that the requested skill has taken too long to respond.

Switching the flag back to false or removing completely and it goes back to working from echo devices but obviously it is going to fail certification.

@dblock dblock added the bug? label Jan 31, 2017

@mreinstein mreinstein added confirmed bug and removed bug? labels Jan 31, 2017

@mreinstein

This comment has been minimized.

Copy link
Contributor

commented Jan 31, 2017

I don't think middlewares are being handled correctly. There seems to be a lot of conflicting bodyparser related activity in the code:

https://github.com/alexa-js/alexa-app-server/blob/master/index.js#L166

this line declares a body parser before pulling in the raw body (https://github.com/alexa-js/alexa-app-server/blob/master/index.js#L171)

there is also installation of the alexa-verifier-middleware on line 85, which overlaps with line 171:

https://github.com/alexa-js/alexa-app-server/blob/master/index.js#L85

This is kind of a mess. I suspect this is why @cpup22 is having problems. Seems also possibly related:

#21

@tejashah88

This comment has been minimized.

Copy link
Member

commented Jan 31, 2017

#35 might also be related?

@tejashah88

This comment has been minimized.

Copy link
Member

commented Feb 1, 2017

Another thing to note, for some reason, the alexa-verifier-middleware is loaded after the url and json body parsers are loaded. @mreinstein If I recall correctly, shouldn't alexa-verifier-middleware be loaded before the other body-parsers?

@dblock

This comment has been minimized.

Copy link
Collaborator

commented Feb 3, 2017

@cpup22 I have an incomplete fix in #64, and I have been using a test project from https://github.com/dblock/alexa-app-server-hello-world running on Heroku for testing this. If you want to see quickly if it solves your problem, you can try

  "dependencies": {
    "alexa-app-server": "dblock/alexa-app-server#a-little-closer-56"
  }

Note that you need to specify debug: false, verify: true explicitly.

Note that @mreinstein above is absolutely correct, the fix is basically his code from #54.

@cpup22

This comment has been minimized.

Copy link
Author

commented Feb 3, 2017

@dblock I updated and did an npm install and see the following...

lisaseacat@meanstack-bno-vm:/opt/bitnami/apps/myapp$ npm install
blindnightout@1.0.0 /opt/bitnami/apps/myapp
└─┬ alexa-app-server@2.3.1  (git://github.com/dblock/alexa-app-server.git#fb76557626c72ee23bd2be8a1a5ee226ac28604b)
  ├── alexa-app@2.4.1  (git://github.com/dblock/alexa-app.git#5fa10102b03b4a67448846f2f3d4c1ca0d104a23)
  ├── alexa-verifier-middleware@0.1.9 
  └── lodash.defaults@4.2.0 

lisaseacat@meanstack-bno-vm:/opt/bitnami/apps/myapp$ npm start

> blindnightout@1.0.0 start /opt/bitnami/apps/myapp
> node app.js

serving static content from: public
loading server-side modules from: server
   loaded /opt/bitnami/apps/myapp/server/login.js
loading apps from: apps
/opt/bitnami/apps/blindnightout/apps/helloworld/node_modules/alexa-app/index.js:491
    express.post(endpoint, function(req, res) {
            ^

TypeError: express.post is not a function
    at Object.express (/opt/bitnami/apps/myapp/apps/helloworld/node_modules/alexa-app/index.js:491:13)

Looks like the error is coming form alexa-app/index.js Maybe I didnt' get the changes?? It looks based on the console log that it pulled from your github repo.

dblock added a commit to dblock/alexa-app-server that referenced this issue Feb 3, 2017

@dblock

This comment has been minimized.

Copy link
Collaborator

commented Feb 3, 2017

Doesn't look like it's using the right alexa-app code, try adding alexa-app: "dblock/alexa-app#test-app-schema-utterances" explicitly to package.json? If you look at https://github.com/dblock/alexa-app/blob/test-app-schema-utterances/index.js#L491 which it's complaining about it doesn't have this code, but the shipped 2.4.0 version in https://github.com/alexa-js/alexa-app/blob/v2.4.0/index.js#L491 does.

@dblock

This comment has been minimized.

Copy link
Collaborator

commented Feb 3, 2017

Also, the good news is that #64 has an otherwise failing test for this issue that reproduces the same hang, so once we fix this we're not going to reintroduce a regression in future versions.

dblock added a commit to dblock/alexa-app-server that referenced this issue Feb 3, 2017

dblock added a commit to dblock/alexa-app-server that referenced this issue Feb 4, 2017

@dblock dblock closed this in #64 Feb 5, 2017

dblock added a commit that referenced this issue Feb 5, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.