Skip to content

Commit 62c9e68

Browse files
author
root
committed
fix(wrapped): route wrappedFunctions to test project during preview/local builds for Stripe sandbox
1 parent 340a7cf commit 62c9e68

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

nuxt.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ export default defineNuxtConfig({
120120
appId: "1:1053765361889:web:feb439fa8220fadf1157a0",
121121
measurementId: "G-XJDRX60BNX",
122122
},
123+
wrappedFunctionsProjectId: local ? "whatsanalyze-wrapped" : "whatsanalyze-wrapped-prod",
123124
},
124125
},
125126

plugins/firebase.client.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,23 @@ export default defineNuxtPlugin(() => {
2828
"wrapped"
2929
);
3030
wrappedFirestore = getFirestore(wrappedApp);
31-
wrappedFunctions = getFunctions(wrappedApp);
31+
32+
if (
33+
config.public.wrappedFunctionsProjectId &&
34+
config.public.wrappedFunctionsProjectId !==
35+
config.public.wrappedFirebase.projectId
36+
) {
37+
const functionsApp = initializeApp(
38+
{
39+
...config.public.wrappedFirebase,
40+
projectId: config.public.wrappedFunctionsProjectId,
41+
},
42+
"wrapped-functions"
43+
);
44+
wrappedFunctions = getFunctions(functionsApp);
45+
} else {
46+
wrappedFunctions = getFunctions(wrappedApp);
47+
}
3248
} catch (e) {
3349
console.warn("Wrapped Firebase initialization:", e);
3450
}

0 commit comments

Comments
 (0)