Skip to content

[BUG] create_mcp_gateway_target not actually using IAM_ROLE credential provider for lambda when target_payload provide #56

@zhiyanliu

Description

@zhiyanliu

Describe the bug
For lambda target, when the target_payload param given, the credential provider config is not provided for create_gateway_target API. Similar like #34.

To Reproduce
Steps to reproduce the behavior:

  1. Follow the steps at the official doc at https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway-quick-start.html#gateway-quick-start-create
  2. Call create_mcp_gateway_target with the target_payload for the lambda case.
  3. Run the code with the necessary packages.

Expected behavior
The gateway and the lambda type target should be created successfully.

Error Output

Traceback (most recent call last):
  File "/home/ubuntu/aws-agentcore/gw.py", line 61, in <module>
    lambda_target = client.create_mcp_gateway_target(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/aws-agentcore/.venv/lib/python3.12/site-packages/bedrock_agentcore_starter_toolkit/operations/gateway/client.py", line 162, in create_mcp_gateway_target
    target = self.client.create_gateway_target(**create_request)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/aws-agentcore/.venv/lib/python3.12/site-packages/botocore/client.py", line 601, in _api_call
    return self._make_api_call(operation_name, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/aws-agentcore/.venv/lib/python3.12/site-packages/botocore/context.py", line 123, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/aws-agentcore/.venv/lib/python3.12/site-packages/botocore/client.py", line 1031, in _make_api_call
    request_dict = self._convert_to_request_dict(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/aws-agentcore/.venv/lib/python3.12/site-packages/botocore/client.py", line 1098, in _convert_to_request_dict
    request_dict = self._serializer.serialize_to_request(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/aws-agentcore/.venv/lib/python3.12/site-packages/botocore/validate.py", line 381, in serialize_to_request
    raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Missing required parameter in input: "credentialProviderConfigurations"

Environment:

  • OS: Ubuntu 24.04
  • Python version: 3.12
  • Package version:
    "bedrock-agentcore>=0.1.0",
    "bedrock-agentcore-starter-toolkit>=0.1.0",
    "strands-agents>=1.0.1",
    "strands-agents-tools>=0.2.1",
  • Installation method: uv/pip

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggatewayRelated to agentcore gateway

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions