Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export async function action() {
throw new Error('Action Error');
}

export default function ActionError() {
return (
<div>
<h1>Action Error</h1>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { type AppLoadContext, createRequestHandler, getStorefrontHeaders } from '@shopify/remix-oxygen';
import { CART_QUERY_FRAGMENT } from '~/lib/fragments';
import { AppSession } from '~/lib/session';
import { wrapRequestHandler } from '@sentry/cloudflare/request';
import { httpServerIntegration, wrapRequestHandler } from '@sentry/cloudflare/request';
// Virtual entry point for the app
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
Expand Down Expand Up @@ -38,6 +38,7 @@ export default {
dsn: 'https://public@dsn.ingest.sentry.io/1337',
tracesSampleRate: 1.0,
tunnel: `http://localhost:3031/`, // proxy server
integrations: [httpServerIntegration({ maxRequestBodySize: 'small' })],
},
// Need to cast to any because this is not on cloudflare
request: request as any,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { expect, test } from '@playwright/test';
import { waitForError } from '@sentry-internal/test-utils';

test('Applies the options of `httpServerIntegration` imported from `@sentry/cloudflare/request`', async ({
request,
}) => {
const errorPromise = waitForError('hydrogen-react-router-7', errorEvent => {
return errorEvent.exception?.values?.[0]?.value === 'Action Error';
});

const body = JSON.stringify({ payload: 'x'.repeat(4_000) });
await request.post('/action-error', { data: body, headers: { 'content-type': 'application/json' } });

const errorEvent = await errorPromise;

// `maxRequestBodySize: 'small'` truncates at 1,000 bytes, the default (`'medium'`) would keep the full body.
expect(errorEvent.request?.data).toBe(`${body.slice(0, 997)}...`);
});
2 changes: 2 additions & 0 deletions packages/cloudflare/src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ export function wrapRequestHandler(
): Promise<Response> {
return wrapRequestHandlerWithInit(wrapperOptions, handler, initBaseSdk);
}

export { httpServerIntegration } from './integrations/httpServer';
Loading