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.

Error was not caught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document

See original GitHub issue

Bug report

Following the tutorial first steps, expecting to see a 404 page when running npm run dev but seeing an empty screen with the following error in console:

localhost/:1 GET http://localhost:3000/ 404 (Not Found)
Navigated to http://localhost:3000/
react-dom.development.js:27773 Download the React DevTools for a better development experience: https://fb.me/react-devtools
index.js:1 Error was not caught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
    at initializeBuildWatcher (http://localhost:3000/_next/static/runtime/main.js?ts=1580234262737:6291:39)
    at http://localhost:3000/_next/static/runtime/main.js?ts=1580234262737:7260:40
console.<computed> @ index.js:1
(anonymous) @ next-dev.js:6
Promise.catch (async)
(anonymous) @ next-dev.js:6
./node_modules/next/dist/client/next-dev.js @ next-dev.js:6
__webpack_require__ @ bootstrap:792
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.js?ts=1580234262737:1
on-demand-entries-utils.js:5 GET http://localhost:3000/ 404 (Not Found)
(anonymous) @ on-demand-entries-utils.js:5
handleMessage @ eventsource.js:1
on-demand-entries-utils.js:5 GET http://localhost:3000/ 404 (Not Found)
(anonymous) @ on-demand-entries-utils.js:5
handleMessage @ eventsource.js:1

To Reproduce

Chrome 80 which will be released in Feb has some important changes for 3rd party cookie policy: https://blog.chromium.org/2019/10/developers-get-ready-for-new.html https://web.dev/samesite-cookies-explained/

To reproduce this error on chrome 79, turn these two flags on:

chrome://flags/#cookies-without-same-site-must-be-secure chrome://flags/#same-site-by-default-cookies

Then follow the tutorial and see the blank page when starting the dev server

Expected behavior

To see a 404 page

Screenshots

image

System information

Next: 9.2.1 Node: v12.13.1 OS: Ubuntu 19.10 Chrome: Version 79.0.3945.130 (Official Build) (64-bit)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:18 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
JohannesHomecommented, Jan 30, 2020

There is a similar error with disabled localStorage in general.

When doing so for chrome see stack-overflow on how to do it. And using the described scenario of @rafaelalmeidatk the app will fail when accessing the page.

The problem for this specific case for me seems to be that the prerender-indicator is accessing the localStorage without testing if it is enabled : https://github.com/zeit/next.js/blob/81fd704681fcac4d241e6f94bb45232ddc403e72/packages/next/client/dev/prerender-indicator.js#L43 https://github.com/zeit/next.js/blob/81fd704681fcac4d241e6f94bb45232ddc403e72/packages/next/client/dev/prerender-indicator.js#L74

Not sure if this relates to the other issues.

2reactions
dohomicommented, May 26, 2020

@lfades the issue is present for all Storyblok backends. I run on newest stable version of NextJS and the issue just got introduced with FastRefresh

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to read the 'localStorage' property from 'Window'
Uncaught SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document. ... This exception is thrown when the...
Read more >
Iframe in Chrome error: Failed to read 'localStorage' from ...
This exception is thrown when the "Block third-party cookies and site data" checkbox is set in Content Settings. To find the setting, open...
Read more >
I see Failed to read the 'localStorage' property from 'Window ...
To fix this, you need to change the cookies' settings in your browser. To do this go to Settings > Privacy and security...
Read more >
DOMException: Failed to read the 'localStorage' property from ...
DOMException : Failed to read the 'localStorage' property from 'Window': Access is denied for this document. This is caused by ...
Read more >
Failed to read the 'localStorage' property from 'Window'
Failed to read the 'localStorage ' property from 'Window': Access is denied for this document. I have implemented Chat in my Web site...
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