File tree Expand file tree Collapse file tree
dev-packages/e2e-tests/test-applications/hydrogen-react-router-7 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ export async function action ( ) {
2+ throw new Error ( 'Action Error' ) ;
3+ }
4+
5+ export default function ActionError ( ) {
6+ return (
7+ < div >
8+ < h1 > Action Error</ h1 >
9+ </ div >
10+ ) ;
11+ }
Original file line number Diff line number Diff line change 99import { type AppLoadContext , createRequestHandler , getStorefrontHeaders } from '@shopify/remix-oxygen' ;
1010import { CART_QUERY_FRAGMENT } from '~/lib/fragments' ;
1111import { AppSession } from '~/lib/session' ;
12- import { wrapRequestHandler } from '@sentry/cloudflare/request' ;
12+ import { httpServerIntegration , wrapRequestHandler } from '@sentry/cloudflare/request' ;
1313// Virtual entry point for the app
1414// eslint-disable-next-line @typescript-eslint/ban-ts-comment
1515// @ts -expect-error
@@ -38,6 +38,7 @@ export default {
3838 dsn : 'https://public@dsn.ingest.sentry.io/1337' ,
3939 tracesSampleRate : 1.0 ,
4040 tunnel : `http://localhost:3031/` , // proxy server
41+ integrations : [ httpServerIntegration ( { maxRequestBodySize : 'small' } ) ] ,
4142 } ,
4243 // Need to cast to any because this is not on cloudflare
4344 request : request as any ,
Original file line number Diff line number Diff line change 1+ import { expect , test } from '@playwright/test' ;
2+ import { waitForError } from '@sentry-internal/test-utils' ;
3+
4+ test ( 'Applies the options of `httpServerIntegration` imported from `@sentry/cloudflare/request`' , async ( {
5+ request,
6+ } ) => {
7+ const errorPromise = waitForError ( 'hydrogen-react-router-7' , errorEvent => {
8+ return errorEvent . exception ?. values ?. [ 0 ] ?. value === 'Action Error' ;
9+ } ) ;
10+
11+ const body = JSON . stringify ( { payload : 'x' . repeat ( 4_000 ) } ) ;
12+ await request . post ( '/action-error' , { data : body , headers : { 'content-type' : 'application/json' } } ) ;
13+
14+ const errorEvent = await errorPromise ;
15+
16+ // `maxRequestBodySize: 'small'` truncates at 1,000 bytes, the default (`'medium'`) would keep the full body.
17+ expect ( errorEvent . request ?. data ) . toBe ( `${ body . slice ( 0 , 997 ) } ...` ) ;
18+ } ) ;
Original file line number Diff line number Diff line change @@ -20,3 +20,5 @@ export function wrapRequestHandler(
2020) : Promise < Response > {
2121 return wrapRequestHandlerWithInit ( wrapperOptions , handler , initBaseSdk ) ;
2222}
23+
24+ export { httpServerIntegration } from './integrations/httpServer' ;
You can’t perform that action at this time.
0 commit comments