Skip to content

Conversation

dreamorosi
Copy link
Contributor

Description of your changes

This PR modifies the imports of the aws-xray-sdk-core package to accommodate customers using Powertools via JavaScript rather than TypeScript. Given that these customers don't necessarily use esbuild or other transpilers the ESM import format will case a syntax runtime error as shown in the linked issue.

The customer reporting the issue has kindly provided a workaround which seems to fix the issue and it's implemented in this PR. I have run some manual tests on my machine and the issue seems to indeed have been fixed.

Related issues, RFCs

Issue number: #2163

Checklist

  • My changes meet the tenets criteria
  • I have performed a self-review of my own code
  • I have commented my code where necessary, particularly in areas that should be flagged with a TODO, or hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my change is effective and works
  • The PR title follows the conventional commit semantics

Breaking change checklist

Is it a breaking change?: NO

  • I have documented the migration process
  • I have added, implemented necessary warnings (if it can live side by side)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@dreamorosi dreamorosi self-assigned this Mar 5, 2024
@dreamorosi dreamorosi requested a review from a team March 5, 2024 00:41
@dreamorosi dreamorosi requested a review from a team as a code owner March 5, 2024 00:41
@dreamorosi dreamorosi linked an issue Mar 5, 2024 that may be closed by this pull request
@boring-cyborg boring-cyborg bot added the tracer This item relates to the Tracer Utility label Mar 5, 2024
@pull-request-size pull-request-size bot added the size/S PR between 10-29 LOC label Mar 5, 2024
@dreamorosi
Copy link
Contributor Author

Copy link

sonarqubecloud bot commented Mar 5, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@github-actions github-actions bot added the bug Something isn't working label Mar 5, 2024
@dreamorosi
Copy link
Contributor Author

@am29d if you come online before me (likely), could you please review this & make a release?

Below some ideas for the release notes, feel free to rewrite it entirely or as you see fit.

--

Summary
This minor release fixes a bug affecting customers using Tracer in a JavaScript ESM environment.

Tracer
In v2.0.0 we launched ESM support and most of our focus went on customers using Powertools with TypeScript and bundlers (i.e. esbuild). This introduced a bug that prevented customers using plain JavaScript with ESM from successfully importing the utility.

This release changes the way that the AWS X-Ray SDK for Node.js is imported within the Tracer utility so that customers using ESM with JavaScript can import the utility correctly.

Special thanks to @webdeveric for reporting the issue and suggesting a fix.

Copy link
Contributor

@am29d am29d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks @webdeveric

@am29d am29d merged commit 29630b5 into main Mar 5, 2024
@am29d am29d deleted the 2163-bug-importing-tracer-from-powertools-v2-causes-syntaxerror branch March 5, 2024 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size/S PR between 10-29 LOC tracer This item relates to the Tracer Utility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: importing Tracer from powertools v2 causes SyntaxError
2 participants