APIs & Integrations

glebdv
Member

Failed to read the 'localStorage'

So I added the script that hubspot provides to the bottom of my body, but in dev and prod I end up getting the following error: 

 

[hub-http] Exception accessing local storage. DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.

at m (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:856536)
at t.services (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:856897)
at s (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:865825)
at https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:866068
at https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:979113
at e (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:1301651)
at t (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:979077)
at https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:979310
at https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:979382
at i (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:1287587)
at get (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:989588)
at a (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:1288164)
at Object.get (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:807121)
at a (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:1265734)
at https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:1224381
at https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:1814227
at Object.fetchVisitorThreads (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:159257)
at Object.componentDidMount (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:1487221)
at Object.componentDidMount (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:148576)
at $s (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:121752)
at nu (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:123369)
at https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:136466
at Object.n.unstable_runWithPriority (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:35468)
at Vu (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:136401)
at qu (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:136184)
at zu (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:135529)
at Uu (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:134550)
at du (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:133355)
at Object.enqueueSetState (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:84996)
at a.E.setState (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:27352)
at a.onStateChange (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:168905)
at h (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:157743)
at https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:1309126
at https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:1386561
at https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:1814755
at https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:1381766
at https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:1385728
at https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:1379965
at https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:1388648
at https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:1814234
at dispatch (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:159029)
at https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:1028888
at https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:1814227
at dispatch (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:159029)
at window.Raven.captureMessage.extra.rawData (https://static.hsappstatic.net/conversations-visitor-ui/static-1.4790/bundles/visitor.js:1:1420366)


Not really sure why, if anyone has a clue please let me know! 

19 Replies 19
findshorty
Member

Failed to read the 'localStorage'

Well, that's kind of a non-answer, as surely one of the points of incognito mode is to block third party cookies and site data.

Incognito mode is a perfectly acceptable way to browse, and it shouldn't raise javascript errors when a conditional could and should be used to check whether a particular library or object is available.

This is fixable, and I'm not sure why it's taking you so long to fix it.

tbiskupic
HubSpot Employee
HubSpot Employee

Failed to read the 'localStorage'

Hi All,

 

I did some research on this issue today and managed to find what is casing it. I was able to find a similar issue raised on Chromium Projects: https://www.chromium.org/for-testers/bug-reporting-guidelines/uncaught-securityerror-failed-to-read-.... It looks like this might be an issue stemming from your user environment; if the browser is blocking third-party cookies and site data, it would cause an issue. That would explain why we normally can't replicate on our side. Hope this helps!

apaSEO
Participant

Failed to read the 'localStorage'

Same here. Thanks for your research, JVale11. Waiting for a solution.

0 Upvotes
JVale11
Participant

Failed to read the 'localStorage'

Same. 

 

Researching the ladder part of the error, I see this is a Chromium seccurity issue:

chromium.org: https://bit.ly/3iRkkne

stackoverflow: https://bit.ly/3gMd35s

 

Updating settings to "Allow All Cookies" resolves the error. Unfortunately, how users configure their browser is not in our control. Adding a popup that asks users to lower their security settings before entering the website will certainly not inspire confidence. Operating a website with features that may not run correctly due to JS errors is not an operable alternative. 

 

Hubspot, is there a way that the iframe can at least check if localStorage is readable/writable before attempting to read/write to it? And exit before causing a JS error? 

awright415
Contributor

Failed to read the 'localStorage'

Same here

0 Upvotes
mmcclaskey1
Participant

Failed to read the 'localStorage'

Same issue... no thing still Hubspot... you know you are not free.

martingfisher
Participant

Failed to read the 'localStorage'

This thread was opened in ‎Mar 20, 2019 11:36 AM and still not feedback from Hubspot. Thats poor.

HPachy
Member

Failed to read the 'localStorage'

same here incognito mode for me. (Version 89.0.4389.114 (Build officiel) (x86_64))

0 Upvotes
ZmagoD
Participant

Failed to read the 'localStorage'

Same here. It happens on Chrome(Version 87.0.4280.88 (Official Build) (x86_64)) incognito mode for me.

Not sure why Hubspot needs the access to localStorage but probably it will be enough to console.warn instead of an error.

Screenshot 2020-12-28 at 15.17.41.png

 

0 Upvotes
fabien_r
Participant

Failed to read the 'localStorage'

same here... for months...

0 Upvotes
findshorty
Member

Failed to read the 'localStorage'

Same here

0 Upvotes
Julia_Plytix
Participant

Failed to read the 'localStorage'

same here!

0 Upvotes
maserat
Member

Failed to read the 'localStorage'

same here

PearsonSpecter
Member

Failed to read the 'localStorage'

Same here

zack510
Participant

Failed to read the 'localStorage'

Same here. Hubspot wordpress plugin on chrome in incognito with chatbot enabled.

MattHandrail
Participant

Failed to read the 'localStorage'

This is also happening to me. Only Microsoft Edge (the new chromium version) is showing the error while other browsers are not. Super annoying when having the dev console open trying to develop our web app.

 

What is HubSpot trying to read from localstorage?

IsaacTakushi
HubSpot Employee
HubSpot Employee

Failed to read the 'localStorage'

Welcome, @glebdv.

 

Happy to help. To troubleshoot effectively, though, I'll need a bit more information. Would you:

  1. Define the Hub IDs of the production and developer accounts encountering this issue. Does your production account's ID end in 6807?
  2. Describe your overall goal.
  3. Share "the script that HubSpot provides" and a link to a page where it is installed. Are you referring to the tracking code?

Isaac Takushi

Associate Certification Manager
0 Upvotes
yahyamousavi
Participant

Failed to read the 'localStorage'

hello, we are facing the same problem. please share the solution with us if possible. thank you

we added the tracking code in WordPress in Astra theme with a custom layout that is a hook and will run on the "astra_content_after" place.

this error occurs on one of our client's browser and in the incognito window of the chrome browser in all pages of our website:
https://zeevou.com

it causes problems in some javascript codes in our pages.

should the tracking code to be added in another specific place in each page?

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

Failed to read the 'localStorage'

hello @yahyamousavi !  I went to the url you have there and am not seeing any errors.  Is there a specific method to reproduce the issue or have you resolved it?