-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Package: remixIssues related to the Sentry Remix SDKIssues related to the Sentry Remix SDK
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which package are you using?
@sentry/remix
SDK Version
7.9.0
Framework Version
React 17.0.2
Link to Sentry event
No response
Steps to Reproduce
- Create a Remix project with a root loader that returns a response object (or uses the Remix provided
jsonfunction).
export const loader: LoaderFunction = async () => {
return json(
{ data_one: [], data_two: "a string" },
{ headers: { 'Cache-Control': 'max-age=300' } }
)
}- Configure Sentry via
Sentry.init(...)inentry.server.tsx - Load the root page in a browser
- Inspect
__remixContext.routeData.rootin dev tools and it will have the shape{ sentryBaggage: string, sentryTrace: string, size: number }instead of containing the loader data.
This looks to be caused by the makeWrappedRootLoader function which handles the result of the origLoader as an Promise<AppData> | AppData instead of Promise<Response> | Response | Promise<AppData> | AppData:
function makeWrappedRootLoader(origLoader: DataFunction): DataFunction {
return async function (this: unknown, args: DataFunctionArgs): Promise<Response | AppData> {
const res = await origLoader.call(this, args);
return { ...res, ...getTraceAndBaggage() };
};
}Expected Result
Data and ResponseInit settings are propagated when a Promise<Response> or Response is returned from the root loader.
Actual Result
Data and headers (or ResponseInit) data from the root loader are omitted from data on the client and the response respectively.
Metadata
Metadata
Assignees
Labels
Package: remixIssues related to the Sentry Remix SDKIssues related to the Sentry Remix SDK