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(middleware-sdk-s3): missing dependency with esbuild #2814

Merged
merged 1 commit into from
Sep 24, 2021

Conversation

AllanZhengYP
Copy link
Contributor

Issue

Resolves #2806

Description

esbuild will try to bundle the optional dependency @aws-sdk/signature-v4-crt and will throw if the dependency is not installed. Unlike Webpack, there's no good way to suppress it with magical comments.

One way to solve this is to wrap the await import() with try...catch, because esBuild supresses this error explicitly. However, in generated code the import is wrapped by tslib import helper. I didn't remove the import helper because it may break the ES6 class polyfill provided by import helper. Instead, we use the Node.js require() here because:

  1. Crt package doesn't work for any bundlers now anyway
  2. require() won't be analyzed by bundler, so @aws-sdk/signature-v4-crt is not required

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

@codecov-commenter
Copy link

Codecov Report

Merging #2814 (fb7865f) into main (a7f843a) will increase coverage by 0.00%.
The diff coverage is 80.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2814   +/-   ##
=======================================
  Coverage   60.41%   60.41%           
=======================================
  Files         554      554           
  Lines       28883    28885    +2     
  Branches     7076     7072    -4     
=======================================
+ Hits        17450    17452    +2     
  Misses      11433    11433           
Impacted Files Coverage Δ
packages/middleware-sdk-s3/src/S3SignatureV4.ts 88.88% <80.00%> (+0.88%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a7f843a...fb7865f. Read the comment docs.

@AllanZhengYP AllanZhengYP merged commit d5924e9 into aws:main Sep 24, 2021
@github-actions
Copy link

github-actions bot commented Oct 9, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing dependency @aws-sdk/signature-v4-crt after updating to client-s3 3.33.0
3 participants