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

"failed to load routines: "no body"" #191

Open
GaryStimson opened this issue Jan 27, 2021 · 79 comments
Open

"failed to load routines: "no body"" #191

GaryStimson opened this issue Jan 27, 2021 · 79 comments

Comments

@GaryStimson
Copy link

Hi Folks,
As of this evening none of my routine nodes are working and I keep getting this error when I deploy ""failed to load routines: "no body"".

I also am finding that when deploy every 1 in 5 times the authentication fails and I see an error "Error while checking Authentication: Error: no JSON".

Any ideas?

Thanks,
Gary

@quadhammer
Copy link

quadhammer commented Jan 28, 2021

As of this evening none of my routine nodes are working and I keep getting this error when I deploy ""failed to load routines: "no body"".

I don't use the routines function, but I'm getting that error as well now, every time I restart.

@GaryStimson
Copy link
Author

Tried recreating the configuration node, tried removing the routine nodes and tried turning it off and back on again with no joy ;) From the error I suspect Amazon have changed their REST API and now requires a body for the command to get routines.

@ammawel
Copy link

ammawel commented Jan 28, 2021

I also had the error ""failed to load routines: "no body"".
A manual update of the dependency "Apollon77 / alexa-remote" to new version 3.6.0 fixed the error for me.

Is there no one here who continues to maintain this node-red module and inserts the update?

@brinzlee
Copy link

Hi @ammawel can you explain to an idiot how you manually updated this dependency from https://github.com/Apollon77/alexa-remote
Thanks

@ammawel
Copy link

ammawel commented Jan 28, 2021

Hi @brinzlee,
I work with Windows and did it with WinSCP, because I have no idea about linux so I am a linux-idiot. There is certainly a direct way with linux.

  • Node-red is installed on a Raspberry-pi.

  • node-red modules are in the path /home/pi/.node-red/node_modules (Attention: there is a dot in front of node-red in the path -> hidden files have to be shown in WinSCP: Preferences / Panels / remote / show inaccessible directories).

  • Download the current dependency files from https://github.com/Apollon77/alexa-remote/releases : https://github.com/Apollon77/alexa-remote/archive/v3.6.0.zip

  • unpack the zip on the Windows computer

  • replace the following 3 files with WinSCP in the node-red directory /home/pi/.node-red/node_modules/alexa-remote2:
    alexa-remote.js, alexa-wsmqtt.js, package.json
    Pay attention to the file permissions, they must not change: right mouse button, properties, octal 0755

The problem is that after an update of node-red or of a node-red-module, it will be reset to the old versions.

Good luck

@brinzlee
Copy link

@ammawel Thank you for the detailed instructions... I'm on windows too...I'll give it a go.....
Once again thanks very much

@artgreen
Copy link

artgreen commented Jan 28, 2021

All these issues seem to point to (as @ammawel says) to a dependent library change. It's only 6 months since the dev disappeared - and there is this little PANDEMIC going on... so i'm not ready to say the author has abandoned. However, given the lack of any better options, I'm going to start reviewing the code in detail. If 586837r is still MIA in a few weeks, I will seriously consider forking this. For now, i just want to fix it so it works and, hopefully, 586837r comes back to us. The Dev's listed email is [email protected]. We probably want to send some polite notes mentioning that these nodes are broken.

[Edit] Crap just saw this: #184

This is a pretty big miss on the dev's part (again, pandemic, may be not intentional) so, we need to decide if we are going to still use these nodes or, if the dev doesn't return, will someone fork this and at least get it to a working state again.

@artgreen
Copy link

artgreen commented Jan 28, 2021

Mentioning it here so it may help someone with immediate needs... It appears that opening an alexa node, going to the configuration node VIA THIS NODE and just closing the configuration, followed by an "update" on the original node seems to kick everything into working again. This only lasts about 24 hours. It does not work if i only open the config node - this seems to only work if go through a node that uses the configuration node.

@brinzlee
Copy link

@ammawel Unfortunately I couldn't find NodeRed on my Pi so I guess it must be in a docker container as I'm using HomeAssistant and it's an Addon within it. So I guess I'll just have to wait until somebody either forks this and mends it or the original developer fixes it....The last option I am not so confident upon as I see you have been raising issues for a while....

@bwims
Copy link

bwims commented Jan 29, 2021

@ammawel Unfortunately I couldn't find NodeRed on my Pi so I guess it must be in a docker container as I'm using HomeAssistant and it's an Addon within it. So I guess I'll just have to wait until somebody either forks this and mends it or the original developer fixes it....The last option I am not so confident upon as I see you have been raising issues for a while....

I run dietpi, and it used to be under /home/dietpi/.node-red/node_modules
However, the latest version installed under /mnt/dietpi_userdata/node-red/node_modules

So you might want to look under /mnt for something ending userdata. Just a thought!

Anyway, I can confirm that this workaround did the trick for me and I couldn't be more delighted!

Thanks @ammawel !

@smiths78
Copy link

Thanks @ammawel I'm running node-red under Raspbian on my Pi and your workaround was immediately successful. I didn't even have to change file permissions.

@GaryStimson
Copy link
Author

@ammawel
Thanks for the detailed instructions. I did exactly what you put using WinSCP and made sure the file permissions were the same, however on restart I am still getting the same errors and no routines in the routine node. Is there a cache somewhere I need to clear?
I'm running HomeAssistant OS and replaced the files alexa-remote.js, alexa-wsmqtt.js, package.json under "\config\node-red\node_modules\alexa-remote2". I also made sure the file permissions were the same (0755). Any help would be appreciated.
I'm also a Node.JS developer who is a newbie to Node-Red. If we don't get a response from the dev then I'm happy to help and fork the development. However I have no idea how to set up a new node package??

Thanks,
Gary

@brinzlee
Copy link

brinzlee commented Jan 29, 2021

@GaryStimson I followed @ammawel kind instructions too....and I have the same setup as you and am still getting the same error....as you are...:(
failed to load routines: "no body"

@877dev
Copy link

877dev commented Jan 29, 2021

@GaryStimson I'm having exactly the same issue lately, I tried @ammawel 's guide but using linux command line. Unfortunately still getting the same errors..

Here's a linux guide if anyone wants to try it:
https://gist.github.com/877dev/536e35ef79f30cc297d313185cdd430e

@ammawel
Copy link

ammawel commented Jan 29, 2021

@brinzlee, @GaryStimson, @877dev
I don't use Docker or HomeAssitant, I use node-red with fhem.
So after manually updating after some time, are the new versions of the alexa-remote.js, alexa-wsmqtt.js files still there, or were they reset to the old ones?
I have noticed that every npm-install in node-red and every update of nodes apparently checks the whole installation and resets alexa-remote to the old, originally existing files.
The use of the node can only continue to work if the installation of node-red-contrib-alexa-remote2 contains the reference to the new dependencies.

@877dev
Copy link

877dev commented Jan 29, 2021

@ammawel I only restarted node-red, not updated any nodes or install anything.
I didn't check if the files were overwritten actually, I will do that next and let you know.

Also created issue on Apollon77's github so he is made aware of the issue, possibly he/she can help..

@brinzlee
Copy link

@ammawel. I followed your instructions but as you say as soon as you restart the NodeRed instance it overites the changes. So I guess HomeAssistant users can't apply the update that way

@ammawel
Copy link

ammawel commented Jan 29, 2021

@brinzlee
No, I did not say that changes are overwritten by a restart of node-red - but e.g. by other installations in node-red, perhaps also by HomeAssistant or Docker, check the version of the files.
It's just a manual exchange of files that may be automatically undone, not a real update. Actually, this makes sense and protects against manipulation.
The actual installation of node-red-contrib-alexa-remote2 must be changed on npmjs.com, e.g. the corresponding file package.json, which contains the reference to the dependencies.

@877dev
Copy link

877dev commented Jan 29, 2021

So after manually updating after some time, are the new versions of the alexa-remote.js, alexa-wsmqtt.js files still there, or were they reset to the old ones?

@ammawel for me the new files seem to have persisted, and the permissions are the same. Plus I checked with WinMerge and the old and new files are different....

image

@ammawel
Copy link

ammawel commented Jan 29, 2021

@brinzlee, @GaryStimson, @877dev
I'm sorry, but I can't help with HomeAssistant and Docker.

We need a real update of the node node-red-contrib-alexa-remote2 with updated dependencies.

@877dev
Copy link

877dev commented Jan 29, 2021

Fair enough, although Docker is not really any different if you don't know about it...

Anyhoo, it's kinda working for me now, not getting any "no body" errors for a while.

However still getting "Error while checking Authentication: Error: no JSON" every so often, can be fixed with redeploy...

@juancgalvez
Copy link

Following @ammawel instructions fixed this issue for me on my Raspberry Pi. Thank you.

@877dev
Copy link

877dev commented Jan 29, 2021

Following @ammawel instructions fixed this issue for me on my Raspberry Pi. Thank you.

@juancgalvez Were you getting ""Error while checking Authentication: Error: no JSON" " errors as well?

@Apollon77
Copy link

Error sfrom routines are fixed by updating alexa.remote to 3.6.0 because AMazon changed stuff.

Errors on Authorization also happened sometimes this week, but I got noofficial report on them, so seems like "fixed themself over time because amazon broke stuff" or such .. no idea

@juancgalvez
Copy link

@877dev No, I didn't.

@kuradi
Copy link

kuradi commented Jan 29, 2021

Error sfrom routines are fixed by updating alexa.remote to 3.6.0 because AMazon changed stuff.

Errors on Authorization also happened sometimes this week, but I got noofficial report on them, so seems like "fixed themself over time because amazon broke stuff" or such .. no idea

how to update if im using nodered in docker?

@dpembo
Copy link

dpembo commented Jan 29, 2021

Error sfrom routines are fixed by updating alexa.remote to 3.6.0 because AMazon changed stuff.
Errors on Authorization also happened sometimes this week, but I got noofficial report on them, so seems like "fixed themself over time because amazon broke stuff" or such .. no idea

how to update if im using nodered in docker?

assume your flows are in a mapped directory, if so, you can just edit the dependency and update the remote2 module.

@dpembo
Copy link

dpembo commented Jan 29, 2021

I've forked and just modified here:
https://github.com/dpembo/node-red-contrib-alexa-remote2

Modified the package dependency to 3.6.0 and bumped the version of this package up to 3.11.0

Tested independently in a clean build and it seemed to work ok, but my live instance runs in docker, and didn't want to redeploy my mapped directory so just manually edited this.

Anyone, please feel free to try this and let me know if it works - you'll need to install it via npm and point to the URL for now, versus an install inside node-red.

Assuming it works, if @586837r returns at any point, I'll create a pull request on this, otherwise I'll push forward with the fork and finalise this, though it'll probably need a new contrib name to differentiate from the original.

@cakebake
Copy link

https://flows.nodered.org/node/node-red-contrib-alexa-cakebaked

The same error occurred with me. Since I had promised my wife that she would no longer overhear the phone when I was listening to loud music, ...

In short: Install via the UI via node-red-contrib-alexa-cakebaked.

@586837r Are you still updating the project? If so, I would remove my fork again.

@MonkeyBusiness1
Copy link

@obaldius - The GUI way is indeed clumsy and command line seems to be the way to go.

But it seems that solving one problem allows the next one in line to present itself.

Most likely it will take a number of tweaks to the update to resolve all.

@obaldius
Copy link

obaldius commented Feb 2, 2021

@MonkeyBusiness1 On device activity stopped working with the previous version, not with cakebacked's. I'm just notifying that cakebacked's hasn't still solved that issue, which form me has started to happen today

@MonkeyBusiness1
Copy link

@obaldius - Got it, thanks for clarifying.

@GaryStimson
Copy link
Author

Thanks cakebaked. Your release solved the original issue. However today I can't initialise at all. Keep getting "Authentication failed: "no JSON"". This started being intermittent last week but is now happening constantly. Any ideas?

@peterchs
Copy link

peterchs commented Feb 3, 2021

FYI updated alexa-remote release 3.7.1 today

https://github.com/Apollon77/alexa-remote/releases/

I'm still using the original fix of manually copying in the Apollon77 alexa-remote js files into the node_modules folder and it seemed to help with my issues, it had seemed to have stopped working with 3.6.0. On device activity is working for me.

@alunfair
Copy link

alunfair commented Feb 3, 2021

I'm running node-red as a service on a Debian server. Have been getting the "no body" and "no JSON" errors for a couple of days now. Copied the alexa-remote files from Git, roughly following the instructions from @877dev and the alexa routines I'm using are working again (at the moment). Survives the service being restarted and node-red deployments without an issue.

I've actually done this twice today, missed the drop of version 3.7.1 by minutes, thanks to @peteakalad for mentioning it.

@brinzlee
Copy link

brinzlee commented Feb 4, 2021

Hi @cakebake is it possible to update your code with the latest code authentication....I'm still getting the occasional fail and thought maybe this might address it..
https://github.com/Apollon77/alexa-remote/releases/tag/v3.7.1
Thank you very much

@hannoverRed
Copy link

Hi @cakebake is it possible to update your code with the latest code authentication....I'm still getting the occasional fail and thought maybe this might address it..
https://github.com/Apollon77/alexa-remote/releases/tag/v3.7.1
Thank you very much

Hi @cakebake
das würde mich auch sehr freuen

@diego76
Copy link

diego76 commented Feb 4, 2021

Hello, I am running node-red on HomeAssistant Hass.io. I have followed @cakebake's instructions ,replaced the original node with the new fork and also restarted the entire box a few times. Unfortunately during the Alexa init I often get the same 2 error messages: "no body" and "Error while checking Authentication: Error: no JSON".
Eventually, after a few manual retries, I manage to successfully initialise Alexa.
Any clues?

@cakebake
Copy link

cakebake commented Feb 4, 2021

Hi Sorry. Besides my job and my free time, I didn't look in here.

Eventually, after a few manual retries, I manage to successfully initialise Alexa.

It is the same for me. If it works, it works fine.

Hi @cakebake is it possible to update your code with the latest code authentication....I'm still getting the occasional fail and thought maybe this might address it..
https://github.com/Apollon77/alexa-remote/releases/tag/v3.7.1

Did you test it? It works in 80% of the cases for me. Of course, that's better than nothing at all. I can try the update tomorrow.

@Chris380
Copy link

Chris380 commented Feb 5, 2021

Thanks a lot for your effort, @cakebake! (Du hast mir den Tag gerettet :-) )
Maybe not the most efficient way in most scenarios, but for me this UI-only-approach worked:

  • Export all flows to file
  • Delete all flows
  • Uninstall "node-red-contrib-alexa-remote2" via UI
  • Install "node-red-contrib-alexa-cakebaked" via UI
  • Import flows from file
  • Restart Node-RED

@cakebake
Copy link

cakebake commented Feb 5, 2021

Hehe, kein Problem, gerne!

I've created a new issue here so it doesn't get miles in this issue.

cakebake#1

@obaldius
Copy link

obaldius commented Feb 5, 2021

@cakebake I just came to say thanks for your effort. Using your fork everything is back to working. I really hope you can keep this flow up to date. Is there any way to buy you a coffee? Thanks again, really

@team-tech-works-uk
Copy link

@cakebake please let me add my own great appreciation for your efforts and guidance - thank goodness :-)

@johnwyles
Copy link

johnwyles commented Feb 21, 2021

+1 👍🏻 Using the fork of this project over to @cakebake's and abandoning @586837r's by switching the npm packages worked for me. For HA OS, like @Chris380 mentions, if you change it in the UI you can do that, but I think the more correct way to do it would be to update the Configuration under Supervisor for Node Red and setting up the config there to have something like the following:

...
npm_packages:
  - >-
    node-red-admin node-red-dashboard node-red-contrib-home-assistant-websocket
    node-red-contrib-alexa-cakebaked node-red-contrib-amazon-echo
    node-red-contrib-alexa-home-skill
...

In order to not have to Re-Initialize NodeRed and Alexa again and again so it stays up to date and doesn't need to refresh the cookie so often I have found a nifty way to do so with HA OS. I am not sure where else to put it but I have also found it useful to use this Preserving variables in NodeRED (flow|global) flow from here: Preserving variables in NodeRED along with incorporating this Initialize Flow flow from here: The answer to almost all Echo needs: Alexa-remote2.

Then to re-authenticate after a reboot or restarting Node Red I do a:

ssh -L 3456:127.0.0.1:3456 -p 22222 [email protected]

and load up http://127.0.0.1:3456/ on my local machine. Sometimes it works and sometimes it doesn't. Doing a re-deploy in Node Red is sometimes required if it gets confused about an csrf error or the Success screen doesn't show up. Nevertheless it will eventually authenticate and I am good until the next restart.

  • @cakebake are you going to semi-officially take up the project? 😄

@1liminal1
Copy link

1liminal1 commented Mar 9, 2021

Hi guys,

I have node red installed as the add on for home assistant os

I have disabled most of the nodes but cant remove the last one. I have also removed all my sequences as well

What am I doing wrong here?

image

Thanks :)

@1liminal1
Copy link

I got it,

Go to the hamburger menu> Configuration nodes> double click the config node/s for Alexa remote and delete in the top left

:)

@sarsw
Copy link

sarsw commented Mar 19, 2021

So does cakebake work for everyone? I installed it and I still get the errors noted above (no json) and all my echo devices become sluggish to respond to any question and occasionally fail and the circular led goes red with the appropriate "I'm sorry...." utterance. Thankfully Google home/Nora flows are still ok. I'd still like the echo devices to work again though as I have lots more devices set up for those.

@deosrc
Copy link

deosrc commented Mar 19, 2021

So does cakebake work for everyone? I installed it and I still get the errors noted above (no json) and all my echo devices become sluggish to respond to any question and occasionally fail and the circular led goes red with the appropriate "I'm sorry...." utterance. Thankfully Google home/Nora flows are still ok. I'd still like the echo devices to work again though as I have lots more devices set up for those.

Unless I've missed some configuration (very possible), this package is only sending and receiving one-time commands with Alexa (e.g. play announcement or receive event, not both unless you have implemented it that way in a flow). All of the "conversation" logic (e.g. receive and reply) is still processed by Amazon and this doesn't have any control over it. That would suggest the "I'm sorry..." response you are getting is a connectivity/configuration issue with Amazon/Alexa rather than a problem with this.

As I said though, it's very possible I've missed something. If you're not getting a specific error message in Node-RED, I'd suggest posting your flow.

@kzelnick
Copy link

thanks cakebake fairly new
i too and the original error but removed alexa remote , then added your update the original error is gone but now have the
failed to load routines: "routines.map is not a function"" any help would be appreciated

@sarsw
Copy link

sarsw commented Mar 27, 2021

So does cakebake work for everyone? I installed it and I still get the errors noted above (no json) and all my echo devices become sluggish to respond to any question and occasionally fail and the circular led goes red with the appropriate "I'm sorry...." utterance. Thankfully Google home/Nora flows are still ok. I'd still like the echo devices to work again though as I have lots more devices set up for those.

Unless I've missed some configuration (very possible), this package is only sending and receiving one-time commands with Alexa (e.g. play announcement or receive event, not both unless you have implemented it that way in a flow). All of the "conversation" logic (e.g. receive and reply) is still processed by Amazon and this doesn't have any control over it. That would suggest the "I'm sorry..." response you are getting is a connectivity/configuration issue with Amazon/Alexa rather than a problem with this.

As I said though, it's very possible I've missed something. If you're not getting a specific error message in Node-RED, I'd suggest posting your flow.

Hi, my problem was it wasn't connected fully. When I added my first virtual device there was no connection info/instructions displayed in the lower part of the node's info cfg panel so I didn't progress past that. I've just updated node red too and reinstalled cakebake and it seems to be working for the 5 minutes since I set it up now. 👍

@quadhammer
Copy link

i too and the original error but removed alexa remote , then added your update the original error is gone but now have the
failed to load routines: "routines.map is not a function"" any help would be appreciated

Apparently this happens when you have no routines in the Alexa app.

@kzelnick
Copy link

Above there was a solution, seems odd but it works
log on to the alexa app on your phone or tablet
go to the routine section
add a routine like a bogus alarm
and fixes it
for some reason there needs to be at least one actual routine on alexa for the warning to go away

@commandcontrolit
Copy link

Your fork fixed my issue! Thank you!

#191 (comment)

@johnwyles
Copy link

@commandcontrolit - isn't @cakebake the greatest? 😍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests