rgraciano / echo-sonos

Amazon Echo integration with Sonos
Other
712 stars 235 forks source link

SQS config problem #156

Closed jameshiscott closed 7 years ago

jameshiscott commented 7 years ago

Hi,

Got so close to getting this to work. The setup works fine if i do a port forward but i have have now tried to add the SQS part in and must be missing something.

Both services (SQS and Sonos http api) are running on the same PI3 both the SQS service and Lambda server are set to run in us-east-1.

When i start the SQS server i dont get any errors and the queues in SQS console (SQL-Procy-Client & SQL-Proxy-Server) so that all looks good. It also has the additional role added.

I changed the Environment variables on my Lambda item to say:

image

*APPID, Guids etc removed from screenshot and logs

When i try to test with the above i get:

START RequestId: 95bee9b2-2372-11e7-83f9-5f0049496c4f Version: $LATEST
2017-04-17T13:34:30.381Z    95bee9b2-2372-11e7-83f9-5f0049496c4f    session applicationId: amzn1.ask.skill.XXXXXXXXXXXXXX
2017-04-17T13:34:30.381Z    YYYYYYYYYYY dispatch intent = PauseAllIntent
2017-04-17T13:34:30.381Z    YYYYYYYYYYY PauseAllIntent received
2017-04-17T13:34:30.381Z    YYYYYYYYYYY Calling '/pauseall'
2017-04-17T13:34:30.382Z    YYYYYYYYYYY Call to 'https://sqs.us-east-1.amazonaws.com/1234567/pauseall' failed
2017-04-17T13:34:30.382Z    YYYYYYYYYYY     { Error: connect ECONNREFUSED 127.0.0.1:5005
    at Object.exports._errnoException (util.js:1018:11)
    at exports._exceptionWithHostPort (util.js:1041:20)

So it looks like it is trying to get to the SQS service. if i go to the URL i simply get:

However you can also see later in the log it trys to go to the HOST name as well.

I tried leaving the HOST name as the old host name (when i had firewall forwarding) but that still gave a timeout with looking like it goes to the SQS event at all.

START RequestId: YYYYYYYYYYY Version: $LATEST
2017-04-17T13:38:48.595Z    YYYYYYYYYYY session applicationId: amzn1.ask.skill.XXXXXXXXXX
2017-04-17T13:38:48.596Z    YYYYYYYYYYY dispatch intent = PauseAllIntent
2017-04-17T13:38:48.596Z    YYYYYYYYYYY PauseAllIntent received
2017-04-17T13:38:48.596Z    YYYYYYYYYYY Calling '/pauseall'
END RequestId: YYYYYYYYYYY
REPORT RequestId: YYYYYYYYYYY   Duration: 30003.08 ms   Billed Duration: 30000 ms   Memory Size: 128 MB Max Memory Used: 27 MB  
2017-04-17T13:39:18.596Z YYYYYYYYYYY Task timed out after 30.00 seconds

From looking at the logs on the SQS the client is getting some "emptyReceives" but nothing else.

image

If i ask Echo directly to do anything "Alexa ask sonos to pause all" i get a full tone from her and that is all. Nothing in the app no "sorry i didnt get that" etc.

Anyone able to help?

pheintzelman commented 7 years ago

Did you setup the sqs settings file?

https://github.com/rgraciano/echo-sonos/blob/master/echo-sqs-proxy/settings.json

jameshiscott commented 7 years ago

Yep, and i can see its using the key correctly, it comes up as last used today and used with SQS.

image

And making the items in SQS console: image

jameshiscott commented 7 years ago

Its like it is ignoring the USE_SQS = true flag.

pheintzelman commented 7 years ago

you could try changing getDefault('USE_SQS', false) in options.js to true

I use sqs but have not set up the host vars. Maybe true in the setting is being passed in as a string.

jameshiscott commented 7 years ago

Yep i even tried that and i get as per the above (and below):

I now only have USE_SQS and APPID as environment variables.

2017-04-26T07:56:32.823Z    YYYYYY-YYYYYY-YYYYY Call to 'https://sqs.us-east-1.amazonaws.com/743977751271/pauseall' failed
2017-04-26T07:56:32.823Z    YYYYYY-YYYYYY-YYYYY { Error: getaddrinfo ENOTFOUND yourhosthere yourhosthere:5005
    at errnoException (dns.js:28:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
  code: 'ENOTFOUND',
  errno: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'yourhosthere',
  host: 'yourhosthere',
  port: '5005' }

Is the attempt to talk with https://sqs.us-east-1.amazonaws.com/743977751271/pauseall correct, it seems to do it even if i put false in the USE_SQS setting.

Should i just scrap it and start again?

youdy commented 7 years ago

Did you manage to sort this? Im receiving the same error

jameshiscott commented 7 years ago

nope, full reinstall, same problem. Please let me know if you sort it, driving me mad.

GregRocket commented 7 years ago

I have SQS working. Environment variables are working for me. Here is a screenshot of my Environment variables settings: firefox_2017-05-01_07-07-42 The HOST, AUTH_USERNAME and AUTH_PASSWORD setting above are not used by SQS. These settings are ignored by SQS.

And here is my directory setup on my PI3. putty_2017-05-01_07-10-46a

When I look at your posts this seems odd to me { Error: connect ECONNREFUSED 127.0.0.1:5005 The IP is what I see that looks wrong but I am not sure that is the problem. Is this really the IP of your PI?

youdy commented 7 years ago

The local loopback is 127.0.0.1 however the ethernet is 192.168.0.36

jameshiscott commented 7 years ago

@youdy did you get any closer?

youdy commented 7 years ago

@jameshiscott unfortunately not, ive tried from the beginning much like yourself yet I'm still getting the same error, I think like someone said earlier it's to do with the raspberry Pi IP address. Going to have a tinker with it again this weekend!

opes commented 7 years ago

I had this same issue. It appears to be a regression from: https://github.com/rgraciano/echo-sonos/commit/5490c9f4fd8923eb6e8e1d296e5e09f3dceff0df

After undoing all the changes in that commit, SQS is successfully working again. Hope this helps, @jameshiscott & @youdy

youdy commented 7 years ago

@opes Just had a go of reverting the changes back to that commit and the error has disappeared however I am now getting a different error, I think it may be to do with my settings. I will try again at the weekend from fresh and see if I can get it working again. Alexa does recognise the command now though!

this is the error I am receiving : "The specified queue does not exist for this wsdl version"

jameshiscott commented 7 years ago

@opes how do I download the older codebase?

pheintzelman commented 7 years ago

Would be nice to fix this issue in the master branch. I took a quick look and the issue didn't jump out to me. Has anyone else taken a look at the code in the commit?

jplourde5 commented 7 years ago

I'll take a look at it tomorrow to find out what in the newer echo-Sonos master broke the SQS and/or DynamoDB calls.

jameshiscott commented 7 years ago

Cool, thanks, happy to test for you if you find something tomorrow

jplourde5 commented 7 years ago

Looks like some major rework has been performed with the newer version abstracting the AWS calls. Looking at it now...

jplourde5 commented 7 years ago

There is a typo in line 345 in sonosProxyFactory useSqs should be useSQS

jameshiscott commented 7 years ago

Nice. Always the simple things....

pheintzelman commented 7 years ago

@jplourde5 :)

rgraciano commented 7 years ago

Merged fix in #164