Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update resolve-webhook-workspace.ts

Kiran Kaf1159e0c869
diff --git a/apps/web/app/(ee)/api/stripe/integration/webhook/utils/resolve-webhook-workspace.ts b/apps/web/app/(ee)/api/stripe/integration/webhook/utils/resolve-webhook-workspace.ts
index 0907b55ef4..495644fa14 100644
--- a/apps/web/app/(ee)/api/stripe/integration/webhook/utils/resolve-webhook-workspace.ts
+++ b/apps/web/app/(ee)/api/stripe/integration/webhook/utils/resolve-webhook-workspace.ts
@@ -29,7 +29,11 @@ export async function resolveWebhookWorkspace({
return null;
}
- if ((mode === "test" || mode === "sandbox") && workspace.stagingWorkspaceId) {
+ // Test/sandbox events still arrive with the live workspace's Connect account.
+ // If that workspace has a staging workspace that hasn't connected Stripe
+ // itself, route the event there so test data doesn't land on live. Overlay
+ // stripeConnectId so handlers can still call Stripe with the connected account.
+ if (["test", "sandbox"].includes(mode) && workspace.stagingWorkspaceId) {
const stagingWorkspace = await prisma.project.findUnique({
where: {
id: workspace.stagingWorkspaceId,