aws / aws/aws-cdk

(aws-cdk-lib/aws-lambda-nodejs BundlingOptions): `platform` property should default to `node` when not specified

Open
#29,290 5 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-lambda-nodejs bug effort/small p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

The `platform` property in [BundlingOptions](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda_nodejs.BundlingOptions.html#platform) interface has wrong information.

![image](https://github.com/aws/aws-cdk/assets/10464497/5b1ac2d6-b4bf-41af-ae8c-1626b6b5a4f2)

According to [esbuild API docs](https://esbuild.github.io/api/#platform), the default value is `browser` when no platform is specified. For this reason, we should change the default value to `node` for the `BundlingOptions` of the `NodejsFunction` resource.

### Expected Behavior

see above

### Current Behavior

see above

### Reproduction Steps

see above

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CDK CLI Version

2.130.0

### Framework Version

_No response_

### Node.js Version

20.10.0

### OS

Ubuntu 22.04.3 LTS

### Language

TypeScript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the BundlingOptions interface and the NodejsFunction resource, then compare the documented platform behavior with the esbuild API documentation linked in the issue. Update the stated default to node and verify that the BundlingOptions documentation reflects the corrected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, node.js, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.