Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Creating a serverless application using the AWS CDK" is using outdated AWS Lambda runtime and old version of AWS JS SDK #450

Closed
markusl opened this issue Feb 27, 2023 · 3 comments · Fixed by #451

Comments

@markusl
Copy link
Contributor

markusl commented Feb 27, 2023

"Creating a serverless application using the AWS CDK" is using outdated AWS Lambda runtime and old version of AWS JS SDK

Proposal:

  • Update AWS Lambda to NODEJS_18_X
  • Update AWS JS SDK to v3
@Hustenbonbon
Copy link

This fix is broken and leads to crashing lambdas, returning internal server error.|
Bugs I found so far:

  • Using import syntax without a package.json
  • Only fixing the second version of widget.js, not the first

If you update an entry-level guide, please test it before.

@markusl
Copy link
Contributor Author

markusl commented Apr 17, 2023

Thanks for noticing this. As noted, the code itself does work, but requires using one of the documented options:

Authors can tell Node.js to use the ECMAScript modules loader via the .mjs file extension, the package.json "type" field, or the --input-type flag

In CDK, there is support for ECMAScript modules and this could be worth mentioning also in this page since people likely run into the issue when developing. See also aws/aws-cdk#23333

@lizsnyder is looking into the possibility of updating the first version of the code. See comment at awsdocs/aws-doc-sdk-examples#4663

@Hustenbonbon
Copy link

Thanks for reacting that quick. My intention was to make this part of the guide (as the content of the lambdas are not the focus) as easy-to-use as possible.
I saw that there is an update, I would consider my suggested changes to your update as a hotfix, so it works out of the box in the context of the guide until the guide is updated.

Thanks for the attached links, they are very helpful to further understand the problem space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants