Reputation: 424
I have been moving a set of Firebase functions to version 2 and I can access secrets in OnCall functions using this syntax:
export const fn = onCall({ secrets: getSecrets() }, () => ...
The getSecrets
call makes the secrets accessible via standard NodeJ process.env.NAME
calls. If you do not set the secrets property, the secrets cannot be retrieved via process.env.NAME
calls.
The onCreate
and onDelete
triggers in the functions.auth module don't appear to have been ported to firebase functions v2 and I am not quite sure how to access the secrets; they cannot be accessed via process.env.NAME
.
The triggers look like this:
export const fn = auth.user().onCreate((user: auth.UserRecord, context) => ...
How do I access secrets in firebase functions v1 onCreate and onDelete triggers?
Upvotes: 0
Views: 46
Reputation: 424
The answer as mentioned in the comments is:
export const fn = functions.runWith({ secrets: getSecrets() }).auth.user().onCreate(...
Upvotes: 0