586837r / node-red-contrib-alexa-remote2

MIT License
88 stars 71 forks source link

Error: no JSON at incomin... #84

Open jensrossbach opened 4 years ago

jensrossbach commented 4 years ago

I'm using alexa-remote2 Echo node to activate Bluetooth connection to my soundbar upon a certain trigger (in my case when Echo starts playing music). This worked fine in the beginning but suddenly stopped working and I get an error message "Error: no JSON at incomin..." (cannot see whole message as it is cut at the end).

I'm using proxy authentication with seems to be fine. The error is available in the latest version (3.7.0).

jensrossbach commented 4 years ago

Additional information: When I restart my flows, everything works again for some time, but then some time later, the error reappears.

bwims commented 4 years ago

I have found that this error occurs for me when I send multiple instances of the same command, so that, e.g. I try to disconnect bluetooth when it is already disconnected. Is it possible you are doing this under certain conditions?

jensrossbach commented 4 years ago

@bwims yes that could be the case (however I have no proof for this). Still I would consider this a bug.

bwims commented 4 years ago

I use the RBE node to block repeated commands unless the payload changes.

jensrossbach commented 4 years ago

I've meanwhile changed my flow to avoid sending the same command subsequently to the alexa nodes but the error still occurs. Seems to be less often now but still happening.

Myzhar commented 4 years ago

Have you found a solution to this problem? I continue to have random "NO JSON" error

This is the flow that I'm testing: Screenshot from 2020-04-30 14-54-56

Often the last node gets the NO JSON error, but sometimes it happens also for the others

bwims commented 4 years ago

Hi ,

No, I still get it from time to time too. I thought it was related to initialisation/refresh cookie, but I have a re-initalise every 5 mins, and I still get the occasional error like you.

I think I will use the catch node to see if I can get more information about the error.

Sorry not to be more helpful!

On Thu, 30 Apr 2020 at 13:56, Walter Lucetti notifications@github.com wrote:

Have you found a solution to this problem? I continue to have random "NO JSON" error

This is the flow that I'm testing: [image: Screenshot from 2020-04-30 14-54-56] https://user-images.githubusercontent.com/3648617/80712676-9a14e200-8af2-11ea-9574-e691a1582907.png

Often the last node gets the NO JSON error, but sometimes it happens also for the others

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/586837r/node-red-contrib-alexa-remote2/issues/84#issuecomment-621816714, or unsubscribe https://github.com/notifications/unsubscribe-auth/AENIQ2I6SEWN2FFM67UNLFDRPFYPHANCNFSM4J3BONQQ .

Myzhar commented 4 years ago

Please update the issue if you find something new

bwims commented 4 years ago

will do!

On Thu, 30 Apr 2020 at 16:51, Walter Lucetti notifications@github.com wrote:

Please update the issue if you find something new

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/586837r/node-red-contrib-alexa-remote2/issues/84#issuecomment-621940020, or unsubscribe https://github.com/notifications/unsubscribe-auth/AENIQ2LDV3LG7MSOK3HJ5YTRPGM7JANCNFSM4J3BONQQ .

tekybrit commented 4 years ago

I have not seen this error since I inserted a delay node to limit the message rate. This leaves Alexa enough time to complete one message before she gets the next message. In my use case, limiting the message rate to one every 3 seconds works fine.

jensrossbach commented 4 years ago

I don’t think that there are so high frequent requests to the echo nodes in my flow. I’m just switching on Bluetooth connection when the echo starts playing music and switching off Bluetooth connection one minute after the echo stops playing music. Still I get this error from time to time.

Myzhar commented 4 years ago

I tried suddenly with delays, but they are not useful. What instead helped me is using a catch node that catches the error and triggers the node again after a little delay. I add a catch node for each Amazon node.

jensrossbach commented 4 years ago

If this actually helps, then it should be implemented in the nodes themselves as a recovery mechanism.

586837r commented 4 years ago

Amazon sends a "Rate exceeded: Too many requests." in Myzhars flow. I'm thinking about a way to handle this generally. (And to have more helpful errors.) Also keep in mind that if possible you can also send a command sequence at once with the Node option instead of chaining them.

Myzhar commented 4 years ago

@586837r this is interesting. I will investigate how to do it

nicedevil007 commented 3 years ago

What is the actual status of this issue? I still get this error. @Myzhar How did you solve this with the catch node?

In my case I just want to set the volume to a special amount.

If the error was triggered I can't get anything beside the error itself. So how did you reenter the given value until it is sent successfully?

obaldius commented 3 years ago

What has solved the problem to me is using de Node tool whithin the Alexa Routine Node instead of branching the flow in Node Red itself. You can choose between Serial or Parallel execution whithin that action

obaldius commented 3 years ago

I must add, I believe it's just a "Too Many Requests" error. If you chain several Alexa nodes in serial execution, putting a delay of 1.5 - 2 seconds between them should solve the issue. Putting them in parallel greatly increases the risk of such error. For parallel request, better use the Node setting whithin the Routine Node