-
-
Notifications
You must be signed in to change notification settings - Fork 36
Closed
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the feature has not already been requested
🚀 Feature Proposal
Introduce a new disableBase64Encoding option that disables Base64 encoding and ensures the isBase64Encoded property is not included in the response.
I implemented this in my fork here:
https://github.com/filipe-cantarelli/aws-lambda-fastify
Since this adds a new option, I wanted to check with the community first and get some feedback before opening a pull request.
Motivation
API Gateway response streaming does not support the isBase64Encoded property (see: https://aws.amazon.com/blogs/compute/building-responsive-apis-with-amazon-api-gateway-response-streaming/
).
A practical workaround is to introduce a disableBase64Encoding option, which disables Base64 encoding and prevents the isBase64Encoded property from being included in the response.
Example
import { pipeline } from 'node:stream/promises';
import awsLambdaFastify from '@fastify/aws-lambda';
import { app } from './app.js';
const proxy = awsLambdaFastify(app, { payloadAsStream: true, disableBase64Encoding: true })
export const handler = awslambda.streamifyResponse(async (event, responseStream, context) => {
const { meta, stream } = await proxy(event, context)
responseStream = awslambda.HttpResponseStream.from(responseStream, meta)
console.error(meta);
await pipeline(stream, responseStream)
})
await app.ready() // https://github.com/fastify/aws-lambda-fastify/issues/89Metadata
Metadata
Assignees
Labels
No labels