Skip to content

Expose and document the Firestore.projectId getter #2278

@dandv

Description

@dandv

Please make sure you have searched for information in the following guides.

Documentation Request

Easy access to db.projectId would help diagnose situations in which it's not clear that the correct project ID was picked up.

import { initializeApp } from 'firebase-admin/app';
import { getFirestore } from 'firebase-admin/firestore';

initializeApp();
const db = getFirestore();

// Running the run line below triggers "INTERNAL ERROR: Client is not yet ready to issue requests"
// console.log('Database project ID:', (db as unknown as { projectId: string})['projectId']);

It would also be useful to document when exactly the projectId becomes available (empirically after the first read operation).

Metadata

Metadata

Assignees

Labels

api: firestoreIssues related to the googleapis/nodejs-firestore API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions