node-unifiapi icon indicating copy to clipboard operation
node-unifiapi copied to clipboard

SyntaxError using the CloudAPI/wrtc

Open skinnyjames opened this issue 6 years ago • 2 comments

Non-cloud version is working well, but I wanted to ssh into a device.

Tried to run the list_aps() and got the following error.

SyntaxError: Unexpected end of JSON input
    at Object.parse (native)
    at registerQ (/home/webdev/repos/ubiquity-toolkit/node_modules/node-unifiapi/lib/webrtc-request.js:417:63)
    at _q.(anonymous function).forEach.n (/home/webdev/repos/ubiquity-toolkit/node_modules/node-unifiapi/lib/webrtc-request.js:45:49)
    at Array.forEach (native)
    at WRTC.fireQ (/home/webdev/repos/ubiquity-toolkit/node_modules/node-unifiapi/lib/webrtc-request.js:45:36)
    at RTCDataChannel.channel.(anonymous function) [as onmessage] (/home/webdev/repos/ubiquity-toolkit/node_modules/node-unifiapi/lib/webrtc-request.js:255:26)
    at /home/webdev/repos/ubiquity-toolkit/node_modules/wrtc/lib/eventtarget.js:32:26
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

skinnyjames avatar Mar 14 '18 22:03 skinnyjames

This is weird, as I cannot see where exactly is the problem... Let me try the same test on my side

Delian

On Wed, Mar 14, 2018 at 11:03 PM Sean Gregory [email protected] wrote:

Non-cloud version is working well, but I wanted to ssh into a device.

Tried to run the list_aps() and got the following error.

SyntaxError: Unexpected end of JSON input at Object.parse (native) at registerQ (/home/webdev/repos/ubiquity-toolkit/node_modules/node-unifiapi/lib/webrtc-request.js:417:63) at _q.(anonymous function).forEach.n (/home/webdev/repos/ubiquity-toolkit/node_modules/node-unifiapi/lib/webrtc-request.js:45:49) at Array.forEach (native) at WRTC.fireQ (/home/webdev/repos/ubiquity-toolkit/node_modules/node-unifiapi/lib/webrtc-request.js:45:36) at RTCDataChannel.channel.(anonymous function) [as onmessage] (/home/webdev/repos/ubiquity-toolkit/node_modules/node-unifiapi/lib/webrtc-request.js:255:26) at /home/webdev/repos/ubiquity-toolkit/node_modules/wrtc/lib/eventtarget.js:32:26 at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/delian/node-unifiapi/issues/11, or mute the thread https://github.com/notifications/unsubscribe-auth/AAG7ZpXMRyKKpJpg_OZRrV60wu2uBMwOks5teZPEgaJpZM4SrPzz .

delian avatar Mar 15 '18 08:03 delian

I'm not sure if it helps, but I also sometimes get the following error:

SyntaxError: Unexpected token x in JSON at position 99422
    at Object.parse (native)
    at registerQ (/home/webdev/repos/ubiquity-toolkit/node_modules/node-unifiapi/lib/webrtc-request.js:417:63)
    at _q.(anonymous function).forEach.n (/home/webdev/repos/ubiquity-toolkit/node_modules/node-unifiapi/lib/webrtc-request.js:45:49)
    at Array.forEach (native)
    at WRTC.fireQ (/home/webdev/repos/ubiquity-toolkit/node_modules/node-unifiapi/lib/webrtc-request.js:45:36)
    at RTCDataChannel.channel.(anonymous function) [as onmessage] (/home/webdev/repos/ubiquity-toolkit/node_modules/node-unifiapi/lib/webrtc-request.js:255:26)
    at /home/webdev/repos/ubiquity-toolkit/node_modules/wrtc/lib/eventtarget.js:32:26
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

I noticed that the output starts with undefined:1 when I console.log the error Could it be that the data coming out of the cloud service is malformed?

skinnyjames avatar Mar 15 '18 12:03 skinnyjames