Skip to content

Commit 1248244

Browse files
committed
fix: revert remix change
1 parent c104aee commit 1248244

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
@@ -397,7 +397,8 @@ function instrumentBuildCallback(
397397
// We should be able to wrap them, as they may not be wrapped before.
398398
const defaultExport = wrappedEntry.module.default as undefined | WrappedFunction;
399399
if (defaultExport && !defaultExport.__sentry_original__) {
400-
fill(wrappedEntry.module, 'default', makeWrappedDocumentRequestFunction(options?.instrumentTracing));
400+
const instrumentTracing = options ? options.instrumentTracing : undefined;
401+
fill(wrappedEntry.module, 'default', makeWrappedDocumentRequestFunction(instrumentTracing));
401402
}
402403

403404
for (const [id, route] of Object.entries(build.routes)) {
@@ -411,18 +412,21 @@ function instrumentBuildCallback(
411412
}
412413

413414
if (!(wrappedRoute.module.loader as WrappedFunction).__sentry_original__) {
414-
fill(wrappedRoute.module, 'loader', makeWrappedRootLoader(options?.instrumentTracing, build));
415+
const instrumentTracing = options ? options.instrumentTracing : undefined;
416+
fill(wrappedRoute.module, 'loader', makeWrappedRootLoader(instrumentTracing, build));
415417
}
416418
}
417419

418420
const routeAction = wrappedRoute.module.action as undefined | WrappedFunction;
419421
if (routeAction && !routeAction.__sentry_original__) {
420-
fill(wrappedRoute.module, 'action', makeWrappedAction(id, options?.instrumentTracing, build));
422+
const instrumentTracing = options ? options.instrumentTracing : undefined;
423+
fill(wrappedRoute.module, 'action', makeWrappedAction(id, instrumentTracing, build));
421424
}
422425

423426
const routeLoader = wrappedRoute.module.loader as undefined | WrappedFunction;
424427
if (routeLoader && !routeLoader.__sentry_original__) {
425-
fill(wrappedRoute.module, 'loader', makeWrappedLoader(id, options?.instrumentTracing, build));
428+
const instrumentTracing = options ? options.instrumentTracing : undefined;
429+
fill(wrappedRoute.module, 'loader', makeWrappedLoader(id, instrumentTracing, build));
426430
}
427431

428432
routes[id] = wrappedRoute;
@@ -480,7 +484,7 @@ export const makeWrappedCreateRequestHandler = (options?: { instrumentTracing?:
480484
export function instrumentServer(options?: { instrumentTracing?: boolean }): void {
481485
const pkg = loadModule<{
482486
createRequestHandler: CreateRequestHandlerFunction;
483-
}>('@remix-run/server-runtime', typeof module !== 'undefined' ? module : undefined);
487+
}>('@remix-run/server-runtime', module);
484488

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

0 commit comments

Comments
 (0)