awslabs / awslabs/agentcore-samples

06-workshops - [Bug] 02-AgentCore-gateway - 07-bearer-token-injection missing resource

Open
#1,547 0 comments 0 reactions 1 assignee Claimed by @akshseh View on GitHub
06-workshops bug
Dominant language
Python
Stars
3.4k
Forks
1.3k
Avg merge
1d 22h
Merged PRs (30d)
30

Description

**In which component is this bug present?**

- [ ] 01-AgentCore-runtime
- [X] 02-AgentCore-gateway
- [ ] 03-AgentCore-identity
- [ ] 04-AgentCore-memory
- [ ] 05-AgentCore-tools
- [ ] 06-AgentCore-observability
- [ ] 07-AgentCore-E2E

If you are reporting multiple bugs, please create a separate issue for each. For documentation improvements, use the documentation improvement issue type.

**Bug Description**
A clear and concise description of the bug.

Running the workflow 07-bearer-token-injection.
When running step 3 to create the gateway target, I encounter an error with a missing resource:
```
---------------------------------------------------------------------------
ResourceNotFoundException Traceback (most recent call last)
Cell In[7], line 5
1 from agentcore_gateway_creation import add_gateway_target
2
3 # Step 2: Add Gateway Target
4 print("🎯 Adding Gateway Target...")
----> 5 add_gateway_target(gateway["id"])
6 print("✅ Gateway target configuration completed!")

File ~/Repos/agentcore-samples/06-workshops/02-AgentCore-gateway/07-bearer-token-injection/prerequisites/agentcore-components/agentcore_gateway_creation.py:198, in add_gateway_target(gateway_id)
194 acps = boto3.client(service_name="bedrock-agentcore-control")
196 credential_provider_name = "AgentCoreAPIGatewayAPIKey"
--> 198 existing_credential_provider_response = acps.get_api_key_credential_provider(
199 name=credential_provider_name
200 )
201 provider_arn = existing_credential_provider_response["credentialProviderArn"]
202 print(f"Found existing credential provider with ARN: {provider_arn}")

File ~/Repos/forma_314/lib/python3.14/site-packages/botocore/client.py:606, in ClientCreator._create_api_method.._api_call(self, *args, **kwargs)
602 raise TypeError(
603 f"{py_operation_name}() only accepts keyword arguments."
604 )
605 # The "self" in this scope is referring to the BaseClient.
--> 606 return self._make_api_call(operation_name, kwargs)

File ~/Repos/forma_314/lib/python3.14/site-packages/botocore/context.py:123, in with_current_context..decorator..wrapper(*args, **kwargs)
121 if hook:
122 hook()
--> 123 return func(*args, **kwargs)

File ~/Repos/forma_314/lib/python3.14/site-packages/botocore/client.py:1094, in BaseClient._make_api_call(self, operation_name, api_params)
1090 error_code = request_context.get(
1091 'error_code_override'
1092 ) or error_info.get("Code")
1093 error_class = self.exceptions.from_code(error_code)
-> 1094 raise error_class(parsed_response, operation_name)
1095 else:
1096 return parsed_response

ResourceNotFoundException: An error occurred (ResourceNotFoundException) when calling the GetApiKeyCredentialProvider operation: ApiKeyCredentialProvider not found for AgentCoreAPIGatewayAPIKey
```

**Screenshots**
If applicable, add screenshots to help explain your problem.
```
Please provide screenshots here.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.