Closed morrydavis closed 4 years ago
I am having the same problem, I can get the /api/ page to display "API running" in a REST application so i know the access token in working, however, I get the same 3 second timeout detailed above.
I was having the exact same issue, and I managed to solve it with the following:
1) Adjust config.json (and port mapping on the router)
It was causing an issue because in my config.json, I just added the url like so: https://server_name.duckdns.org/api
however, the error I believe happened on my ISP side, but anyway it was not being resolved at all. What I did then, was just add the internal HA port there, e.g.: https://server_name.duckdns.org:8123/api
of course I also had to make sure the port added to the url was adjusted in my ISP router.
2) Increase timeout on the Lambda function; In my case, my HA is not based in the US, and 3 seconds was just not enough. You can change the default setting in the 'Basic settings' section of the lambda page, its the last option in that card. I would recommend changing first to something like 5 minutes, until you run a few times and get a good average of what it's enough for you.
Hope this works for you guys as well, I spent too much time debugging this..
Ok I increased the time out and the test code now works, however, alexa still doesn't discover devices. I have filters set up in home assistant so only a few devices are exposed, still takes 8 seconds to complete the test, still no devices in alexa. BTW I am in the UK and using all the stuff in Ireland, however I see random threads saying it is still better to use the American one, think it was verginia. Is there any substance to this?
Hmm.. that's good! You've made progress. I would suggest two checks now:
1) What's the response on yout test code? Does it return any devices at all? If it does, the lambda is not your root cause.
2) Have you added (and enabled) the skill in your Alexa App? I don't recall the wiki here mentioning that part, however, its required for your devices discovery and operation.
Regarding the region, I guess it depends more on which region you setup your Alexa or Amazon digital account, for instance, I'm based in Brazil, but my account is setup as a US account, thus I had to setup the Lambda in the US region as well. I don't think it should impact in any way (even performance-wise), so it's down to your preference in my opinion.
I definetly have enabled the skill as I had to login to aws through the alexa app, it also shows enabled now in dev tab. The test shows the one lamp I have included in the filter. I also tried it with no filter and the list is huge still takes about 8 seconds. When I try to navigate to /api/ via a vpn it loads in seconds with with "api active" or something like that however if I disable the vpn and use normal net connection it takes 8 seconds for the same reply, I don't understand why. Does your test take this long to complete and would the 8 seconds be too long and cause alexa to time out or does it actually wait the 45 seconds alexa takes during discovery?
Great! Not sure if it makes any difference, but have you asked Alexa to discover devices? I believe you have, just making sure. So the response time for the request should not make any difference in any procedure including the discovery, I can tell, because mine used to vary between 4-10s, lately more around the 4s mark. Not exactly sure on what causes it to be faster when you're on VPN, theoretically it should be the other way around but it makes no difference.
We can rule a few things out: 1) Your Home Assistant seems to be configured correctly (configuration.yaml - able to get a response from /api and Lambda); 2) Your router/connection also seems to be okay (you were able to get a response with the correct devices on your Lambda discovery test); 3) Your Lambda function seems to be configured correctly also (same reason as 2);
There's not a lot else that could go wrong, so I'd check the region mismatch first; Few things I would ask you to confirm is: 1) What is your Alexa/Amazon Digital account region set to? 2) What region is your AWS Lambda function deployed? 3) Are you using the same account for Amazon/Alexa, AWS Lambda and Alexa Dev? (I believe you have, just making sure)
From what I can tell there is no UK version of AWS. I had to create a US account that is separate from my UK amazon/Alexa account. I have had them working in the past together on another API, which happens to be broken now though.
I have now noticed that I am having trouble saving the Alexa skill, even when I make a new one.
I'm not 100 % sure where the "skillmanifest" is. Is this something that is pulled out of the Lambda function it doesn't like or is this something in the Alexa skill that I cannot see on the webpage to configure?
Both of my Alexa dots are registered in the UK inside Alexa app device location settings. lambda is deployed in Ireland, maybe you can see the ARN is EU-west
You are right, as per the docs you must use the EU (Ireland) region, which should be the same your Alexa works, I'm not sure what are the dependencies on that, but I've read a few stories on how it won't work if all 3 elements (AWS Lambda / Alexa / Alexa Dev) are not in the same region, I take although you've tried a few things, they were at currently they are in the same region, yes? Technically having system modules in different regions shouldn't matter to any system specially if you built it like that, however, on Alexa's case for this particular case it's different apparently. I've seen a few fixes for the skillmanifest
error you're getting, check link1 or link2 let me know if any of those helped you.
Unfortunately I cannot get the skillmanifest error to go away. I have even created new Alexa skill and lambda function but it keeps coming back up. I also cant unlink the "account linking" to see if that is the problem.
i'm getting the same error:
Failed to save skill information The requested content has an invalid property 'skillmanifest'.
@borger can you try linking 2 new lambda and alexa skills to see if they will. @d0v1k are you trying this on the Ireland host?
edit: i have managed to get rid of the "skillmanifest", messed about with resetting passwords and it is behaving now.
out of interest what version of home assistant are you on, I also just tried the home assistant authorization where it directs you for username and password from local instance, it fails miserably.
there is a 2-week old post in the superthread stating discovery is broken, no replies to it yet
@Supermillhouse I was able to deploy another one sucessfully, did you manage to get past the skillmanifest error?
I got past the error, put a ticket in to amazon and mucked about with passwords and something fixed it, maybe me maybe them. Can the new one discover devices, I mean more specifically alexa, that's all I'm stuck on now?
@Supermillhouse when i did the test today it works.
I'm using Home Assistant 0.100.3
@d0v1k so I'm guessing amazon fixed something, are you now getting alexa to discover devices, or is it just the "test" that works?
investigating this a bit more, can one of you check the alexa dev console - test tab - manual jason and see if you have options for endpoint region, ine is blank.
I have progressed a little more, I once got Alexa to discover a device and now no longer will again. I have changed nothing. When I get lambda to request switches it takes 8-9 seconds, when I do it with a Rest client it takes 500ms. Any ideas why lambda is being so slow?
Well, that makes sense I suppose. I disabled SSL and the connect time comes down to 300ms, and Alexa discovers devices. SSL handshaking is about 8 seconds on Pi 4. Now all I have to do is figure out what I'm going to do about SSL stuff.
Execution result: failed(logs) Details The area below shows the result returned by your function execution. Learn more about returning results from your function. { "errorMessage": "2019-10-05T01:37:40.771Z 64f6d6a6-d593-446a-a82a-77b1509bca4f Task timed out after 3.00 seconds" } Summary Code SHA-256 Hu8S97nKdEcIg9//nIF1r5/37hRcazrG/gOCeRBb7IM= Request ID 64f6d6a6-d593-446a-a82a-77b1509bca4f Duration 3003.29 ms Billed duration 3000 ms Resources configured 128 MB Max memory used 60 MB Init Duration: 248.47 ms Log output The section below shows the logging calls in your code. These correspond to a single row within the CloudWatch log group corresponding to this Lambda function. Click here to view the CloudWatch log group. START RequestId: 64f6d6a6-d593-446a-a82a-77b1509bca4f Version: 1 END RequestId: 64f6d6a6-d593-446a-a82a-77b1509bca4f REPORT RequestId: 64f6d6a6-d593-446a-a82a-77b1509bca4f Duration: 3003.29 ms Billed Duration: 3000 ms Memory Size: 128 MB Max Memory Used: 60 MB Init Duration: 248.47 ms
2019-10-05T01:37:40.771Z 64f6d6a6-d593-446a-a82a-77b1509bca4f Task timed out after 3.00 seconds