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

Bug: unable to use Lambda Layer with ESM bundles #2231

Closed
dreamorosi opened this issue Mar 14, 2024 · 2 comments · Fixed by #2232
Closed

Bug: unable to use Lambda Layer with ESM bundles #2231

dreamorosi opened this issue Mar 14, 2024 · 2 comments · Fixed by #2232
Assignees
Labels
bug Something isn't working completed This item is complete and has been merged/shipped layers Items related to the Lambda Layers pipeline

Comments

@dreamorosi
Copy link
Contributor

Expected Behaviour

When attaching the v2 Lambda Layer with a Lambda function that uses ESM bundles the function should work normally.

Current Behaviour

When the conditions above are met, the function crashes at startup due to the fact that the code in the Lambda Layer containing an import using the require keyword in the Tracer provider.

The stack trace of the error suggests that the issue will happen even if a polyfill banner is used.

This seems to be due to the banner being included in the customer bundle while the layer code being evaluated/required before that.

Code snippet

N/A

Steps to Reproduce

N/A

Possible Solution

No response

Powertools for AWS Lambda (TypeScript) version

latest

AWS Lambda function runtime

20.x

Packaging format used

Lambda Layers

Execution logs

No response

@dreamorosi dreamorosi self-assigned this Mar 14, 2024
@dreamorosi dreamorosi added confirmed The scope is clear, ready for implementation layers Items related to the Lambda Layers pipeline bug Something isn't working labels Mar 14, 2024
@dreamorosi dreamorosi moved this from Triage to Working on it in Powertools for AWS Lambda (TypeScript) Mar 14, 2024
@dreamorosi dreamorosi linked a pull request Mar 14, 2024 that will close this issue
9 tasks
@dreamorosi dreamorosi moved this from Working on it to Pending review in Powertools for AWS Lambda (TypeScript) Mar 14, 2024
@github-project-automation github-project-automation bot moved this from Pending review to Coming soon in Powertools for AWS Lambda (TypeScript) Mar 15, 2024
Copy link
Contributor

⚠️ COMMENT VISIBILITY WARNING ⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

@github-actions github-actions bot added pending-release This item has been merged and will be released soon and removed confirmed The scope is clear, ready for implementation labels Mar 15, 2024
Copy link
Contributor

This is now released under v2.0.3 version!

@github-actions github-actions bot added completed This item is complete and has been merged/shipped and removed pending-release This item has been merged and will be released soon labels Mar 15, 2024
@dreamorosi dreamorosi moved this from Coming soon to Shipped in Powertools for AWS Lambda (TypeScript) Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working completed This item is complete and has been merged/shipped layers Items related to the Lambda Layers pipeline
Projects
Development

Successfully merging a pull request may close this issue.

1 participant