iRayanKhan / homebridge-chamberlain

A Homebridge plugin for Chamberlain garage door openers with MyQ.
77 stars 36 forks source link

SyntaxError: Unexpected token < in JSON at position 0 #94

Closed acourter27 closed 4 years ago

acourter27 commented 4 years ago

Explain the issue occuring:

I've started receiving this error message and I can't get the garage door to respond. I've also noticed that when I connect to the MyQ from on wifi it fails, but if I connect via mobile it works fine. I saw this error on the lighting feature request, but I don't see that it was resolved yet.

It seems like it's a MyQ issue rather than a plugin issue, but I wanted to post just in case.

[Garage Door] SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse () at /usr/lib/node_modules/homebridge-chamberlain/src/api.js:33:19 at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:97:5)

Info

OS Version: Ubuntu 18.0.4.4 Plugin Version: 1.6.0 HomeBridge Version: 1.0.2 Node/Npm Version: Node v12.16.2, 7pm v.6.14.4

Log Output:

(If applicable)

acourter27 commented 4 years ago

This appeared to resolve itself today and does seem to be an issue on the MyQ side, not this plugin. Closing.

coneslayer commented 4 years ago

I'm getting this error too, and it's affecting other projects as well. Looks like a possible MyQ API change. Yay.

https://github.com/arraylabs/pymyq/issues/34 https://github.com/home-assistant/core/issues/35257

acourter27 commented 4 years ago

Yeah today I'm getting a more robust issue.

[5/5/2020, 2:01:14 PM] [Garage Door] Error: invalid response, got HTTP 500: {"code":"500.000","message":"An error occurred while processing the request.","description":"Server Error"} at /usr/lib/node_modules/homebridge-chamberlain/src/api.js:27:15 at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:97:5) [5/5/2020, 5:20:53 PM] [Garage Door] FetchError: request to https://api.myqdevice.com/api/v5.1/Accounts/0edb113d-4a79-49e8-908f-00a44e430eb5/devices/CG08460A5955 failed, reason: read ECONNRESET at ClientRequest. (/usr/lib/node_modules/homebridge-chamberlain/node_modules/node-fetch/lib/index.js:1455:11) at ClientRequest.emit (events.js:310:20) at TLSSocket.socketErrorListener (_http_client.js:426:9) at TLSSocket.emit (events.js:310:20) at emitErrorNT (internal/streams/destroy.js:92:8) at emitErrorAndCloseNT (internal/streams/destroy.js:60:3) at processTicksAndRejections (internal/process/task_queues.js:84:21) { message: 'request to https://api.myqdevice.com/api/v5.1/Accounts/0edb113d-4a79-49e8-908f-00a44e430eb5/devices/CG08460A5955 failed, reason: read ECONNRESET', type: 'system', errno: 'ECONNRESET', code: 'ECONNRESET' }

dseven commented 4 years ago

Something either changed or broke today - it's affecting pymyq too - https://github.com/arraylabs/pymyq/issues/34

ToddWebDev commented 4 years ago

I can validate this as well [Homebridge] [5/5/2020, 9:39:22 PM] [Garage Door] SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse (<anonymous>) at /home/hoobs/.hoobs/node_modules/@hoobs/chamberlain/src/api.js:37:21

coneslayer commented 4 years ago

https://github.com/arraylabs/pymyq/pull/35/files

iRayanKhan commented 4 years ago

What changed? It seems like just the version # for the api. This plugin uses V5.1, not V5.

You can try to manually edit the api.js file, I can't publish to NPM as I am not home currently.

Change the api version from V5.1 for V5.

iRayanKhan commented 4 years ago

Line 18 of Src/api.js

Change V5.1 to V5

jakebathman commented 4 years ago

For anyone coming here with this issue, make sure your plugin is up-to-date.

First, check the version you have installed versus the latest using npm -g outdated:

[pi ~]$ npm -g outdated
Package                      Current  Wanted  Latest  Location
homebridge-chamberlain         1.0.7   1.6.0   1.6.0  global

Then, if needed, update just this package: npm -g update homebridge-chamberlain

iRayanKhan commented 4 years ago

Does 1.6.0 resolve the issue?

Edit:

I'm away from home so I can't exactly test my code so I'm relying on as much feedback as possible.

coneslayer commented 4 years ago

1.6.0 is working for me.

iRayanKhan commented 4 years ago

Thank goodness!

iRayanKhan commented 4 years ago

The OP said he was on 1.6.0 so I don't know if it was a server issue or api/plugin.

acourter27 commented 4 years ago

It’s been working for me steadily for a few days. I think the original issue was on the MyQ side, since the app wouldn’t connect over WiFi. I still get a random error here and there but I can see and control the garage door so I think we’re okay.

iRayanKhan commented 4 years ago

Phew, I think it's safe to say we can close this issue.

Veritas413 commented 4 years ago

I'm still getting this error - was watching this thread for a fix, but looks like it's closed out. Any ideas for me to fix? Tried updating the plugin, and all associated homebridge... stuff... and my password on mychamberlain. App works ok both local and remote, so it's not an IP block (had that before).

iRayanKhan commented 4 years ago

I have been contacted beyond GitHub about this issue, and it just resolved itself for most people after a few days or a week. If it continues, file a new issue please!