firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Suppress auth emulator warning message

Open motiejunas opened this issue 6 years ago • 36 comments

Is there any way to suppress "WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials." message?

This is really annoying when working with Chrome extensions that it is considered as an error.

motiejunas avatar Nov 02 '20 21:11 motiejunas

@motiejunas thank for the feedback, you're not the first one to tell us the warning banner is annoying although right now it's there because we are trying to be as cautious as possible about security.

Can you explain a little more about how this affects Chrome Extensions? I'm not familiar with that issue.

samtstern avatar Nov 03 '20 12:11 samtstern

@motiejunas thank for the feedback, you're not the first one to tell us the warning banner is annoying although right now it's there because we are trying to be as cautious as possible about security.

Can you explain a little more about how this affects Chrome Extensions? I'm not familiar with that issue.

Basically any console.error/console.warn renders this "Errors" button:

Screenshot 2020-11-03 at 13 39 37

In a normal development routine, I do not see this button and if I see - I have to inspect and check what went wrong with the extension. Now, I have to repeat the same (inspect) every single time to check if this is any real problem or this is just a silly warning.

So it would be really cool to pass some extra flag to mute warnings.

motiejunas avatar Nov 03 '20 12:11 motiejunas

@motiejunas thanks for explaining! Sounds like we should switch to console.log or console.info then.

samtstern avatar Nov 03 '20 12:11 samtstern

What about the HTML overlay that happens on the webpage? Is there an API to not show this?

Screen Shot 2020-11-07 at 3 23 34 PM

Joebayld avatar Nov 07 '20 23:11 Joebayld

@Joebayld there's no API to hide that right now, but we're working on providing some sort of option! For now you can hopefully hide it with custom css.

samtstern avatar Nov 09 '20 12:11 samtstern

@samtstern In my use case, playing with the auth emulator, the warn and banner started messing up my testing. image

smhmd avatar Nov 24 '20 12:11 smhmd

@Joebayld I did a global CSS that hides that message, in development.

akauppi avatar Nov 24 '20 12:11 akauppi

We're working on adding a flag to the useEmulator API to allow you to hide this warning, hopefully coming soon!

samtstern avatar Nov 24 '20 17:11 samtstern

What does it want to mean by "Do not use with production credentials" though ? Should I use any different firebaseConfig when using the emulator ?

nickmarca avatar Nov 25 '20 04:11 nickmarca

@nickmarca it means don't type in your real password or anything else sensitive since it's going to be exposed over http when traveling to the emulator.

samtstern avatar Nov 25 '20 20:11 samtstern

My main issue with the banner was that it was in the way at the bottom. While I am using another styling solution, dropping something like the following into index.css in my CRA project is a decent temporary fix.

div.firebase-emulator-warning {
  top: 0;
  height: 30px;
  width: 200px !important;
  overflow: hidden;
}

saevarb avatar Dec 01 '20 00:12 saevarb

With v8.2.0 it is now possible to hide the banner and console.log is used instead of console.warn.

motiejunas avatar Dec 13 '20 20:12 motiejunas

@motiejunas Could you explain how?

smhmd avatar Dec 13 '20 21:12 smhmd

@motiejunas @smhmd we've added a new option (documentation is a bit behind):

firebase.auth().useEmulator("http://localhost:9099", { disableWarnings: true })

This is in the Firebase JS SDK 8.2.0 release: https://firebase.google.com/support/release-notes/js#version_820_-_december_11_2020

samtstern avatar Dec 14 '20 15:12 samtstern

Are the types updated? I see the commit has updated it, but the downloaded index.d.ts file still has useEmulator(url: string): void (my node_modules/firebase/package.json says 8.2.0 so I think it's at the right version)

harrisonlo avatar Dec 16 '20 01:12 harrisonlo

@harrisonlo I'm not sure ... if you're seeing an issue with the types please raise that on the firebase-js-sdk repo and I'm sure they will take care of it!

samtstern avatar Dec 17 '20 12:12 samtstern

This message comes up repeatedly for me during automated test runs

wmadden avatar Jan 28 '21 10:01 wmadden

@wmadden Were you not able to suppress it using this?

firebase.auth().useEmulator("http://localhost:9099", { disableWarnings: true })

This is in the Firebase JS SDK 8.2.0 release: https://firebase.google.com/support/release-notes/js#version_820_-_december_11_2020

smhmd avatar Jan 28 '21 12:01 smhmd

Thanks @smhmd! That did the trick

wmadden avatar Feb 08 '21 10:02 wmadden

@motiejunas @smhmd we've added a new option (documentation is a bit behind):

firebase.auth().useEmulator("http://localhost:9099", { disableWarnings: true })

This is in the Firebase JS SDK 8.2.0 release: https://firebase.google.com/support/release-notes/js#version_820_-_december_11_2020

Hi there,

I don't know if the intention was to suppress only web UI warnings but I'm still receiving them in the console during tests.

I'm using firebase SDK 8.3.0. Below snippets of the related code:

test case

  test('correctly connect to emulator', () => {
    const config = {
      app: initFirebaseAppFromEnv(),
      emulatorUrl: process.env.FIREBASE_AUTH_EMULATOR_URL
    };
    const identityProvider = createIdentityProvider(config);

    expect(identityProvider).toBeDefined();
  });

emulator init

export async function plugEmulator (fireauth, emulatorUrl) {
  fireauth.useEmulator(emulatorUrl, { disableWarnings: true });
  await clearUsers(fireauth, emulatorUrl);
  await createDefaultUser(fireauth);
}

Here is the console warning. Captura de tela 2021-03-20 155755

I'm doing something wrong?

joaomelo avatar Mar 20 '21 18:03 joaomelo