Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught SecurityError: Failed to read the 'sessionStorage' property from 'Window #343

Closed
joker-777 opened this issue Jan 8, 2021 · 8 comments · Fixed by #358
Closed
Labels
bug Something isn't working

Comments

@joker-777
Copy link

Hi, since we upgraded to 7.4.0 we are seeing this error in our Javascript tracking system.

Uncaught SecurityError: Failed to read the 'sessionStorage' property from 'Window': Access is denied for this document.

It happens mostly on android phones with Chrome and is raised in this line which was introduced in this commit.
Here it tries to access sessionStorage even though we never enabled it.

@joker-777 joker-777 added the bug Something isn't working label Jan 8, 2021
@jooohhn
Copy link
Contributor

jooohhn commented Jan 8, 2021

Thanks for reporting, will take a look

@jooohhn
Copy link
Contributor

jooohhn commented Jan 8, 2021

Bug was likely introduced in that commit. Could you post what options you're using when initing Amplitude? (if you're using non-defaults)

@joker-777
Copy link
Author

Hi, thanks for your response. Here is how we set up algolia

amplitude.getInstance().init(amplitude_token, null, {
  includeUtm: true,
  includeReferrer: true,
  includeGclid: true,
  trackingOptions: {
    ip_address: false
  }
});

@joker-777
Copy link
Author

@jooohhn How is the progress here?

@jooohhn
Copy link
Contributor

jooohhn commented Feb 2, 2021

@joker-777 looking to have a fix in by end of this week

@joker-777
Copy link
Author

That would be amazing

@jooohhn
Copy link
Contributor

jooohhn commented Feb 4, 2021

@joker-777 could you share the stack trace of the error? I believe I reproduced the the bug but it'd be good to crosscheck with yours

@joker-777
Copy link
Author

@jooohhn Here is the stack track

SecurityError: Failed to read the 'sessionStorage' property from 'Window': Access is denied for this document.
File "node_modules/amplitude-js/amplitude.umd.js" line 1394 col 24 in value
str = window.sessionStorage && window.sessionStorage.getItem(this.storageKey);
File "node_modules/amplitude-js/amplitude.umd.js" line 3876 col 42 in _loadCookieData
var props = scope._metadataStorage.load();
File "node_modules/amplitude-js/amplitude.umd.js" line 4559 col 7 in [anonymous]
_loadCookieData(this); // reload cookie before each log event to sync event meta-data betwe...
File "node_modules/amplitude-js/amplitude.umd.js" line 4778 col 17 in [anonymous]
return this._logEvent(eventType, eventProperties, null, null, null, null, timestamp, opt_call...
File "node_modules/amplitude-js/amplitude.umd.js" line 4729 col 17 in [anonymous]
return this.logEventWithTimestamp(eventType, eventProperties, null, opt_callback);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants