question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

undefined is not valid JSON

See original GitHub issue

Hi - I’m sorry at this point I’m not sure what it takes to reproduce, will post if I find out. However sometimes the page errors out with the following logs in the console:

SyntaxError: "undefined" is not valid JSON
   at JSON.parse (<anonymous>)
   at getLoginParams (oidc.ts:199:1)
   at Oidc._callee23$ (oidc.ts:963:1)
   ....
   at localsilentLoginAsync (oidc.ts:961:1)
refreshTokensAsync_silent_error {"message":"exceptionSilent","exception":"\"undefined\" is not valid JSON"}

Do you know what would cause this at all?

Thankyou

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
beanovarcommented, Oct 9, 2022

I found out how to reproduce this !

  1. Have two tabs open, one in the foreground, one in the background (hidden)
  2. Ensure the auth server is down / returns an error response when the visible tab refreshes it’s token.
  3. Let it retry the 4 times before eventually failing.
  4. Now make the second tab visible, and you will see the “undefined” is not valid JSON in that tab’s console.

Ideally, I would like all tabs to recover automatically once the auth sever has recovered… maybe they could continue trying rather than give up after 4 attempts?

Thanks!

0reactions
guillaume-chervetcommented, Oct 9, 2022

Thank you very much for this !

I will fix it as soon as possible. Yes may be retry whithout limit in certain situation may work for this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSON undefined value type - Stack Overflow
undefined is not a valid JSON value, even though it is valid in javascript. From the official JSON standard (ECMA-404, Section 5):.
Read more >
Is undefined valid JSON? - Quora
No, a JSON value can be an object, array, number, string, true, false, or null. So undefined is not a valid JSON value....
Read more >
error syntaxerror: "undefined" is not valid json - You.com
That error is normally seen when the value given to JSON.parse is actually undefined . So, I would check the code that is...
Read more >
Why the undefined variable is not sent in a JSON API response?
Undefined is not a valid JSON type. All javascript objects are not valid JSON and vice versa. Example,. const response = { undefined: ......
Read more >
'JSON' is undefined error when calling jQuery.parseJSON
It looks like we have created a situation here where we silently allow invalid JSON of undefined or null if there is no...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found