Skip to content

feat(tools): AGENTCORE_GATEWAY_ID env override for local/CI testing (#419)#456

Merged
philmerrell merged 1 commit into
developfrom
fix/gateway-id-env-override
Jun 5, 2026
Merged

feat(tools): AGENTCORE_GATEWAY_ID env override for local/CI testing (#419)#456
philmerrell merged 1 commit into
developfrom
fix/gateway-id-env-override

Conversation

@philmerrell
Copy link
Copy Markdown
Contributor

Follow-up to #419. Adds a local/CI escape hatch so GatewayTargetService can resolve the gateway id without the SSM parameter.

Why

Testing the gateway create flow locally hits ParameterNotFound for /agentcore/gateway/id, because:

  • The backend's prefix readers (this service, fine_tuning, auth_providers) read PROJECT_PREFIX (injected in cloud from config.projectPrefix). The local .env sets AGENTCORE_PROJECT_PREFIX, which nothing reads → the prefix falls back to "agentcore", so the lookup path is wrong locally.
  • And the /{prefix}/gateway/id parameter only exists once feat(infra): gateway id SSM param + app-api Gateway target IAM grants (#419, PR3/5) #452's infra is deployed.

The create-AWS-first lifecycle then correctly 502s (it won't save the catalog row without a gateway id) — working as designed, just unusable locally.

What

  • _resolve_gateway_id resolution order: explicit gateway_idAGENTCORE_GATEWAY_ID env → SSM /{PROJECT_PREFIX}/gateway/id.
  • The ParameterNotFound error message now names both likely causes + the override.

Set AGENTCORE_GATEWAY_ID to the deployed stack's GatewayId output (or from aws bedrock-agentcore-control list-gateways) to test locally. Caveat: the override only supplies the id — CreateGatewayTarget still calls real AWS, so local testing also needs creds for a real gateway with the GatewayTarget IAM permissions.

Testing

+1 test (env override skips SSM); test_gateway_target_service.py 19/19 green.

🤖 Generated with Claude Code

…ion (#419)

Local/CI escape hatch for GatewayTargetService. Resolution order is now:
explicit gateway_id (constructor) → AGENTCORE_GATEWAY_ID env → SSM
/{PROJECT_PREFIX}/gateway/id. The SSM path remains the cloud default, but the
env override lets local dev test the create flow without the SSM parameter
(which may be absent, or behind a different PROJECT_PREFIX — e.g. local .env
sets AGENTCORE_PROJECT_PREFIX, which the prefix readers don't consume, so the
prefix falls back to "agentcore").

The ParameterNotFound RuntimeError message now points at both likely causes
(construct not deployed / wrong PROJECT_PREFIX) and the override.

Note: the override only supplies the id — the create call still hits real AWS,
so local testing also needs creds for a real gateway with the GatewayTarget
permissions. +1 test (19 total green).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@philmerrell philmerrell merged commit f8a600f into develop Jun 5, 2026
1 check passed
@philmerrell philmerrell deleted the fix/gateway-id-env-override branch June 5, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant