File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
packages/open-next/src/overrides/wrappers Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -16,9 +16,9 @@ const handler: WrapperHandler<InternalEvent, InternalResult> =
16
16
request : Request ,
17
17
env : Record < string , string > ,
18
18
ctx : any ,
19
+ abortSignal : AbortSignal ,
19
20
) : Promise < Response > => {
20
21
globalThis . process = process ;
21
-
22
22
// Set the environment variables
23
23
// Cloudflare suggests to not override the process.env object but instead apply the values to it
24
24
for ( const [ key , value ] of Object . entries ( env ) ) {
@@ -66,9 +66,10 @@ const handler: WrapperHandler<InternalEvent, InternalResult> =
66
66
67
67
return Writable . fromWeb ( writable ) ;
68
68
} ,
69
- // For some reason the signal from `request` here did not work.
70
- // @ts -expect-error This is defined in init from cloudflare
71
- abortSignal : globalThis [ Symbol . for ( "__cloudflare-context__" ) ] . signal ,
69
+ // This is for passing along the original abort signal from the initial Request you retrieve in your worker
70
+ // Ensures that the response we pass to NextServer is aborted if the request is aborted
71
+ // By doing this `request.signal.onabort` will work in route handlers
72
+ abortSignal : abortSignal ,
72
73
} ;
73
74
74
75
ctx . waitUntil (
You can’t perform that action at this time.
0 commit comments