firebase / firebase/firebase-admin-node

With preferRest: true option set, I am unable to connect to auth emulator

Đang mở
#2,016 11 bình luận 1 reaction 2 người được giao Được @MarkDuckworth nhận Xem trên GitHub
api: auth api: firestore
Ngôn ngữ chính
TypeScript
Star
1.7k
Fork
419
Merge trung bình
3 ngày 10 giờ
Pull request đã merge (30 ngày)
16

Mô tả

### Describe your environment

* Operating System version: Arch Linux
* Firebase SDK version: 11.4.0
* Firebase Product: auth, firestore, storage
* Node.js version: 18.x
* NPM version: 8.19.1

**Additional related dependencies**
```
@google-cloud/logging@10.3.2
@google-cloud/pubsub@3.2.1
firebase-admin@11.4.0
```

### Describe the problem

With `preferRest: true` option set, I am unable to connect to auth emulator

#### Steps to reproduce:

Here is my firebase initialization code

```diff
import { initializeApp, applicationDefault } from 'firebase-admin/app';
import { getAuth } from 'firebase-admin/auth';
import { initializeFirestore } from 'firebase-admin/firestore';

export const app = initializeApp({
credential: applicationDefault(),
projectId: process.env.GCLOUD_PROJECT,
});

export const auth = getAuth(app);
---export const firestore = initializeFirestore(app);
+++export const firestore = initializeFirestore(app, { preferRest: true });
```

When I run my application with `preferRest: true`, I get this error. It seems like emulators are not detected with this option.

```
Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.
at GoogleAuth.getApplicationDefaultAsync (/home/node/app/node_modules/google-auth-library/build/src/auth/googleauth.js:209:19)
at GoogleAuth.getClient (/home/node/app/node_modules/google-auth-library/build/src/auth/googleauth.js:635:17)
at GrpcClient.createStub (/home/node/app/node_modules/google-gax/src/fallback.ts:280:27)
Caused by: Error:
at L0.getAll (/home/node/app/lib/server.js:113:509361)
at ta.get (/home/node/app/lib/server.js:113:32416)
at Function.findByIdentifier (/home/node/app/src/database/user.ts:115:44)\n
```

Application works correctly without `preferRest` option.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.