Skip to content

Commit e912d47

Browse files
committed
fix(remix): Accept and return plain ServerBuild on Cloudflare instrumentBuild
1 parent 61940fc commit e912d47

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

packages/remix/src/cloudflare/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { ServerBuild } from '@remix-run/server-runtime';
12
import {
23
instrumentBuild as instrumentRemixBuild,
34
makeWrappedCreateRequestHandler,
@@ -14,11 +15,14 @@ export { makeWrappedCreateRequestHandler, sentryHandleError };
1415
* Instruments a Remix build to capture errors and performance data.
1516
* @param build The Remix build to instrument.
1617
* @returns The instrumented Remix build.
18+
*
19+
* Note: CreateRequestHandlerFunction from @shopify/remix-oxygen accepts a ServerBuild, not a function unlike the rest of the Remix ecosystem
20+
* That's why we accept and return a ServerBuild type here.
1721
*/
18-
export const instrumentBuild: typeof instrumentRemixBuild = build => {
22+
export const instrumentBuild = (build: ServerBuild): ServerBuild => {
1923
return instrumentRemixBuild(build, {
2024
instrumentTracing: true,
21-
});
25+
}) as ServerBuild;
2226
};
2327

2428
export type {

packages/remix/src/server/instrumentServer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ export const makeWrappedCreateRequestHandler = (options?: { instrumentTracing?:
434434
function (origCreateRequestHandler: CreateRequestHandlerFunction): CreateRequestHandlerFunction {
435435
return function (
436436
this: unknown,
437-
build: ServerBuild | (() => ServerBuild | Promise<ServerBuild>),
437+
build,
438438
...args: unknown[]
439439
): RequestHandler {
440440
const newBuild = instrumentBuild(build, options);

0 commit comments

Comments
 (0)