alexa-samples / alexa-smarthome

Resources for Alexa Smart Home developers.
https://alexa.design/smarthome
Other
686 stars 336 forks source link

"An error occurred while attempting to link Alexa" - how to debug? #24

Closed cloudon7281 closed 6 years ago

cloudon7281 commented 6 years ago

Hi

I've been following the 15 minute tutorial at https://github.com/alexa/alexa-smarthome/wiki/Build-a-Working-Smart-Home-Skill-in-15-Minutes, and am hitting an error at the linking stage.

So far, I've

It's then going wrong when I try to enable the skill. I go to https://alexa.amazon.com and can find the skill under Your Skills with the devUS tag. I then get a "click 'Allow ' to sign in to..." dialog, and when I click allow I get "an error occurred while attempting to link Alexa to xxx - please try again later". I've tried this several times at different times with same result.

Any clue? Nothing is showing up in the lambda logs, not that I'd expect it to.

thanks

Calum

briankel commented 6 years ago

Please check your CloudWatch logs for any clues. Please also make sure you added the redirect URI for your authentication provider. (in the instructions see "Provide Redirect URL's to LWA:"

Regarding your other question, Alexa is only supported as a trigger in specific AWS regions. For Europe you should be able to make this work in eu-west-1.

cloudon7281 commented 6 years ago

Thanks for the reply.

I believe I have the redirect URIs set up correctly: under Developer Console->Apps & Services->Security Profiles->->Web Settings then I have three allowed return URLs:

https://layla.amazon.com/api/skill/link/<code>
https://pitangui.amazon.com/api/skill/link/<code>
https://alexa.amazon.co.jp/api/skill/link/<code>

which match those configured for the redirect URLs under Developer Console->Alexa->->Configuration.

Cloudwatch is enabled for my lambda, but is not showing any attempted accesses, and there are no traces showing up in X-Ray. I can't see any way to add Cloudwatch logs to my skill. Is there a way to do so?

briankel commented 6 years ago

Hmm... No, you can't add CloudWatch to your skill specifically - just to the Lambda. I don't have any immediate ideas for you, just to go back to the 15-minute skill instructions and make sure you've followed each step exactly. There are a lot of steps and it's easy to miss one. If I think of other ideas I'll post them back here.

itssindhu13 commented 6 years ago

HI Calum,

Were you able to fix this issue you had? Facing with the same and came across this ticket. Appreciate any help.

Thanks Sindhu

muenzpraeger commented 6 years ago

Same issue here @briankel.

cloudon7281 commented 6 years ago

Still no success. I wondered if it might be down to the issues raised in https://github.com/alexa/alexa-smarthome/issues/28 so went through it again with an English (UK) skill and an EU (Ireland) lambda, but precisely the same error is occurring.

itssindhu13 commented 6 years ago

For me, the issue was that I used Python 2.7 instead of Python 3.6 in Lambda. That change fixed it for me.

cloudon7281 commented 6 years ago

OK, solved: I'm an idiot. I had an incorrect lambda handler function specified (lambda_function.lambda_handler, not lambda.lambda_handler), which I found when I tried explicitly testing my lambda.

@briankel Suggestion for the documentation: at the end of the "Create the Lambda function" section, before "Configure skill", I suggest adding a step of explicitly testing your lambda to check it has been correctly configured.

sreid commented 6 years ago

Quick note for anyone else running into similar issue... for me, creating my lambda function in us-east-1 instead of us-west-2 (my default) made it work.

liaodn commented 6 years ago

Same issue here @briankel

image

I have no idea to fix it. I can't see any Cloudwatch logs about it.

Thanks