-
Notifications
You must be signed in to change notification settings - Fork 943
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
Suppress auth emulator warning message #2773
Comments
@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: 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 thanks for explaining! Sounds like we should switch to |
@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 In my use case, playing with the auth emulator, the warn and banner started messing up my testing. |
@Joebayld I did a global CSS that hides that message, in development. |
We're working on adding a flag to the |
What does it want to mean by "Do not use with production credentials" though ? Should I use any different |
@nickmarca it means don't type in your real password or anything else sensitive since it's going to be exposed over |
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;
} |
With v8.2.0 it is now possible to hide the banner and console.log is used instead of console.warn. |
@motiejunas Could you explain how? |
@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: |
Are the types updated? I see the commit has updated it, but the downloaded index.d.ts file still has |
@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! |
This message comes up repeatedly for me during automated test runs |
@wmadden Were you not able to suppress it using this?
|
Thanks @smhmd! That did the trick |
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
emulator init
I'm doing something wrong? |
@motiejunas no you're not doing anything wrong, that |
I got it @samtstern. Thank you. I understand the SDK concern about wrong connections. I wonder if I could suppress it somehow during tests. As test cases amount, things get increasingly noisy. |
@joaomelo One workaround we're using is to actually mock the jest.spyOn(global.console, 'info').mockImplementation((info: string) => {
// Suppress Firebase auth emulator warning since they can be quite noisy during tests
// https://github.com/firebase/firebase-tools/issues/2773
if (info.includes('Auth Emulator')) {
return undefined;
}
// eslint-disable-next-line no-console
return console.log(info);
}); |
That's amazing, @wceolin! Thank you so much. |
I had to search a lot for this information... Why don't you just write this in the warning instead? I, like many others, was confused thought we had to use different firebase config/project. But it's just about using test users and not typing in your password. Any chance we can see this error message improved by adding this valuable information? @nickmarca |
This fix doesn't seem to work for me...not sure why. I still see the banner at the bottom of my html page. The weird thing is, I tried disconnecting the auth emulator completely, but commenting out this code in my script.js file, and removing from my firebase.json file. Even with those changes, the banner is still showing up for me. |
When using Typescript I am getting a warning when adding the |
@fahadahmed This is an issue with the JS SDK, not firebase tools. See open issue here: firebase/firebase-js-sdk#4591 |
I don't understand this. I am the only dev of my app, do I have to care about it? |
@SrBrahma if you are using public wifi there is a potential that an http request is intercepted. So if you use real life passwords, they could be compromised. |
I also hid the emulatore warning via CSS by setting its .firebase-emulator-warning {
opacity: 0.15;
pointer-events: none;
} |
For anyone who wants to prevent those noisy Auth Emulator warning messages from appearing in their test logsIf you are connecting the auth emulator outside your test, then mocking Here is a way to disable the logs, but if you do this, it's a bad idea to simultaneously hide the DOM-injected warning with // in the same file where you connect your emulators
const consoleInfo = console.info
function setShowAuthEmulatorWarning(show: boolean) {
console.info = show ? consoleInfo : () => { }
} Then, wrap setShowAuthEmulatorWarning(false)
connectAuthEmulator(auth, 'http://localhost:9099')
setShowAuthEmulatorWarning(true) |
Is this disableWarnings flag also possible from Flutter? |
Doesn't look like it. |
In my app I just add some CSS in the <body>
<style>
.firebase-emulator-warning {
display: none;
}
</style>
...
</body> But it would be really nice to configure this in the |
This is what worked for me: connectAuthEmulator(auth, 'http://127.0.0.1:9099', { disableWarnings: true }) |
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.
The text was updated successfully, but these errors were encountered: