Skip to content

Commit

Permalink
fix(developer): correct secret assignment for v1 function
Browse files Browse the repository at this point in the history
  • Loading branch information
steveoh committed Jul 10, 2024
1 parent c093b8f commit 66c417a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/developer/functions/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { debug } from 'firebase-functions/logger';
import { defineSecret } from 'firebase-functions/params';
import { runWith } from 'firebase-functions/v1';
import { https, setGlobalOptions } from 'firebase-functions/v2';
import { safelyInitializeApp } from './firebase.js';
Expand All @@ -8,6 +9,7 @@ safelyInitializeApp();
const serviceAccount = `firestore-function-sa@${process.env.GCLOUD_PROJECT}.iam.gserviceaccount.com`;
const vpcConnector = 'memorystore-connector';
const vpcConnectorEgressSettings = 'PRIVATE_RANGES_ONLY';
const secret = defineSecret('SENDGRID_API_KEY');

setGlobalOptions({
serviceAccount,
Expand Down Expand Up @@ -37,10 +39,9 @@ export const onCreateUser = runWith({
serviceAccount,
vpcConnector,
vpcConnectorEgressSettings,
secrets: [secret],
})
.auth.user({
secrets: ['SENDGRID_API_KEY'],
})
.auth.user()
.onCreate(async (user) => {
debug('[auth::user::onCreate] importing createUser');
const createUser = (await import('./auth/onCreate.js')).createUser;
Expand Down

0 comments on commit 66c417a

Please sign in to comment.