fix: grant CreateTokenVault and wire OAuth providers table to app-api#179
Merged
philmerrell merged 1 commit intodevelopfrom Apr 27, 2026
Merged
Conversation
The first CreateOauth2CredentialProvider call in a region implicitly provisions the `default` token vault, so the AppApi task role needs `bedrock-agentcore:CreateTokenVault` in addition to the provider CRUD actions. Without it, creating the very first connector returned a 500 with `AccessDeniedException` from bedrock-agentcore-control. Also pass `DYNAMODB_OAUTH_PROVIDERS_TABLE_NAME` to the container env. The IAM grant and SSM lookup were already in place; only the env wiring was missing, which caused the OAuth provider repository to silently disable itself and would have failed the DB write after AgentCore succeeded — triggering the orphan-rollback path. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
bedrock-agentcore:CreateTokenVaultto the AppApi task role. The firstCreateOauth2CredentialProvidercall in a region implicitly provisions thedefaulttoken vault, so without this action the very first connector creation returns 500 withAccessDeniedException. Once the vault exists, subsequent calls would have succeeded — but the dev environment hit this on the first attempt.DYNAMODB_OAUTH_PROVIDERS_TABLE_NAMEinto the AppApi container env. The IAM grant (line 883) and SSM lookup (line 220) were already there from feat: external MCP connectors via AgentCore Identity #174; only the env passthrough was missing. Without it,OAuthProviderRepositorylogsWARNING: ... repository is disabledat startup and the post-AgentCore DB write increate_provider()would fail, triggering the orphan-rollback path.Context
Found while debugging a 500 on
POST /admin/oauth-providers/in the dev-ai account. CloudWatch (/ecs/dev-boisestateai-v2/app-api) showed:Test plan
cd infrastructure && npm install(localnode_modulesis onaws-cdk-lib@2.220.0but pinned to2.248.0; pre-existing, blockscdk synthuntil synced)npx cdk diff dev-boisestateai-v2-AppApiStack --profile dev-ai— confirm only the IAM policy and env var changenpx cdk deploy dev-boisestateai-v2-AppApiStack --profile dev-aiPOST /admin/oauth-providers/from the admin UI — expect 201 and a row in the OAuth providers DynamoDB tableDYNAMODB_OAUTH_PROVIDERS_TABLE_NAME not setwarning is gone on next task start🤖 Generated with Claude Code