Skip to content

Commit fc6dd82

Browse files
Support projectId for cloud functions (#85)
1 parent ce9c73b commit fc6dd82

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

functions/firestore-export/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ const bucket = 'gs://BUCKET_NAME';
99
exports.scheduledFirestoreExport = functions.pubsub
1010
.schedule('every 24 hours')
1111
.onRun((context) => {
12+
13+
const projectId = process.env.GCP_PROJECT || process.env.GCLOUD_PROJECT;
1214
const databaseName =
13-
client.databasePath(process.env.GCP_PROJECT, '(default)');
15+
client.databasePath(projectId, '(default)');
1416

1517
return client.exportDocuments({
1618
name: databaseName,

0 commit comments

Comments
 (0)