project build fails before first deploy when a gateway target references a project credential
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 62/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- aws, typescript
- Domain
- authentication, build-system, cli, cloud
Research direction
Start with the agentcore project build entry point and the generated CDK application's credential resolution, then compare it with the deploy path that provisions credentials first. Add the requested regression test for a fresh project with an OAuth credential and MCP gateway target, and verify that build or synthesis succeeds before deployment.
Written by the indexing model from the issue text.
Description
Summary
agentcore project build cannot synthesize a new project when a gateway target references an OAuth credential declared in the same project before the first deployment.
agentcore project deploy works around this by provisioning credentials before it builds, but the standalone build command does not. This makes an otherwise valid project impossible to build in CI or inspect with CDK synthesis before its first deploy.
Reproduction
In a new project, add a gateway and then run:
printf '%s' "$CLIENT_SECRET" | agentcore project add credentials oauth \
--name MyOauthCredential \
--vendor CustomOauth2 \
--client-id my-client \
--discovery-url https://auth.example.com/.well-known/openid-configuration \
--client-secret -
agentcore project add gateway-target \
--gateway MyGateway \
--name MyMCPTarget \
--endpoint https://my-mcp-server.example.com \
--outbound-auth oauth \
--credential-name MyOauthCredential
agentcore project build
Actual behavior
CDK synthesis fails:
AgentCore CDK synthesis failed: Credential "MyOauthCredential" not found in deployed state
The generated CDK application resolves the target's credential reference only from .cli/deployed-state.json. That state cannot contain the credential before the first deployment.
The deploy path provisions credentials before calling build, so agentcore project deploy does not expose the same failure.
Expected behavior
A project whose resources reference other resources declared in the same project should synthesize before its first deployment. project build should not require deployed state for an in-project credential reference.
Suggested direction
Represent credential references symbolically during synthesis, or make the generated CDK application resolve credentials declared in the project without requiring deployed state. If this cannot be supported, project build should produce a targeted error and the project workflow should explicitly model the required credential provisioning phase.
Please add a regression test for a fresh project containing an OAuth credential and an MCP gateway target that references it.
- Dominant language
- TypeScript
- Stars
- 339
- Forks
- 129
- Avg merge
- 19h 21m
- Merged PRs (30d)
- 125
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aws/agentcore-cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
aws/agentcore-cli#2940 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
aws/agentcore-cli#2939 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
aws/agentcore-cli#2938 ·
Maintainers usually reply within 1 day
-
invoke: CUSTOM_JWT runtime errors discard the response body and error type (e.g. "Token has expired")Possibly taken @n1dhruv claimed this 6 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
aws/agentcore-cli#2875 · 1 comment ·
Maintainers usually reply within 1 day
-
--debug has no effect; service error name, HTTP status and request ID never reach the terminalPossibly taken @abhiramshaji-cyber claimed this 3 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
aws/agentcore-cli#2874 ·
Maintainers usually reply within 1 day
All issues in aws/agentcore-cli
Similar issues
-
triage
Difficulty 1/5 Under an hour Newbie friendliness 64/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
ranxianglei/billion-context#7860 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
agent-oc-find-bugs api complexity → simple payment-methods recurring contributions reviewed stripe
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
opencollective/opencollective#9177 ·