Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open
#2,960 2 comments 1 reaction 1 assignee View on GitHub

@lahirumaramba is already working on this.

Since Nov 4, 2025.

Assessment

This issue has not been assessed yet.

Description

api: core
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, 
});
Dominant language
TypeScript
Stars
1.7k
Forks
419
Avg merge
4d 20h
Merged PRs (30d)
16

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from firebase/firebase-admin-node

All issues in firebase/firebase-admin-node

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.