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

Fix broken fix #450 - Creating a serverless application using the AWS CDK #454

Open
Hustenbonbon opened this issue Apr 17, 2023 · 3 comments

Comments

@Hustenbonbon
Copy link

As my comment in closed issue #450 stated, the fix from #451 is broken.
I'm going to provide a hotfix in a minute as a PR.

@markusl
Copy link
Contributor

markusl commented Apr 29, 2023

Hi @Hustenbonbon. Please check the updated documentation at https://docs.aws.amazon.com/cdk/v2/guide/serverless_example.html and let us know if there are any other improvements needed. The examples are now using AWS JS SDK v3 and the latest version of AWS Lambda runtimes.

@Hustenbonbon
Copy link
Author

Hi, thanks for reaching out.
I currently get this error after the first part:

{
    "errorType": "Runtime.ImportModuleError",
    "errorMessage": "Error: Cannot find module 'widgets'\nRequire stack:\n- /var/runtime/index.mjs",
    "stack": [
        "Runtime.ImportModuleError: Error: Cannot find module 'widgets'",
        "Require stack:",
        "- /var/runtime/index.mjs",
        "    at _loadUserApp (file:///var/runtime/index.mjs:997:17)",
        "    at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1032:21)",
        "    at async start (file:///var/runtime/index.mjs:1195:23)",
        "    at async file:///var/runtime/index.mjs:1201:1"
    ]
}

I couldn't find a fix immediately, do you want me to check further and make a PR?

@Hustenbonbon
Copy link
Author

If you want to use import syntax in the lambda code, using lambda.NodeJsFunction might be the way to go instead of using lambda.Function

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

No branches or pull requests

2 participants