File tree Expand file tree Collapse file tree 1 file changed +2
-30
lines changed
src/presets/aws-lambda/runtime Expand file tree Collapse file tree 1 file changed +2
-30
lines changed Original file line number Diff line number Diff line change 11import type { Readable } from "node:stream" ;
2- import type {
3- APIGatewayProxyEventV2 ,
4- APIGatewayProxyStructuredResultV2 ,
5- Context ,
6- } from "aws-lambda" ;
2+ import type { APIGatewayProxyEventV2 } from "aws-lambda" ;
73import "#nitro-internal-pollyfills" ;
84import { useNitroApp } from "nitropack/runtime" ;
95import {
@@ -59,6 +55,7 @@ export const handler = awslambda.streamifyResponse(
5955 } ;
6056 if ( r . body ) {
6157 const writer = awslambda . HttpResponseStream . from (
58+ // @ts -expect-error TODO: IMPORTANT! It should be a Writable according to the aws-lambda types
6259 responseStream ,
6360 httpResponseMetadata
6461 ) ;
@@ -85,28 +82,3 @@ async function streamToNodeStream(
8582 }
8683 writer . end ( ) ;
8784}
88-
89- declare global {
90- // eslint-disable-next-line @typescript-eslint/no-namespace
91- namespace awslambda {
92- // https://docs.aws.amazon.com/lambda/latest/dg/configuration-response-streaming.html
93- function streamifyResponse (
94- handler : (
95- event : APIGatewayProxyEventV2 ,
96- responseStream : NodeJS . WritableStream ,
97- context : Context
98- ) => Promise < void >
99- ) : any ;
100-
101- // eslint-disable-next-line @typescript-eslint/no-namespace
102- namespace HttpResponseStream {
103- function from (
104- stream : NodeJS . WritableStream ,
105- metadata : {
106- statusCode : APIGatewayProxyStructuredResultV2 [ "statusCode" ] ;
107- headers : APIGatewayProxyStructuredResultV2 [ "headers" ] ;
108- }
109- ) : NodeJS . WritableStream ;
110- }
111- }
112- }
You can’t perform that action at this time.
0 commit comments