Skip to content

v9 Modular: firebase getAuth method throwing error if Storage is disabled inside data: #5274

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

Closed
beingminimal opened this issue Aug 11, 2021 · 1 comment

Comments

@beingminimal
Copy link

[REQUIRED] Describe your environment

  • Operating System version: Mac OS
  • Browser version: Chrome
  • Firebase SDK version: 9.0.0-beta.8
  • Firebase Product: auth, database

[REQUIRED] Describe the problem

We are trying to use modular API in our Figma plugin code (https://www.figma.com/plugin-docs/intro/).
In SDK 8, firebase.auth() was not throwing any error. However, if I try to use module API in beta version with Figma plugin using getAuth( firebaseApp ) , then it is giving me below error

Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Storage is disabled inside 'data:' URLs.
    at new BrowserLocalPersistence ... at _getInstance ...  at _initializeAuthInstance 

Steps to reproduce:

Relevant Code:

// TODO(you): code here to reproduce the problem
@beingminimal beingminimal changed the title v9 Modular: firebase getAuth method now requiring localstorage access v9 Modular: firebase getAuth method throwing error if Storage is disabled inside data: Aug 11, 2021
@jbalidiong jbalidiong added the v9 label Aug 11, 2021
@sam-gc
Copy link
Contributor

sam-gc commented Aug 11, 2021

Hi, thanks for the issue report. getAuth() initializes auth as a default with all the bells and whistles attached. If you're using the getAuth() for the browser environment (the default), getAuth() is a drop in replacement for this:

initializeAuth(app, {
  popupRedirectResolver: browserPopupRedirectResolver,
  persistence: [indexedDBLocalPersistence, browserLocalPersistence, browserSessionPersistence],
});

You can customize this to get around the issue (I'm not sure what Figma actually supports, you'll have to play around with it):

initializeAuth(app, {
  persistence: indexedDBLocalPersistence,
})

for example.

Here are the docs for initializeAuth: https://firebase.google.com/docs/reference/js/v9/auth.md#initializeauth

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants