File tree 3 files changed +12
-2
lines changed 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " open-next " : patch
3
+ ---
4
+
5
+ fix lambda streaming hanging after return
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export interface ResponseStream extends Writable {
9
9
type Handler = (
10
10
event : APIGatewayProxyEventV2 ,
11
11
responseStream : ResponseStream ,
12
- context ? : Context ,
12
+ context : Context ,
13
13
) => Promise < any > ;
14
14
15
15
interface Metadata {
Original file line number Diff line number Diff line change @@ -23,7 +23,12 @@ function formatWarmerResponse(event: WarmerEvent) {
23
23
24
24
const handler : WrapperHandler = async ( handler , converter ) =>
25
25
awslambda . streamifyResponse (
26
- async ( event : AwsLambdaEvent , responseStream ) : Promise < AwsLambdaReturn > => {
26
+ async (
27
+ event : AwsLambdaEvent ,
28
+ responseStream ,
29
+ context ,
30
+ ) : Promise < AwsLambdaReturn > => {
31
+ context . callbackWaitsForEmptyEventLoop = false ;
27
32
if ( "type" in event ) {
28
33
const result = await formatWarmerResponse ( event ) ;
29
34
responseStream . end ( Buffer . from ( JSON . stringify ( result ) ) , "utf-8" ) ;
You can’t perform that action at this time.
0 commit comments