Fix assumption of "localStorage" presence when persisting request state
About
Devtools does not detect a running instance of urql.
Reproduction
- Clone this example project
- Run
yarn install - Run
yarn start - Open chrome and navigate to http://localhost:8080
- Open the urql devtools panel
Expected result
- Extension detects app
Actual result
- Extension shows message "Waiting for exchange"
Stack trace
Error: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
at la (chrome-extension://mcfphkbpmkbeofnkjehahlmidmceblmm/panel.js:6:58506)
at Qo (chrome-extension://mcfphkbpmkbeofnkjehahlmidmceblmm/panel.js:2:1043871)
at ws (chrome-extension://mcfphkbpmkbeofnkjehahlmidmceblmm/panel.js:2:1089921)
at yu (chrome-extension://mcfphkbpmkbeofnkjehahlmidmceblmm/panel.js:2:1082663)
at mu (chrome-extension://mcfphkbpmkbeofnkjehahlmidmceblmm/panel.js:2:1082588)
at su (chrome-extension://mcfphkbpmkbeofnkjehahlmidmceblmm/panel.js:2:1079618)
at chrome-extension://mcfphkbpmkbeofnkjehahlmidmceblmm/panel.js:2:1031259
at t.unstable_runWithPriority (chrome-extension://mcfphkbpmkbeofnkjehahlmidmceblmm/panel.js:2:1106315)
at Gi (chrome-extension://mcfphkbpmkbeofnkjehahlmidmceblmm/panel.js:2:1030968)
at Ji (chrome-extension://mcfphkbpmkbeofnkjehahlmidmceblmm/panel.js:2:1031204)
Additional info
| environment | version |
|---|---|
| browser | Chrome 69 |
| urql | 0.0.0 |
| urql devtools | 0.0.0 |
| @urql/devtools | 0.0.0 |
Hey there, thanks for the report!
Looks like this issue is caused by https://github.com/FormidableLabs/urql-devtools/pull/350.
@ValGeorgiev was local storage working for you in the browser extension?
Is there a work-around?
HI @frederikhors, for now there isn't - I just tried to reproduce the issue but haven't had any luck.
I'm guessing this is related to the browser being used - would be great if yourself or @Hypermona can share what browser and version you're experiencing this on.
Chrome 92 Windows 10.
It can be reproduced in Chrome 93, but only in Incognito Mode. Tried disabling "Privacy Sandbox" but to no avail.
@andyrichardson Is anyone expected to work on it?
Had the same issue.
After deactivating "Block third-party cookies", the extension works (I believe you can also add an exception for localhost instead of disabling this option for all sites). Tested on MacOS and Chrome 99:

Hey folks, sounds like this is due to having third party cookies blocked as @pantajoe has discovered - enabling them for the time being should get around the issue.
I'll leave this open as this can likely be resolved by introducing a check to see whether localStorage is available (see here) before storing cross-session state.
Will this ever be fixed? This issue appears stale and still a problem in 2023