Skip to content

feat: expose bundled AWS SDK version - #1715

Open
dills122 wants to merge 4 commits into
awslabs:mainfrom
dills122:codex/expose-aws-sdk-version
Open

feat: expose bundled AWS SDK version#1715
dills122 wants to merge 4 commits into
awslabs:mainfrom
dills122:codex/expose-aws-sdk-version

Conversation

@dills122

@dills122 dills122 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • expose the bundled AWS SDK version as process.versions["@aws-sdk"]
  • generate the value from the installed @aws-sdk/client-sts package during SDK bundling
  • set the property directly while llrt_process constructs process.versions
  • omit the property from NONE bundles and Cargo no-sdk builds
  • document the optional property and cover presence, absence, and build integration in tests

Why

LLRT does not bundle AWS SDK package metadata, so applications cannot reliably import a client package's package.json to determine the bundled SDK version. process.versions already reports LLRT and Node compatibility versions and provides a runtime-visible location for this metadata.

Closes #1446.

Implementation

The JavaScript build writes bundle/js/.aws-sdk-version only after a standard or full SDK bundle succeeds. A build script owned by llrt_process reads that marker and embeds it as LLRT_AWS_SDK_VERSION when compiling the process module. llrt_process::init then adds the value while constructing process.versions.

The existing no-sdk feature is forwarded through llrt_core and llrt_modules to llrt_process. This makes Cargo no-sdk authoritative even if a marker from an earlier SDK bundle remains present.

Review Feedback

  • moved AWS SDK version handling out of llrt_core embedded-runtime initialization
  • colocated version injection, process.versions construction, and tests in modules/llrt_process, as requested
  • read LLRT_AWS_SDK_VERSION directly while constructing process.versions
  • removed the fixed SDK-version assertion so future SDK upgrades do not require test changes
  • retained the SDK/no-SDK safeguards while changing ownership

Validation

  • cargo check --workspace
  • cargo test -p llrt_process — 3 passed, 0 failed
  • cargo test -p llrt_process --features no-sdk — 3 passed, 0 failed
  • cargo clippy -p llrt_process --tests -- -D warnings
  • focused LLRT process JavaScript suite — 43 passed, 0 failed
  • Prettier check for changed JavaScript and TypeScript files
  • git diff --check

Runtime proof:

Build case Generated marker Runtime result
SDK_BUNDLE_MODE=STD 3.1057.0 {"hasAwsSdk":true,"version":"3.1057.0"}
SDK_BUNDLE_MODE=NONE absent {"hasAwsSdk":false,"version":null}
STD marker + Cargo --features no-sdk 3.1057.0 {"hasAwsSdk":false,"version":null}

The workspace was restored to a normal STD build after the matrix, which reports process.versions["@aws-sdk"] === "3.1057.0".

@richarddavison richarddavison left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We could instead set here:

pub fn init(ctx: &Ctx<'_>) -> Result<()> {

@dills122
dills122 marked this pull request as ready for review August 12, 2026 02:34

@richarddavison richarddavison left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks! Just a minor suggestion and we're good to go!

Comment thread modules/llrt_process/src/lib.rs Outdated
Comment on lines +102 to +117
fn create_process_versions<'js>(
ctx: &Ctx<'js>,
aws_sdk_version: Option<&str>,
) -> Result<Object<'js>> {
let versions = Object::new(ctx.clone())?;
versions.set("llrt", VERSION)?;
// Node.js version - Set for compatibility with some Node.js packages (e.g. cls-hooked).
versions.set("node", "0.0.0")?;

if let Some(version) = aws_sdk_version {
versions.set("@aws-sdk", version)?;
}

Ok(versions)
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Instead of passing option_env!("LLRT_AWS_SDK_VERSION") we should just use it in here directly:

if let Some(version) = option_env!("LLRT_AWS_SDK_VERSION") {

Comment thread modules/llrt_process/src/lib.rs Outdated

assert_eq!(versions.get::<_, String>("llrt").unwrap(), VERSION);
assert_eq!(versions.get::<_, String>("node").unwrap(), "0.0.0");
assert_eq!(versions.get::<_, String>("@aws-sdk").unwrap(), "3.1057.0");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can the SDK version be specified dynamically? Otherwise, I think the tests will fail during future SDK version upgrades.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The version is actually injected to make the code testable. I think we can skip this test entirely and just check contains a value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Determining the AWS SDK version at runtime?

3 participants