firebase / firebase/firebase-admin-node

HttpAgent can not work when serviceAccountPathOrObject parameter is a object in admin.credential.cert()

オープン
#2,960 コメント 2 件 リアクション 1 件 担当者 1 名 @lahirumaramba が担当を希望しています GitHub で見る
api: core
主要言語
TypeScript
スター
1.7k
フォーク
419
平均マージ
3日 10時間
マージ済み PR(30日)
16

説明

### Problem

When calling *admin.credential.cert()*, and the *serviceAccountPathOrObject* parameter is a object, not a file path, the http proxy agent can not work.

### Environment

* Operating System version: Red Hat Enterprice Linux 8.10
* Firebase SDK version: 13.4.0
* Firebase Product: message
* Node.js version: 22.11.0
* NPM version: 10.9.0

#### Steps to reproduce:

```
#### Relevant Code:

import * as admin from "firebase-admin";
import {readFilesync }from "fs";
import * as https from "https",

const serviceAccount = JSON.parse(readFilesync("./serviceAccount.json", "utf8"))
const proxyAgent = new https.Agent({
host:"xxx",
port: 8080,
keepAlive: true,
rejectUnauthorized: false,
});
const client= admin.initializeApp({
credential:admin.credential.cert(
{
clientEmail: serviceAccount.client_email,
privatekey: serviceAccount.private_key,
projectId: serviceAccount.project_id,
},// when serviceAccount is a object, it will raise the "app/invalid-credential" error
// "./serviceAccount.json", when serviceAccount is a file path, can work
proxyAgent
),
httpAgent: proxyAgent,
});
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。