Skip to content

Commit 5b68f46

Browse files
committed
fix: revert remix change
1 parent 6bb1d2c commit 5b68f46

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

packages/remix/src/server/instrumentServer.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,8 @@ function instrumentBuildCallback(
400400
// We should be able to wrap them, as they may not be wrapped before.
401401
const defaultExport = wrappedEntry.module.default as undefined | WrappedFunction;
402402
if (defaultExport && !defaultExport.__sentry_original__) {
403-
fill(wrappedEntry.module, 'default', makeWrappedDocumentRequestFunction(options?.instrumentTracing));
403+
const instrumentTracing = options ? options.instrumentTracing : undefined;
404+
fill(wrappedEntry.module, 'default', makeWrappedDocumentRequestFunction(instrumentTracing));
404405
}
405406

406407
for (const [id, route] of Object.entries(build.routes)) {
@@ -414,18 +415,21 @@ function instrumentBuildCallback(
414415
}
415416

416417
if (!(wrappedRoute.module.loader as WrappedFunction).__sentry_original__) {
417-
fill(wrappedRoute.module, 'loader', makeWrappedRootLoader(options?.instrumentTracing, build));
418+
const instrumentTracing = options ? options.instrumentTracing : undefined;
419+
fill(wrappedRoute.module, 'loader', makeWrappedRootLoader(instrumentTracing, build));
418420
}
419421
}
420422

421423
const routeAction = wrappedRoute.module.action as undefined | WrappedFunction;
422424
if (routeAction && !routeAction.__sentry_original__) {
423-
fill(wrappedRoute.module, 'action', makeWrappedAction(id, options?.instrumentTracing, build));
425+
const instrumentTracing = options ? options.instrumentTracing : undefined;
426+
fill(wrappedRoute.module, 'action', makeWrappedAction(id, instrumentTracing, build));
424427
}
425428

426429
const routeLoader = wrappedRoute.module.loader as undefined | WrappedFunction;
427430
if (routeLoader && !routeLoader.__sentry_original__) {
428-
fill(wrappedRoute.module, 'loader', makeWrappedLoader(id, options?.instrumentTracing, build));
431+
const instrumentTracing = options ? options.instrumentTracing : undefined;
432+
fill(wrappedRoute.module, 'loader', makeWrappedLoader(id, instrumentTracing, build));
429433
}
430434

431435
routes[id] = wrappedRoute;
@@ -483,7 +487,7 @@ export const makeWrappedCreateRequestHandler = (options?: { instrumentTracing?:
483487
export function instrumentServer(options?: { instrumentTracing?: boolean }): void {
484488
const pkg = loadModule<{
485489
createRequestHandler: CreateRequestHandlerFunction;
486-
}>('@remix-run/server-runtime', typeof module !== 'undefined' ? module : undefined);
490+
}>('@remix-run/server-runtime', module);
487491

488492
if (!pkg) {
489493
DEBUG_BUILD && debug.warn('Remix SDK was unable to require `@remix-run/server-runtime` package.');

0 commit comments

Comments
 (0)