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 ESM bundling in AWS Lambda / Nodejs 14.x #490

Closed
revmischa opened this issue Jan 19, 2022 · 4 comments
Closed

Bug: Unable to use ESM bundling in AWS Lambda / Nodejs 14.x #490

revmischa opened this issue Jan 19, 2022 · 4 comments
Assignees
Labels
blocked This item's progress is blocked by external dependency or reason bug-upstream This item is related to a bug caused by upstream dependency duplicate This issue is a duplicate of an existing one tracer This item relates to the Tracer Utility
Projects

Comments

@revmischa
Copy link

Bug description

If you enable "ESM" bundling with NodejsFunction you get this error:

	{
    "errorType": "Error",
    "errorMessage": "Dynamic require of \"util\" is not supported",
    "stack": [
        "Error: Dynamic require of \"util\" is not supported",
        "    at file:///var/task/index.mjs:1:820",
        "    at null.<anonymous> (/node_modules/cls-hooked/context.js:4:14)",
        "    at file:///var/task/index.mjs:1:1067",
        "    at null.<anonymous> (/node_modules/aws-xray-sdk-core/dist/lib/context_utils.js:5:11)",
        "    at file:///var/task/index.mjs:1:1067",
        "    at null.<anonymous> (/node_modules/aws-xray-sdk-core/dist/lib/aws-xray.js:2:20)",
        "    at file:///var/task/index.mjs:1:1067",
        "    at null.<anonymous> (/node_modules/aws-xray-sdk-core/dist/lib/index.js:3:18)",
        "    at file:///var/task/index.mjs:1:1067",
        "    at null.<anonymous> (/node_modules/@aws-lambda-powertools/tracer/src/provider/ProviderService.ts:4:1)"
    ]
}

Expected Behavior

Would like to use xray with ESM.

Steps to Reproduce

I'm using middy with the tracer middleware. I get the above error when I set
format: OutputFormat.ESM

Environment

  • Powertools version used: 0.3.3
  • Packaging format (Layers, npm): nodejsfunction
  • AWS Lambda function runtime: node 14
  • Debugging logs:

Related issues, RFCs

@revmischa revmischa added bug Something isn't working triage This item has not been triaged by a maintainer, please wait labels Jan 19, 2022
@revmischa revmischa changed the title tracking: Dynamic require of "util" tracking: Dynamic require of "util" is not supported Jan 19, 2022
@revmischa revmischa changed the title tracking: Dynamic require of "util" is not supported tracing: Dynamic require of "util" is not supported Jan 19, 2022
@flochaz
Copy link
Contributor

flochaz commented Jan 19, 2022

Thank you for reporting it. We will have a look asap.

@saragerion saragerion added the blocked This item's progress is blocked by external dependency or reason label Jan 20, 2022
@dreamorosi dreamorosi removed the triage This item has not been triaged by a maintainer, please wait label Jan 20, 2022
@dreamorosi dreamorosi added this to Issues - Needs clarification or refinement (untriaged) in Issues via automation Jan 20, 2022
@dreamorosi dreamorosi moved this from Issues - Needs clarification or refinement (untriaged) to Issues - On hold / Blocked in Issues Jan 20, 2022
@dreamorosi dreamorosi changed the title tracing: Dynamic require of "util" is not supported bug(tracing): Unable to use ESM bundling in AWS Lambda / Nodejs 14.x Jan 20, 2022
@dreamorosi dreamorosi added the tracer This item relates to the Tracer Utility label Jan 20, 2022
@dreamorosi dreamorosi changed the title bug(tracing): Unable to use ESM bundling in AWS Lambda / Nodejs 14.x bug(tracer): Unable to use ESM bundling in AWS Lambda / Nodejs 14.x Jan 20, 2022
@flochaz
Copy link
Contributor

flochaz commented Jan 21, 2022

As reported by @dreamorosi, the issue is on xray-sdk side. We will follow aws/aws-xray-sdk-node#482 resolution carefully.

@dreamorosi
Copy link
Contributor

I'm going to close this issue in favor of #521 where we will be tracking efforts to support ESM bundling in Powertools.

Issues automation moved this from Issues - On hold / Blocked to Issues - Done (closed) May 12, 2022
@github-actions
Copy link
Contributor

⚠️ COMMENT VISIBILITY WARNING ⚠️

Comments on closed issues 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.

@dreamorosi dreamorosi added duplicate This issue is a duplicate of an existing one bug-upstream This item is related to a bug caused by upstream dependency and removed bug Something isn't working labels Nov 14, 2022
@dreamorosi dreamorosi self-assigned this Nov 14, 2022
@dreamorosi dreamorosi changed the title bug(tracer): Unable to use ESM bundling in AWS Lambda / Nodejs 14.x Bug: Unable to use ESM bundling in AWS Lambda / Nodejs 14.x Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked This item's progress is blocked by external dependency or reason bug-upstream This item is related to a bug caused by upstream dependency duplicate This issue is a duplicate of an existing one tracer This item relates to the Tracer Utility
Projects
No open projects
Issues
  
Issues - Done (closed)
Development

No branches or pull requests

4 participants