Skip to content

Commit be7ef5a

Browse files
committed
fix(webapp,webhook-sources): fix the production build and the internal test shard
The webhook API action routes exported action/loader via an inline destructured `export const { action, loader } = createActionApiRoute(...)`, which the Remix production build cannot strip, so it pulled the server-only ~/db.server into the client bundle and failed the build. Split the export into a plain const plus a separate `export { action, loader }`, matching the other API routes, so the server code is removed as expected. Also drop the extra --run from the @internal/webhook-sources test script; CI appends its own --run and the duplicate flag failed the shard.
1 parent e91b4d7 commit be7ef5a

5 files changed

Lines changed: 13 additions & 5 deletions

apps/webapp/app/routes/api.v1.webhooks.deliveries.$deliveryId.replay.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const ParamsSchema = z.object({ deliveryId: z.string() });
1010

1111
// POST /api/v1/webhooks/deliveries/:deliveryId/replay — re-run the delivery's task from its stored
1212
// event as a NEW delivery (we don't keep the raw body, so this re-triggers rather than re-verifies).
13-
export const { action, loader } = createActionApiRoute(
13+
const { action, loader } = createActionApiRoute(
1414
{
1515
params: ParamsSchema,
1616
method: "POST",
@@ -56,3 +56,5 @@ export const { action, loader } = createActionApiRoute(
5656
}
5757
}
5858
);
59+
60+
export { action, loader };

apps/webapp/app/routes/api.v1.webhooks.endpoints.$endpointId.disable.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { webhookEngine } from "~/v3/webhookEngine.server";
88
const ParamsSchema = z.object({ endpointId: z.string() });
99

1010
// POST /api/v1/webhooks/endpoints/:endpointId/disable — pause an endpoint (ingress returns 404).
11-
export const { action, loader } = createActionApiRoute(
11+
const { action, loader } = createActionApiRoute(
1212
{
1313
params: ParamsSchema,
1414
method: "POST",
@@ -32,3 +32,5 @@ export const { action, loader } = createActionApiRoute(
3232
return json(await findWebhookEndpointResource(authentication, params.endpointId));
3333
}
3434
);
35+
36+
export { action, loader };

apps/webapp/app/routes/api.v1.webhooks.endpoints.$endpointId.enable.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { webhookEngine } from "~/v3/webhookEngine.server";
88
const ParamsSchema = z.object({ endpointId: z.string() });
99

1010
// POST /api/v1/webhooks/endpoints/:endpointId/enable — resume a paused endpoint.
11-
export const { action, loader } = createActionApiRoute(
11+
const { action, loader } = createActionApiRoute(
1212
{
1313
params: ParamsSchema,
1414
method: "POST",
@@ -32,3 +32,5 @@ export const { action, loader } = createActionApiRoute(
3232
return json(await findWebhookEndpointResource(authentication, params.endpointId));
3333
}
3434
);
35+
36+
export { action, loader };

apps/webapp/app/routes/api.v1.webhooks.endpoints.$endpointId.rotate-secret.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const ParamsSchema = z.object({ endpointId: z.string() });
1111

1212
// POST /api/v1/webhooks/endpoints/:endpointId/rotate-secret — mint a new signing secret and return
1313
// it ONCE. Only for schemes we generate (hmac / shared-secret); asymmetric endpoints set a public key.
14-
export const { action, loader } = createActionApiRoute(
14+
const { action, loader } = createActionApiRoute(
1515
{
1616
params: ParamsSchema,
1717
method: "POST",
@@ -49,3 +49,5 @@ export const { action, loader } = createActionApiRoute(
4949
return json({ id: endpoint.friendlyId, secretSet: true as const, secret });
5050
}
5151
);
52+
53+
export { action, loader };

internal-packages/webhook-sources/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"scripts": {
1616
"typecheck": "tsc --noEmit",
17-
"test": "vitest --run",
17+
"test": "vitest",
1818
"ingest": "tsx src/ingest.ts",
1919
"catalog:status": "tsx catalog/status.ts",
2020
"catalog:aggregate": "tsx catalog/build-aggregates.ts"

0 commit comments

Comments
 (0)