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

Invalid or unexpected token #9

Closed
lowlyocean opened this issue Aug 14, 2021 · 7 comments
Closed

Invalid or unexpected token #9

lowlyocean opened this issue Aug 14, 2021 · 7 comments

Comments

@lowlyocean
Copy link

When using debug-level logging, nodered reports the following while trying to initialize Alexa. I'm not sure how to trace the "Invalid or unexpected token" error to a specific callstack:

[info] [alexa-remote-account:c969cb45.22f3d8] intialising with the PROXY method and NO saved data...
[debug] [alexa-remote-account:c969cb45.22f3d8] Alexa-Remote: starting initialisation:
[debug] [alexa-remote-account:c969cb45.22f3d8] Alexa-Remote: {"authMethod":"proxy","initType":"proxy"}
[debug] [alexa-remote-account:c969cb45.22f3d8] Alexa-Remote: Use as User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36
[debug] [alexa-remote-account:c969cb45.22f3d8] Alexa-Remote: Use as Login-Amazon-URL: amazon.com
[debug] [alexa-remote-account:c969cb45.22f3d8] Alexa-Remote: Use as Base-URL: pitangui.amazon.com
[debug] [alexa-remote-account:c969cb45.22f3d8] Alexa-Remote: No cookie given, generate one
[error] [alexa-remote-account:c969cb45.22f3d8] Invalid or unexpected token

Node-RED version: v2.0.5
Node.js version: v14.17.5
Linux 5.10.17-v7+ arm LE

"node-red-contrib-alexa-remote2-applestrudel": {
"version": "5.0.2",

"alexa-remote2": {
"version": "3.9.0",

"alexa-cookie2": {
"version": "3.4.3",

@bbindreiter
Copy link
Owner

Just to make sure: Have you fetched a token and saved it in the cookie-file?

@lowlyocean
Copy link
Author

I've got the Account configured as such, and the file .node-red/alexa_auth is populated (probably with stale values):
image

@bbindreiter
Copy link
Owner

Try host layla.amazon.de and page amazon.de. Language can stay.

@lowlyocean
Copy link
Author

Thank you, unfortunately it produces the same result

@lowlyocean
Copy link
Author

lowlyocean commented Aug 14, 2021

If I try to use Auth Method "Cookie", there doesn't seem to be an issue. But as I understand, only the Proxy method would periodically refresh the cookie as needed (and that with the Cookie method, I need to go in and update it manually once in a while).

@lowlyocean
Copy link
Author

I was able to trace the callstack but not to the line that creates the message "Invalid or unexpected token" (maybe because of nodejs/node#11865?)

Trace: Invalid or unexpected token
    at nodeError (/var/www/.node-red/node_modules/node-red-contrib-alexa-remote2-applestrudel/lib/common.js:371:17)
    at /var/www/.node-red/node_modules/node-red-contrib-alexa-remote2-applestrudel/lib/common.js:396:27
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

@lowlyocean
Copy link
Author

I was able to figure this out, my investigation is documented here. It turns out my copy of npm package core-util-is had become corrupted and needed a reinstall.

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

2 participants