Closed sjmueller closed 2 years ago
Seems like the dependency was in the original pr: https://github.com/aws/aws-sdk-js-crypto-helpers/pull/208/files#diff-e23e975394413e9a5621e75d66ab1eb6fbf6f904e552d15afd79060e66187897R23
But then consolidated into another location here: https://github.com/aws/aws-sdk-js-crypto-helpers/commit/8f489cbe4c0e134f826bac66f1bf5172597048b9#diff-0e317ada919ecd46a92a8e17e9958744cb838ceda9ac13987f6ad79f73a443b8L25
This affects a wide number of people using this from CDNs like skypack—Deno, people import
'ing from browser, etc. Can we please prioritize fixing this? Happy to jump in if that's helpful.
Hello 👋! Thank you for bringing this issue to our attention. A PR was merged and released to fix this issue. You should be able to pick up the fix in the 2.0.0 version of the aws-sdk-js-crypto-helpers.
@sjmueller, feel free to close this issue. If you have any questions or concerns feel free to open an issue here
@josecorella Just wanted to say thanks so much for the prompt response. We deeply appreciate it. :)
Thanks @josecorella, I will only be able to verify this works when @aws-sdk/client-kms
upgrades its crypto dependencies to 2.0.0
-- unfortunately aws-sdk-js-v3
on main
branch hasn't updated yet:
https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-kms/package.json#L22-L23
and therefore we are still seeing problems with both skypack:
error: Uncaught Error: [Package Error] "@aws-sdk/util-utf8-browser" no dependency version info found. (Imported by "@aws-crypto/sha256-browser"). throw new Error("[Package Error] \"@aws-sdk/util-utf8-browser\" no dependency version info found. (Imported by \"@aws-crypto/sha256-browser\")."); ^ at https://cdn.skypack.dev/error/unknown:@aws-sdk/util-utf8-browser?from=@aws-crypto/sha256-browser:13:7
and esm.sh:
Uncaught SyntaxError: The requested module '/v54/@aws-crypto/sha256-browser@1.2.2/deno/sha256-browser.js' does not provide an export named 'Sha256'
Obviously aws-sdk-js-crypto-helpers@2.0.0
was released just a few hours ago, but do you know how long it will take to incorporate these latest dependencies here into v3
?
I was able to test the 2.0.0 dependencies with esm.sh
through the specify external dependencies feature:
"@aws-sdk/client-kms": "https://esm.sh/@aws-sdk/client-kms?deps=@aws-crypto/sha256-browser@2.0.0,@aws-crypto/sha256-js@2.0.0"
however, the same error occurred:
The requested module '/v54/@aws-crypto/sha256-browser@2.0.0/deno/sha256-browser.js' does not provide an export named 'Sha256'
Also worth noting that various other AWS SDKs are broken generally on (e.g.) Skypack until this change flows back to them. I tested a somewhat random sampling of @aws-sdk/client-ec2
, @aws-sdk/client-ecs
, @aws-sdk/client-cloudwatch-logs
, and all were broken as of just now.
As before, always happy to help, just let me know what I can do. Among other things I'd be happy to help work on tests to make sure this doesn't happen again.
Just pinging this thread—again, I think this blocks basically anyone using ANY of the AWS client libs from using them from a CDN like Skypack. I am happy to try to fix the issue and submit a PR myself if that is what will move the ball forward—but I am not an expert in this space. Please let me know how I can help.
@AllanZhengYP Really sorry to be a bother here, but since you closed the issue: what is the timeline for a release? Until the new version is released import
will still be broken.
@hausdorff even though this particular issue is fixed with aws-sdk-js-crypto-helpers@2.0.0
, unfortunately there's still a problem:
import { Sha256 } from "https://esm.sh/@aws-crypto/sha256-browser";
const hash = new Sha256();
causes exception:
error: Uncaught SyntaxError: The requested module 'https://esm.sh/@aws-crypto/sha256-browser' does not
provide an export named 'Sha256'
import { Sha256 } from "https://esm.sh/@aws-crypto/sha256-browser";
I'm testing with deno
and the same error happens with skypack urls too -- so the issue may lie with esbuild or somewhere else. Should we open a new issue with esbuild? Or with aws-sdk-js-crypto-helpers
? I'm honestly not sure at the moment..
@sjmueller Sha256
does not exist in v2 of @aws-crypto/sha256-browser
. So this works:
const { Ie11Sha256, WebCryptoSha256, default: sha256Browser } = await import("https://cdn.skypack.dev/-/@aws-crypto/sha256-browser@v2.0.0-hvSgq1UX0ymv6X1i0cjH/dist=es2020,mode=imports/optimized/@aws-crypto/sha256-browser.js");
Importing https://cdn.skypack.dev/-/@aws-crypto/sha256-browser@v1.2.2-0FkNV53JC2GVzKO3yG3r/dist=es2020,mode=imports/optimized/@aws-crypto/sha256-browser.js does not. The second line of this file is
import "/error/unknown:@aws-sdk/util-utf8-browser?from=@aws-crypto/sha256-browser";
I believe this problem would be solved if all AWS client libraries that use @aws-crypto/sha256-browser
were updated to V2 immediately.
@hausdorff @aws-sdk@3.39.0
was just released, which references @aws-crypto/sha256-browser@2.0.0
and from my tests, it's still broken: The requested module ... does not provide an export named 'Sha256'
@sjmueller Yes—because the new version of that library does not export a variable Sha256
. You can see in the code I provided that the exported variables are Ie11Sha256
, WebCryptoSha256
, and the default
. I am guessing Sha256
became WebCryptoSha256
but I don't really know what either do so that's a total shot in the dark.
In any case with 3.39.0 import("https://cdn.skypack.dev/@aws-sdk/client-ec2@3.39.0")
now works.
@hausdorff you are referencing the sha256-browser
lib after it's been run through a processor. If you look at the original source:
export * from "./crossPlatformSha256";
And then in crossPlatformSha256.ts:
export class Sha256 implements Hash { ... }
I may be misunderstanding es modules and import/export here, but the intention of this code structure should result in the package exporting the Sha256
class.
Furthermore, there are several places here on master
that are working with crypto@2.0.0
yet still expect Sha256
to be available -- here's one:
https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-kms/src/runtimeConfig.browser.ts#L4
This reinforces the case that the processor (i.e. esbuild
) is leaving out an export that should exist
I circled back around, and confirmed that skypack now works without error 👏👏👏:
https://cdn.skypack.dev/@aws-sdk/client-kms?dts
but esm.sh does not:
https://esm.sh/@aws-sdk/client-kms
I will open an issue with esm.sh
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.
Describe the bug
[Package Error] "@aws-sdk/util-utf8-browser" no dependency version info found. (Imported by "@aws-crypto/sha256-browser").
The package "@aws-crypto/sha256-browser" depends on "@aws-sdk/util-utf8-browser" as a dependency, but did not list any dependency version info in its package manifest. Without this information, the CDN is unable to properly resolve this import.
How to fix: Let the "@aws-crypto/sha256-browser" package author know that "@aws-sdk/util-utf8-browser" needs to be included in their package.json manifest
Your environment
SDK version number
@aws-sdk/client-kms@v3.33.0
Is the issue in the browser/Node.js/ReactNative?
Deno (via skypack.dev)
Details of the browser/Node.js/ReactNative version
deno v1.14.0
Steps to reproduce
Please share code or minimal repo, and steps to reproduce the behavior.