awslabs / llrt

LLRT (Low Latency Runtime) is an experimental, lightweight JavaScript runtime designed to address the growing demand for fast and efficient Serverless applications.
Apache License 2.0
8.02k stars 352 forks source link

How do we use a non-included AWS SDK? #591

Closed ainsleyrutterford closed 1 day ago

ainsleyrutterford commented 2 days ago

According to the README:

For an example on how to use a non-included SDK, see this example build script (buildExternalSdkFunction)

I don't understand what's being done in the example that enables the use of a non-included SDK. The only difference I can see from the standard ESBuild command provided in the README:

esbuild index.js --platform=node --target=es2023 --format=esm --bundle --minify --external:@aws-sdk --external:@smithy

is that there are more values provided in the external argument:

external: [
  "@smithy",
  "@aws-sdk/core",
  "@aws-sdk/util-user-agent-browser",
  "@aws-crypto",
  "bowser",
],

I must be missing something! Why would the non-included SDK (@aws-sdk/client-ec2 in the example provided) now be part of the ESBuild bundle?

Thanks!

ainsleyrutterford commented 2 days ago

Ohhh, is it because @aws-sdk/core is in external rather than @aws-sdk? I didn't spot that difference! If that is the reason, maybe the README should state that explicitly or a comment could be added to the example?

richarddavison commented 1 day ago

Ohhh, is it because @aws-sdk/core is in external rather than @aws-sdk? I didn't spot that difference! If that is the reason, maybe the README should state that explicitly or a comment could be added to the example?

Yes that's exactly it! Thanks for your suggestion, this should probably documented better!