Skip to content
This repository was archived by the owner on May 10, 2021. It is now read-only.

Commit 1de3719

Browse files
committed
Enable base64 encoding for function responses
Set process.env.BINARY_SUPPORT to "yes" to enable support for base64 encoding in next-aws-lambda.
1 parent 98c2721 commit 1de3719

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/netlifyFunctionTemplate.js

+7
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ exports.handler = (event, context, callback) => {
4242
event.multiValueQueryStringParameters = event.queryStringParameters;
4343
}
4444

45+
// Enable support for base64 encoding.
46+
// This is used by next-aws-lambda to determine whether to encode the response
47+
// body as base64.
48+
if (!process.env.hasOwnProperty("BINARY_SUPPORT")) {
49+
process.env.BINARY_SUPPORT = "yes";
50+
}
51+
4552
// Get the request URL
4653
const { path } = event;
4754
console.log("[request]", path);

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"scripts": {
2828
"format": "prettier --write .",
2929
"test": "jest --config tests/jest.config.js",
30-
"cypress:local": "env CYPRESS_DEPLOY=local cypress run --config-file false --config video=false",
30+
"cypress:local": "env CYPRESS_DEPLOY=local cypress run --config-file false --config video=false",
3131
"cypress:netlify": "env CYPRESS_DEPLOY=netlify cypress run --config-file false --config video=false",
3232
"cypress:local:testonly": "env CYPRESS_SKIP_DEPLOY=true npm run cypress:local",
3333
"cypress:netlify:testonly": "env CYPRESS_SKIP_DEPLOY=true npm run cypress:netlify"

0 commit comments

Comments
 (0)