Skip to content

Uncaught TypeError: Cannot assign to read only property 'settings' of object '[object Object]' #2826

Closed

Description

@xiongemi

Version info

Angular: 11.2.14

Firebase: 8.6.1

AngularFire: 6.1.4

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

How to reproduce these conditions

Failing test unit, Stackblitz demonstrating the problem

Steps to set up and reproduce

when adding settings to auth followed instructions at https://github.com/angular/angularfire/blob/master/docs/auth/getting-started.md

import { SETTINGS as AUTH_SETTINGS } from '@angular/fire/auth';

@NgModule({
  // ... Existing configuration
  providers: [
    // ... Existing Providers
    { provide: AUTH_SETTINGS, useValue: { appVerificationDisabledForTesting: true } },
  ]
})
export class AppModule { }

it throws an error for line { provide: AUTH_SETTINGS, useValue: { appVerificationDisabledForTesting: true } },, remove this line and the error is gone.

Sample data and security rules

Debug output

** Errors in the JavaScript console **

** Output from firebase.database().enableLogging(true); **

in the browser, it throws:

Uncaught TypeError: Cannot assign to read only property 'settings' of object '[object Object]'
    at angular-fire-auth.js:134
    at ɵfetchInstance (angular-fire.js:460)
    at angular-fire-auth.js:113
    at ZoneDelegate.invoke (zone-evergreen.js:364)
    at Zone.run (zone-evergreen.js:123)
    at NgZone.runOutsideAngular (core.js:28520)
    at MapSubscriber.project (angular-fire-auth.js:105)
    at MapSubscriber._next (map.js:29)
    at MapSubscriber.next (Subscriber.js:49)
    at MapSubscriber._next (map.js:35)

** Screenshots **

Expected behavior

Actual behavior

Activity

  1. KingDarBoja commented on May 17, 2021

    @KingDarBoja
    Contributor

    Seems to me it is caused by how the firebase-js-sdk defined the settings property in the auth prototype: firebase-js-sdk/auth.

    fireauth.object.setReadonlyProperty(this, 'settings', new fireauth.AuthSettings())
  2. KingDarBoja commented on May 18, 2021

    @KingDarBoja
    Contributor

    Please update to next version (v6.1.5) which contains this fix 🚀

  3. GrandSchtroumpf commented on May 18, 2021

    @GrandSchtroumpf

    @KingDarBoja looks like version 6.1.5 is not on npm yet.

    image

  4. jamesdaniels commented on May 18, 2021

    @jamesdaniels
    Contributor

    Github Actions has been degraded all morning, sorry about that, our CI/CD should be caught up soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions