aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
2.96k stars 556 forks source link

Incompatibility with ESM in @aws-crypto/sha256-browser #6162

Closed ychua closed 1 week ago

ychua commented 3 weeks ago

Checkboxes for prior research

Describe the bug

Description: I have encountered an issue with the @aws-sdk/client-sns package and its bundled version of @aws-crypto/sha256-browser. The latest version of @aws-sdk/client-sns (@aws-sdk/client-sns@3.58.0) includes an older version of @aws-crypto/sha256-browser that lacks ESM (ES Modules) support. This creates compatibility issues when using the package in modern JavaScript environments that rely on ESM, such as Miniflare or Vite.

Severity: Medium. This issue affects the compatibility of @aws-sdk/client-sns with modern JavaScript projects and can cause errors or unexpected behavior for developers using ESM-based tools and frameworks.

SDK version number

@aws-crypto/sha256-browser@3.0.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v20.12.2

Reproduction Steps

Steps to Reproduce:

Create a new project using a modern JavaScript framework or bundler, such as Vite or Miniflare. Install @aws-sdk/client-sns and its dependencies using the following command: npm install @aws-sdk/client-sns@3.58.0. Attempt to import and use the @aws-sdk/client-sns package in your ESM-based code.

Observed Behavior

The bundled @aws-crypto/sha256-browser package, which is a dependency of @aws-sdk/client-sns, is not written in ESM format. This leads to errors or compatibility issues when trying to use @aws-sdk/client-sns in an ESM-based project.

Expected Behavior

The @aws-sdk/client-sns package should be compatible with ESM and should not cause issues when used in modern JavaScript environments.

Possible Solution

Update the bundled @aws-crypto/sha256-browser package in @aws-sdk/client-sns to a newer version that includes ESM support. This will ensure compatibility with modern JavaScript environments and avoid potential issues for users of the SDK.

Also worth upgrading other aws-crypto packages if they are dated

Additional Information/Context

No response

aBurmeseDev commented 3 weeks ago

HI @ychua - thanks for reaching out.

We've briefly discussed this with the team and will work on updating packages accordingly. I'll keep it posted.

Please refer to this workaround for the meantime: https://github.com/aws/aws-sdk-js-v3/issues/2478#issuecomment-1142467162

kuhe commented 2 weeks ago

expected in https://github.com/aws/aws-sdk-js-v3/releases/tag/v3.598.0 later today

aBurmeseDev commented 1 week ago

https://github.com/aws/aws-sdk-js-v3/releases/tag/v3.598.0 was successfully released, closing issue. Thanks again for reaching out to us.