fix(provider): handle bundled @aws-sdk/credential-providers module format#277
Closed
agustif wants to merge 1 commit intoLatitudes-Dev:devfrom
Closed
fix(provider): handle bundled @aws-sdk/credential-providers module format#277agustif wants to merge 1 commit intoLatitudes-Dev:devfrom
agustif wants to merge 1 commit intoLatitudes-Dev:devfrom
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>
Collaborator
|
Thanks for the contribution! We appreciate you taking the time to identify and fix this issue. However, we've already addressed this in our fork. Our implementation at const fromNodeProviderChain =
awsSdkModule.fromNodeProviderChain ??
awsSdkModule.default?.fromNodeProviderChain ??
awsSdkModule.default?.default?.fromNodeProviderChainClosing as this is already resolved on our end, but thank you for the report! — shuvbot |
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 uses named exports.Key Changes:
mod.default?.fromNodeProviderChain ?? mod.fromNodeProviderChainfromNodeProviderChainis not found in either formatapiKeywhen available, avoiding unnecessary credential provider import@aws-sdk/credential-providers@3.964.0as direct dependency to ensure version compatibilityConfidence Score: 5/5
Important Files Changed
@aws-sdk/credential-providers3.964.0 as a direct dependency to support credential provider functionalitySequence Diagram
sequenceDiagram participant App as Amazon Bedrock Loader participant Config as Config/Env participant BunProc as BunProc.install() participant Module as @aws-sdk/credential-providers participant Provider as AmazonBedrockProvider App->>Config: Check AWS_BEARER_TOKEN_BEDROCK alt Bearer token available Config-->>App: Return bearer token App->>Provider: Create provider with apiKey Note over App,Provider: Skip credential provider import else No bearer token App->>BunProc: Install @aws-sdk/credential-providers BunProc-->>App: Return module path App->>Module: Import module alt Bundled module (default export) Module-->>App: mod.default.fromNodeProviderChain else Unbundled module (named export) Module-->>App: mod.fromNodeProviderChain end App->>App: Verify fromNodeProviderChain exists App->>Provider: Create provider with credentialProvider end Provider-->>App: Configured provider