question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] add 'disableWarnings' option to emulators

See original GitHub issue

Version info

Angular: 11.0.5

Firebase: 8.0

AngularFire: 6.1.4

Other (e.g. Ionic/Cordova, Node, browser, operating system):

Description

When using the emulators tokens (https://github.com/angular/angularfire/blob/master/docs/emulators/emulators.md), it uses the useEmulator(url) firebase-js-jdk function under the hood. But it miss the disableWarnings option is stated here : https://github.com/firebase/firebase-js-sdk/blob/master/packages/auth/src/auth.js

/**
 * Sets the emulator configuration (go/firebase-emulator-connection-api).
 * @param {string} url The url for the Auth emulator.
 * @param {?Object=} options Optional options to specify emulator settings.
 */
fireauth.Auth.prototype.useEmulator = function(url, options) {
  // Emulator config can only be set once.
  if (!this.emulatorConfig_) {
    if (!/^https?:\/\//.test(url)) {
      throw new fireauth.AuthError(
          fireauth.authenum.Error.ARGUMENT_ERROR,
          'Emulator URL must start with a valid scheme (http:// or https://).');
    }
    // Emit a warning so dev knows we are now in test mode.
    const disableBanner = options ? !!options['disableWarnings'] : false;
    this.emitEmulatorWarning_(disableBanner);
    // Persist the config.
    this.emulatorConfig_ = { url };
    // Disable app verification.
    this.settings_().setAppVerificationDisabledForTesting(true);
    // Update RPC handler endpoints.
    this.rpcHandler_.updateEmulatorConfig(this.emulatorConfig_);
    // Notify external event listeners.
    this.notifyEmulatorConfigListeners_();
  }
}

This option allows to hide the bottom banner : image

How to reproduce these conditions

Steps to set up and reproduce

  • create an angular project with ng new myProject
  • install firebase tools with npm install -g firebase-tools
  • run firebase init to initialize a firebase project with at least one feature
  • run firebase init and choose ‘emulators’ to setup the emulators for the previous chosen features
  • add the angular-fire tokens to the providers array of the AppModule
  • run ng serve

The banner should be visible.

Expected behavior

The token should be improved by adding the disableWarnings option

Actual behavior

The banner is always visible and can hide content.

Proposal

I can create a PR if you approve this change (it’ll be applied to each token).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:9
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
GrandSchtroumpfcommented, Feb 2, 2021

@geromegrignon What kind of validation you’re waiting for ?

The way I see it, to solve this issue one should:

if (useEmulator) {
  // Firebase Auth doesn't conform to the useEmulator convention, let's smooth that over
  const [url, port, options] = useEmulator;
  auth.useEmulator(`http://${url}:${port)}`, options);
}
1reaction
geromegrignoncommented, Jan 30, 2021

@lbar i’m waiting for validation before submitting a PR. Meanwhile you can hide the banner with css :

.firebase-emulator-warning {
  // hide the warning banner as AngularFire doesn't support the 'disableWarnings' option
  display: none;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Warning Options (Using the GNU Compiler Collection (GCC))
When an unrecognized warning option is requested (e.g., -Wunknown-warning ), GCC emits a diagnostic stating that the option is not recognized.
Read more >
How do you hide the warnings in React Native iOS simulator?
According to React Native Documentation, you can hide warning messages by setting disableYellowBox to true like this: console.disableYellowBox = true; ...
Read more >
IBM i Access - ACS Getting Started
Features of IBM i Access Client Solutions include: a full featured 5250 display emulator based on IBM Rational Host-on-Demand. In addition to all...
Read more >
Connect your app to the Authentication Emulator - Firebase
The Authentication emulator provides high-fidelity local emulation of Firebase Authentication services, providing much of the functionality found in ...
Read more >
Steam Deck Emulation (EmuDeck 2.0) Guide - YouTube
Valve's Steam Deck is the perfect storm of handhelds: it has an exceptional price-to-performance ratio, a large game library thanks to its ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found