Skip to content

(aws-lambda-nodejs): support charset option #16668

@intptr-t

Description

@intptr-t

Use Case

If we deploy a Lambda function that currently contains multibyte characters, the escaped characters will be output.

I am currently facing the same problem that the official documentation is talking about when using CDK.
esbuild API document says

using escape sequences makes the generated output slightly bigger, and also makes it harder to read.

Example

Input Lambda code

exports.handler = async (event) => { console.log("Japanese:日本語"); }
Current output code
exports.handler = async (event) => {
  console.log("Japanese:\u65E5\u672C\u8A9E");
};
Expected output code
exports.handler = async (event) => {
  console.log("Japanese:日本語");
};

Proposed Solution

Add the charset option to the bundling.

new NodejsFunction(this, 'ExampleLambda', {
  bundling: {
    charset: 'utf-8',
  },
  ...
});

Other

Possible response methods

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions