aws-mobile-appsync-sdk-js icon indicating copy to clipboard operation
aws-mobile-appsync-sdk-js copied to clipboard

Failed to read the 'localStorage' property from 'Window': Access is denied for this document

Open bpcrao opened this issue 4 years ago • 1 comments

Note: If your issue/feature-request/question is regarding the AWS AppSync service, please log it in the official AWS AppSync forum

Do you want to request a feature or report a bug? bug

What is the current behavior?

  1. In incognito window mode of chrome browser "disable cookies" button
  2. try loading the script, it fails to access localStorage since the localStorage property exists but access is restricted
  3. the handling in the current code(paho-mqtt) is checking if a property exists instead

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

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

  1. In incognito window mode of chrome browser "disable cookies" button
  2. try loading the script, it fails to access localStorage since the localStorage property exists but access is restricted
  3. the handling in the current code(paho-mqtt) is checking if a property exists instead it should gracefully handle it by catching the exception and polyfill it.

What is the expected behavior? it should gracefully handle it by catching the exception and polyfill it.

Which versions and which environment (browser, react-native, nodejs) / OS are affected by this issue? Did this work in previous versions?

nodejs : 14.X browser: chrome

bpcrao avatar Sep 22 '21 17:09 bpcrao

the expected handling is done in https://github.com/aws/aws-sdk-js/blob/307e82673b48577fce4389e4ce03f95064e8fe0d/lib/credentials/cognito_identity_credentials.js#L362

bpcrao avatar Sep 22 '21 18:09 bpcrao