Closed thekid closed 1 year ago
Announced in https://aws.amazon.com/de/blogs/compute/introducing-aws-lambda-response-streaming/, April 2023 - supported in Node runtimes.
Code in index.js:
exports.handler = awslambda.streamifyResponse(async (event, stream, context) => { stream.setContentType("text/plain"); stream.write("[" + new Date().toISOString() + "] Hello world...\n"); await new Promise(resolve => setTimeout(resolve, 1000)); stream.write("[" + new Date().toISOString() + "] ...from Lambda\n"); stream.end(); });
Code in serverless.yml:
service: node-streaming provider: name: aws region: eu-central-1 profile: default functions: func: handler: index.handler runtime: nodejs18.x description: 'NodeJS Streaming' url: invokeMode: RESPONSE_STREAM
Invocation:
Implemented in https://github.com/xp-forge/lambda/releases/tag/v5.0.0
Announced in https://aws.amazon.com/de/blogs/compute/introducing-aws-lambda-response-streaming/, April 2023 - supported in Node runtimes.
JavaScript
Code in index.js:
Code in serverless.yml:
Invocation:
See also