bugfix: don't cache empty inference-profile sets in AWSBedrock#6373
Open
Ankit5467 wants to merge 2 commits into
Open
bugfix: don't cache empty inference-profile sets in AWSBedrock#6373Ankit5467 wants to merge 2 commits into
Ankit5467 wants to merge 2 commits into
Conversation
discoverInferenceProfiles() previously cached an empty Set on both failure and empty success, for the process lifetime. If the first call for a region happened before AWS credentials were available (e.g. server startup race), every subsequent call for that region short-circuited to the cached empty Set. resolveBedrockModel() then skipped auto-applying a cross-region inference profile, and Bedrock rejected the bare model ID with "This model requires a cross-region inference profile." Only cache non-empty results, and log discovery failures instead of silently swallowing them so operators can diagnose credential or permission issues.
Contributor
There was a problem hiding this comment.
Code Review
This pull request modifies the AWS Bedrock utility to prevent caching results when the inference profile discovery fails and adds error logging. The reviewer suggests that successful but empty responses should still be cached to avoid redundant API calls and potential rate limiting, noting that the updated error handling already prevents the cache from being populated with invalid data during failures.
HenryHengZJ
approved these changes
May 12, 2026
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.
Summary
Fixes a process-lifetime cache poisoning bug in the AWS Bedrock chat model node.
discoverInferenceProfiles()inpackages/components/nodes/chatmodels/AWSBedrock/utils.tspreviously cached an emptySet<string>on both thrown errors and empty successful responses. Once poisoned, every subsequent call for that region in the same process would short-circuit and return the empty set.resolveBedrockModel()then skipped auto-applying a cross-region inference profile, Flowise rejected the bare model ID with:This reproduces when the first Bedrock invocation for a region happens before AWS credentials are available in the Node process — e.g. a server startup race where
AWS_PROFILE/ SSO creds refresh after Flowise starts. TheListInferenceProfilescall throws, the barecatchswallows it, an empty set is cached, and the region never recovers until the server is restarted.Fix
ListInferenceProfilesreturns at least one profile.console.errorso operators can diagnose credential or permission issues instead of seeing a silent failure that manifests only later as a confusing Bedrock validation error.Test plan
us-east-1withanthropic.claude-sonnet-4-6: before the fix, the AgentFlow Agent node failed with the "requires inference profile" error on every invocation until server restart; after the fix, discovery succeeds andus.anthropic.claude-sonnet-4-6is auto-applied.aws bedrock list-inference-profiles --region us-east-1 --type-equals SYSTEM_DEFINEDconfirms theus.anthropic.claude-sonnet-4-6profile is active on the account under test.