cakebake / node-red-contrib-alexa-remote-cakebaked

Forked for me and the community to keep dependencies up to date :)
MIT License
42 stars 6 forks source link

Was working great and now won't authorise on 3456 #22

Closed plasterer41 closed 3 years ago

plasterer41 commented 3 years ago

Any thoughts or any similar experiences?

thanks,

Irwin

datbilling commented 3 years ago

I have the same problem as of yesterday. I get Authentication failed: “no body”. Occasionally it seems to succeed.

notownblues commented 3 years ago

Same here, Authentication failed: “no body” most of the time after Node-Red restart or Re-innitialised.

Toxo666 commented 3 years ago

Same here. Tested with varoius port. I have compared an old session file and a new, there r differences. The old on work as normal (second amazon acc on 3457).

With "node-red-contrib-alexa-remote-fork" & "node-red-contrib-alexa-remote2-v2" same problems. No body

andesse commented 3 years ago

Same problems. I need to reply the process about 15 times until I get ready/success on my init nodes. Appeared two days ago for the first time.

kmorrow429 commented 3 years ago

Having the same issue. Have to set my initialize flow on a catch error loop until it starts working. Sometimes it takes several hours before it is successful

notownblues commented 3 years ago

@kmorrow429 if you don't want to wait for hours I found that if you edit the account, don't change any setting, just update then redeploy it eventually works again after 5-10 minutes, roughly 10-15 attempts maybe more

andesse commented 3 years ago

If it's initialized, you have the cookie in a textfile and everything is ok, how long will it stay in this state? Anyone knows?

notownblues commented 3 years ago

@andesse for me it stays initialised unless I restart Node Red, Deploy any of the Alexa Remote2 nodes or Reinitialise (I've got a flow that réinitialises automatically if some speak routines don't work anymore), usually happens every 3 days

kmorrow429 commented 3 years ago

@notownblues I had tried that, but when it didn't work immediately I tried deleting the auth file and a couple of restarts. If it happens again, I'll try that and leave it for a while to see if it works

GurjBahia commented 3 years ago

Same problem here (in the UK) for the last couple of days. Authenticates fine after several manual restart flows and manual injected initialise attempts. But the next time it tries to refresh (I have it timed for once an hour) it fails again.

Errors I see are mostly "Authentication failed: "no body"" and separately "failed to load routines: "routines.map is not a function""

EDIT: Interestingly clicking update on the account details (without changing anything) and then restarting seems to work more often than not doing it.

BrigHubert commented 3 years ago

Exactly the same Problem in Germany (Service Host: layla.amazon.de)

fmarzocca commented 3 years ago

In Italy too.

andesse commented 3 years ago

Question: Does it appear maybe when you run two alexa accounts in node red? I just added a second one to Node-Red one day before this problem happened. I am not at home since three days, so I can't try it out. Btw, I'm from Germany.

Thymos2k commented 3 years ago

Question: Does it appear maybe when you run two alexa accounts in node red? I just added a second one to Node-Red one day before this problem happened. I am not at home since three days, so I can't try it out. Btw, I'm from Germany.

No, I am only using one account and have the same problem. I am from germany, too.

bbindreiter commented 3 years ago

Updating the alexa-remote2 dependency to v3.8 should do the trick.

BrigHubert commented 3 years ago

Question: Does it appear maybe when you run two alexa accounts in node red?

No, I have only one alexa account. Same Error after Deactivation of 2fa in Alexa. Setting "Auto Init" to off in Node-RED-Alexa Configuration-Node and Using Node "Alexa init" solves the problem only one times.

andesse commented 3 years ago

Updating the alexa-remote2 dependency to v3.8 should do the trick.

Wich contrib do you use?

BrigHubert commented 3 years ago

Updating the alexa-remote2 dependency to v3.8 should do the trick.

I'm using "node-red-contrib-alexa-cakebaked" V. 4.0.2. On GitHub this Version is commented with "Updates dependency alexa-remote2 to v3.7.1". I alredy searched for newer Versions, but I didn't found one. Where can I get v3.8?

andesse commented 3 years ago

Updating the alexa-remote2 dependency to v3.8 should do the trick.

I'm using "node-red-contrib-alexa-cakebaked" V. 4.0.2. On GitHub this Version is commented with "Updates dependency alexa-remote2 to v3.7.1". I alredy searched for newer Versions, but I didn't found one. Where can I get v3.8?

There is one alexa contrib with "forked" at the end. I think that's the 3.8, but I wouldn't change to this one cause the developer said "don't expect any updates"

BrigHubert commented 3 years ago

Thank you, andesse. If no one will find a workaround, I wait and hope, the developer resolves the problem.

bbindreiter commented 3 years ago

3.8: https://www.npmjs.com/package/alexa-remote2

Made a PR to update the dependency. I don't know whether it solves the problem here, but usually this kind of errors are all coming from alexa-remote2 and the first thing to try should be to update to the latest available version.

https://github.com/cakebake/node-red-contrib-alexa-remote-cakebaked/pull/24

peterchs commented 3 years ago

I dont think 3.8 fixes it.

I've been running it over a week have been experiencing the same "Authenication Failed: No Body" errors, started couple of days ago.

BrigHubert commented 3 years ago

I tried "3.8" today without success.

bbindreiter commented 3 years ago

So I've debugged the Authentication HTTP Requests and they suddenly respond with 503 Service Unavailable on /api/bootstrap?version=0.

Not sure if this is because they've changed something in their API or because it really is unavailable, but I'm afraid it's the former.

bbindreiter commented 3 years ago

Found the issue. The Accept header is not sent in the request. As suspected, the issue is in alexa-remote2 not here. I'll make a PR there shortly.

If you don't want to wait find this file .node-red/node_modules/alexa-remote2/alexa-remote.js and add 'Accept': 'application/json', to the headers. That would be in line 797. After adding this and restarting node-red (so that it picks up the changes) it works again for me.

Example:

let options = {
            host: flags.host || this.baseUrl,
            path: '',
            method: 'GET',
            timeout: flags.timeout || 10000,
            headers: {
                'User-Agent' : this._options.userAgent,
                'Content-Type': 'application/json; charset=UTF-8',
        'Accept': 'application/json',
                'Referer': `https://alexa.${this._options.amazonPage}/spa/index.html`,
                'Origin': `https://alexa.${this._options.amazonPage}`,
                //'Content-Type': 'application/json',
                //'Connection': 'keep-alive',
                'csrf' : this.csrf,
                'Cookie' : this.cookie,
                'Accept-Encoding': 'gzip,deflate'
            }
        };
andesse commented 3 years ago

@bbindreiter thanks! Awesome you figured it out!

notownblues commented 3 years ago

Found the issue. The Accept header is not sent in the request. As suspected, the issue is in alexa-remote2 not here. I'll make a PR there shortly.

If you don't want to wait find this file .node-red/node_modules/alexa-remote2/alexa-remote.js and add 'Accept': 'application/json', to the headers. That would be in line 797. After adding this and restarting node-red (so that it picks up the changes) it works again for me.

Example:

let options = {
            host: flags.host || this.baseUrl,
            path: '',
            method: 'GET',
            timeout: flags.timeout || 10000,
            headers: {
                'User-Agent' : this._options.userAgent,
                'Content-Type': 'application/json; charset=UTF-8',
      'Accept': 'application/json',
                'Referer': `https://alexa.${this._options.amazonPage}/spa/index.html`,
                'Origin': `https://alexa.${this._options.amazonPage}`,
                //'Content-Type': 'application/json',
                //'Connection': 'keep-alive',
                'csrf' : this.csrf,
                'Cookie' : this.cookie,
                'Accept-Encoding': 'gzip,deflate'
            }
        };

Just did the above and it now works perfect again. Thank you so much @bbindreiter!

fmarzocca commented 3 years ago

@bbindreiter thanks

peterchs commented 3 years ago

Confirm working with above Accept header change here too. Cheers @bbindreiter

andesse commented 3 years ago

What I am really curious about is, why did it worked for a quiet long time and now was suddenly broken...

peterchs commented 3 years ago

I'd guess it'll be down to Amazon changing their services causing the original requests the remote2 lib made to fail.

GurjBahia commented 3 years ago

Hmm, think I was too quick to say the header change works for me. It may have just worked once. Will look at doing a clean install in the next few days to see if that helps.

UPDATE: I had switched back to the regular alexa-remote2 a few months ago which didn't work with this change. Removing that and adding cakebaked and making the mod, seems to work now.

gaussey commented 3 years ago

@bbindreiter Thank you so much!

BrigHubert commented 3 years ago

@bbindreiter Thank you!

stingrayuk commented 3 years ago

@bbindreiter Thank you so much, been fighting with this for a few days :-)

obaldius commented 3 years ago

@bbindreiter thanks a lot my man, If it weren't for you guys I wouldn't have a smart home, ty really

GioDoe commented 3 years ago

Thank you, it works like a charm!

bwims commented 3 years ago

@bbindreiter you are a hero!

Apollon77 commented 3 years ago

alexa-remote 3.8.1 is coming to npm just now. Have fun and thank you @bbindreiter

Matten-Matten commented 3 years ago

@bbindreiter Großen Dank auch von mir!

Gruß Matten Matten

bbindreiter commented 3 years ago

Thank you very much everyone. Let's hope for an updated version soon.

woody4165 commented 3 years ago

Unfortunately, for me it's not working. I still get the Authentication failed: "No body" message. After I go to the IP:3456 to authenticate with my credentials, it seems that it does not create the cookie file and after Initialise, I get again the message to go the IP:3456 page

Matten-Matten commented 3 years ago

@woody4165 Nodered restartet?

woody4165 commented 3 years ago

Yes, I have NR in a Proxmox Container and I did first a service nodered restart and also a reboot after.

Matten-Matten commented 3 years ago

strange, you are also sure that the files (3) have been overwritten?

Gruß Matten Matten

woody4165 commented 3 years ago

Ops..... I was modifying a copy of the alexa-remote.js file and not the one in the .node-red/node_modules/alexa-remote2

So, now all is working fine!

saviothecnic commented 3 years ago

I also have the same problem Accaunt Alexa Italia in addition to me when I restart even before it does not keep me authenticating I have Domoticz and red node on a raspberry and as a path I went to /home/pi/cookie/alexa.cookie

bwims commented 3 years ago

I also have the same problem Accaunt Alexa Italia in addition to me when I restart even before it does not keep me authenticating I have Domoticz and red node on a raspberry and as a path I went to /home/pi/cookie/alexa.cookie

Have you followed the instructions here ? https://github.com/cakebake/node-red-contrib-alexa-remote-cakebaked/issues/22#issuecomment-853171093

saviothecnic commented 3 years ago

Have you followed the instructions here ?

No sorry I'm Italian and I'm using google translator to understand and maybe I missed something

I don't use alexa-remote2 but node-red-contrib-alexa-cakebaked 4.0.2 i believed that solution was for remote2 not cakebaked

obaldius commented 3 years ago

@saviothecnic follow the instructions, I'm using cakebaked and it's worked for me

EDIT:

Translate the following, these are the instructions

Found the issue. The Accept header is not sent in the request. As suspected, the issue is in alexa-remote2 not here. I'll make a PR there shortly.

If you don't want to wait find this file .node-red/node_modules/alexa-remote2/alexa-remote.js and add 'Accept': 'application/json', to the headers. That would be in line 797. After adding this and restarting node-red (so that it picks up the changes) it works again for me.

Example:

let options = {
            host: flags.host || this.baseUrl,
            path: '',
            method: 'GET',
            timeout: flags.timeout || 10000,
            headers: {
                'User-Agent' : this._options.userAgent,
                'Content-Type': 'application/json; charset=UTF-8',
      'Accept': 'application/json',
                'Referer': `https://alexa.${this._options.amazonPage}/spa/index.html`,
                'Origin': `https://alexa.${this._options.amazonPage}`,
                //'Content-Type': 'application/json',
                //'Connection': 'keep-alive',
                'csrf' : this.csrf,
                'Cookie' : this.cookie,
                'Accept-Encoding': 'gzip,deflate'
            }
        };