这是indexloc提供的服务,不要输入任何密码
Skip to content

Calling app.firestore().settings() from @firebase/testing breaks the app #3354

@gustavopch

Description

@gustavopch

[REQUIRED] Describe your environment

  • Operating System version: Arch Linux 5.7.4-arch1-1
  • Browser version: Google Chrome Version 83.0.4103.116 (Official Build) (64-bit)
  • Firebase SDK version: 7.15.5
  • Firebase Product: firestore + testing

[REQUIRED] Describe the problem

Steps to reproduce:

Calling app.firestore().settings({ /* ... */ }) overrides the initial settings defined by @firebase/testing's initializeTestApp (as mentioned in this comment), so the tests stop working because it cannot connect to the local emulator anymore.

Logs
    [2020-07-03T16:30:02.104Z]  @firebase/firestore: Firestore (7.15.5): FirestoreClient Initializing. user= null

  console.log node_modules/@firebase/logger/dist/index.cjs.js:98
    [2020-07-03T16:30:02.192Z]  @firebase/firestore: Firestore (7.15.5): MemoryPersistence Starting transaction: Get next mutation batch

  console.log node_modules/@firebase/logger/dist/index.cjs.js:98
    [2020-07-03T16:30:02.193Z]  @firebase/firestore: Firestore (7.15.5): MemoryPersistence Starting transaction: Get next mutation batch

  console.log node_modules/@firebase/logger/dist/index.cjs.js:98
    [2020-07-03T16:30:02.194Z]  @firebase/firestore: Firestore (7.15.5): MemoryPersistence Starting transaction: Locally write mutations

  console.log node_modules/@firebase/logger/dist/index.cjs.js:98
    [2020-07-03T16:30:02.196Z]  @firebase/firestore: Firestore (7.15.5): MemoryPersistence Starting transaction: notifyLocalViewChanges

  console.log node_modules/@firebase/logger/dist/index.cjs.js:98
    [2020-07-03T16:30:02.196Z]  @firebase/firestore: Firestore (7.15.5): MemoryPersistence Starting transaction: Get next mutation batch

  console.log node_modules/@firebase/logger/dist/index.cjs.js:98
    [2020-07-03T16:30:02.196Z]  @firebase/firestore: Firestore (7.15.5): MemoryPersistence Starting transaction: Get next mutation batch

  console.log node_modules/@firebase/logger/dist/index.cjs.js:98
    [2020-07-03T16:30:02.197Z]  @firebase/firestore: Firestore (7.15.5): Connection Creating Firestore stub.

  console.log node_modules/@firebase/logger/dist/index.cjs.js:98
    [2020-07-03T16:30:02.207Z]  @firebase/firestore: Firestore (7.15.5): Connection Opening GRPC stream

  console.log node_modules/@firebase/logger/dist/index.cjs.js:98
    [2020-07-03T16:30:02.211Z]  @firebase/firestore: Firestore (7.15.5): Connection GRPC stream sending: { database: 'projects/test-1593793802077/databases/(default)' }

  console.warn node_modules/@firebase/logger/dist/index.cjs.js:98
    [2020-07-03T16:30:03.228Z]  @firebase/firestore: Firestore (7.15.5): Connection GRPC stream error. Code: 16 Message: 16 UNAUTHENTICATED: Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.

  console.log node_modules/@firebase/logger/dist/index.cjs.js:98
    [2020-07-03T16:30:03.230Z]  @firebase/firestore: Firestore (7.15.5): Connection GRPC stream ended.

  console.log node_modules/@firebase/logger/dist/index.cjs.js:98
    [2020-07-03T16:30:03.231Z]  @firebase/firestore: Firestore (7.15.5): PersistentStream close with error: FirebaseError: [code=unauthenticated]: 16 UNAUTHENTICATED: Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.

  console.log node_modules/@firebase/logger/dist/index.cjs.js:98
    [2020-07-03T16:30:03.235Z]  @firebase/firestore: Firestore (7.15.5): Connection Opening GRPC stream

  console.log node_modules/@firebase/logger/dist/index.cjs.js:98
    [2020-07-03T16:30:03.235Z]  @firebase/firestore: Firestore (7.15.5): Connection GRPC stream sending: { database: 'projects/test-1593793802077/databases/(default)' }

  console.warn node_modules/@firebase/logger/dist/index.cjs.js:98
    [2020-07-03T16:30:03.380Z]  @firebase/firestore: Firestore (7.15.5): Connection GRPC stream error. Code: 16 Message: 16 UNAUTHENTICATED: Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.

  console.log node_modules/@firebase/logger/dist/index.cjs.js:98
    [2020-07-03T16:30:03.381Z]  @firebase/firestore: Firestore (7.15.5): Connection GRPC stream ended.

  console.log node_modules/@firebase/logger/dist/index.cjs.js:98
    [2020-07-03T16:30:03.381Z]  @firebase/firestore: Firestore (7.15.5): PersistentStream close with error: FirebaseError: [code=unauthenticated]: 16 UNAUTHENTICATED: Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.

  console.log node_modules/@firebase/logger/dist/index.cjs.js:98
    [2020-07-03T16:30:03.381Z]  @firebase/firestore: Firestore (7.15.5): ExponentialBackoff Backing off for 361 ms (base delay: 1000 ms, delay with jitter: 508 ms, last attempt: 147 ms ago)

Relevant Code:

  const app = firebase.initializeTestApp({
    projectId,
    auth,
  })
 
+ app.firestore().settings({
+   ignoreUndefinedProperties: true,
+ })

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions