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.

[JsonService] getJson: Network Error (during logout)

See original GitHub issue

Hello, I have recently updated from 2.0.0-rc.3 to 2.0.2 (2.0.3) and I’m noticing an issue during logout (it seems it actually started somewhere around rc4 or rc5). It looks like the /connect/endsession endpoint fails for some reason. We are using IdentityServer4 as the back-end.

Could someone please give me a hint what has changed in the way the endpoint is called by the library? It worked before in the rc3 version. Any advice will be highly appreciated.

This is what comes out of the log:

[UserManager] _signoutStart: loaded current user from storage oidc-client-ts.js:48
[UserManager] _signoutStart: setting id_token_hint in signout request oidc-client-ts.js:48
[UserManager] removeUser: begin oidc-client-ts.js:48
[UserManager] storeUser: begin oidc-client-ts.js:48
[UserManager] removing user oidc-client-ts.js:48
[WebStorageStateStore] remove('user:https://identity.server:8443:AppName'): begin oidc-client-ts.js:48
[UserManager] _signoutStart: loaded current user from storage oidc-client-ts.js:48
[UserManager] _signoutStart: setting id_token_hint in signout request oidc-client-ts.js:48
[UserManager] removeUser: begin oidc-client-ts.js:48
[UserManager] storeUser: begin oidc-client-ts.js:48
[UserManager] removing user oidc-client-ts.js:48
[WebStorageStateStore] remove('user:https://identity.server:8443:AppName'): begin oidc-client-ts.js:48
[UserManager] removeUser: user removed from storage oidc-client-ts.js:53
[UserManagerEvents] unload: canceling existing access token timers oidc-client-ts.js:48
[Timer('Access token expiring')] cancel: begin oidc-client-ts.js:48
[Timer('Access token expired')] cancel: begin oidc-client-ts.js:48
[Event('User unloaded')] raise: oidc-client-ts.js:48
[UserManager] removeUser: user removed from storage oidc-client-ts.js:53
[UserManagerEvents] unload: canceling existing access token timers oidc-client-ts.js:48
[Timer('Access token expiring')] cancel: begin oidc-client-ts.js:48
[Timer('Access token expired')] cancel: begin oidc-client-ts.js:48
[Event('User unloaded')] raise: oidc-client-ts.js:48
[UserManager] _signoutStart: user removed, creating signout request oidc-client-ts.js:48
[OidcClient] createSignoutRequest: begin oidc-client-ts.js:48
[MetadataService] _getMetadataProperty('end_session_endpoint'): begin oidc-client-ts.js:48
[MetadataService] getMetadata: begin oidc-client-ts.js:48
[MetadataService] getMetadata: getting metadata from https://identity.server:8443/.well-known/openid-configuration oidc-client-ts.js:48
[JsonService] getJson: begin oidc-client-ts.js:48
[JsonService] getJson: url: https://identity.server:8443/.well-known/openid-configuration oidc-client-ts.js:48
[UserManager] _signoutStart: user removed, creating signout request oidc-client-ts.js:48
[OidcClient] createSignoutRequest: begin oidc-client-ts.js:48
[MetadataService] _getMetadataProperty('end_session_endpoint'): begin oidc-client-ts.js:48
[MetadataService] getMetadata: begin oidc-client-ts.js:48
[MetadataService] getMetadata: getting metadata from https://identity.server:8443/.well-known/openid-configuration oidc-client-ts.js:48
[JsonService] getJson: begin oidc-client-ts.js:48
[JsonService] getJson: url: https://identity.server:8443/.well-known/openid-configuration oidc-client-ts.js:48
[JsonService] getJson: HTTP response received, status 200 oidc-client-ts.js:48
[MetadataService] getMetadata: merging remote JSON with seed metadata oidc-client-ts.js:48
[MetadataService] _getMetadataProperty('end_session_endpoint'): resolved oidc-client-ts.js:48
[OidcClient] createSignoutRequest: Received end session endpoint https://identity.server:8443/connect/endsession oidc-client-ts.js:48
[OidcClient] createSignoutRequest: Signout request has state to persist oidc-client-ts.js:48
[State] toStorageString: begin oidc-client-ts.js:48
[WebStorageStateStore] set('916ec334c503453f859932320e64bc29'): begin oidc-client-ts.js:48
[UserManager] _signoutStart: got signout request oidc-client-ts.js:48
[RedirectNavigator] navigate: begin oidc-client-ts.js:48
[JsonService] getJson: Network Error react_devtools_backend.js:3973:25
    overrideMethod react_devtools_backend.js:3973
    error oidc-client-ts.js:63
    getJson oidc-client-ts.js:473
    getMetadata oidc-client-ts.js:583
    _getMetadataProperty oidc-client-ts.js:614
    getEndSessionEndpoint oidc-client-ts.js:604
    createSignoutRequest oidc-client-ts.js:1476
    _signoutStart oidc-client-ts.js:2469
    signoutRedirect oidc-client-ts.js:2414
    _callee7$ AuthenticationService.ts:170
    Babel 10
    _callee2$ Logout.tsx:93
    Babel 10
    _callee$ Logout.tsx:52
    Babel 8
    Logout Logout.tsx:79
    React 4
[UserManager] _signoutStart: error after preparing navigator, closing navigator window oidc-client-ts.js:48
[RedirectNavigator] close: begin oidc-client-ts.js:48
Redirect signout error:  TypeError: NetworkError when attempting to fetch resource.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
pamapacommented, Apr 11, 2022

Thanks for reporting the root cause!

0reactions
vockocommented, Apr 11, 2022

@pamapa I have figured out the issues. I can confirm the double call was the problem (maybe would worth to mention in the doco somewhere). The logout was called twice as the logout component was rendered twice or better to say, the

useEffect(() => { 
    // initialization code 
}, []);

is being called twice. This seems to start happening when the asynchronous rendering in React 18 is enabled. When I moved back to React 17 rendering, the problem disappeared.

We will have to investigate how to fix this issue if we want to go forward with React 18.

This was a tricky one, thank you very much for your help, really appreciated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

XMLHttpRequest() JSON throws a network error but similar ...
XMLHttpRequest() JSON throws a network error but similar jQuery .getJSON code works ; 1: There's something wrong with the new code ; 2:...
Read more >
Get an inordinate amount of '401 Unauthorized' errors #841
It really appears to me that OIDC is not refreshing my tokens properly, because I am getting so many '401' errors, which are...
Read more >
Network error on a service - CodeProject
Solution 1. Accept Solution Reject Solution. You really haven't provided enough context to really know what the issue is with your request, you ......
Read more >
JSON error handling
In cases where a JavaScript Object Notation (JSON) transaction fails, the API Gateway can use a JSON error to convey error information to...
Read more >
looks like im coding... - Jigidi.com
Challenge yourself with this looks like im coding... jigsaw puzzle for free. ... getJson: network error"),i(Error("Network Error"))},t&&(r.
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