fix(provider): handle bundled @aws-sdk/credential-providers module fmt#276
Closed
agustif wants to merge 1 commit intoLatitudes-Dev:integrationfrom
Closed
fix(provider): handle bundled @aws-sdk/credential-providers module fmt#276agustif wants to merge 1 commit intoLatitudes-Dev:integrationfrom
agustif wants to merge 1 commit intoLatitudes-Dev:integrationfrom
Conversation
…rmat Fixes issue where fromNodeProviderChain is not a function when @aws-sdk/credential-providers is bundled by BunProc.install(). The bundled module exports all functions via default export, not as named exports. Update import to handle both bundled (default export) and unbundled (named exports) formats. Also use bearer token as apiKey when available to avoid unnecessary credential provider import. Co-authored-by: opencode <opencode@opencode.ai>
Greptile found no issues!From now on, if a review finishes and we haven't found any issues, we will not post anything, but you can confirm that we reviewed your changes in the status check section. This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes issue where fromNodeProviderChain is not a function when @aws-sdk/credential-providers is bundled by BunProc.install().
The bundled module exports all functions via default export, not as named exports. Update import to handle both bundled (default export) and unbundled (named exports) formats.
Also use bearer token as apiKey when available to avoid unnecessary credential provider import.
Greptile Summary
Fixed runtime error where
fromNodeProviderChainwas not a function when@aws-sdk/credential-providersis bundled byBunProc.install(). The bundled module exports functions via default export, while unbundled modules use named exports.Key Changes:
mod.default?.fromNodeProviderChain) and unbundled (mod.fromNodeProviderChain) module formatsfromNodeProviderChaincannot be found in either format@aws-sdk/credential-providers@3.964.0inpackage.jsonThe fix aligns with the bundling behavior introduced in commit bb35723, where
BunProc.install()usesBun.buildwithpackages: "bundle"to create single-file bundles for compiled binary compatibility.Confidence Score: 5/5
Important Files Changed
@aws-sdk/credential-providersversion 3.964.0Sequence Diagram
sequenceDiagram participant Provider as Provider.list() participant BunProc as BunProc.install() participant Module as credential-providers participant AWS as AWS Bedrock alt Bearer Token Available Provider->>Provider: Check awsBearerToken Provider->>Provider: Set providerOptions with bearer token Provider->>AWS: Use bearer token else No Bearer Token Provider->>BunProc: install credential-providers BunProc->>BunProc: Bundle module with Bun.build BunProc-->>Provider: Return bundled file path Provider->>Module: import bundled module Module-->>Provider: Return module (bundled format) Provider->>Provider: Extract fromNodeProviderChain Note over Provider: Try mod.default?.fromNodeProviderChain<br/>then mod.fromNodeProviderChain alt Function found Provider->>Module: fromNodeProviderChain(options) Module-->>Provider: Return credential provider Provider->>Provider: Set providerOptions.credentialProvider Provider->>AWS: Use credential provider chain else Function not found Provider->>Provider: Throw error end end