aws-sam-cli
aws-sam-cli copied to clipboard
Bug: invocation-type: Event is not supported. RequestResponse is only supported.
Description:
It seems like Event in boto3 invoke method doesn't work with SAM Local even when boto3 accept this parameter (https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda/client/invoke.html)
Steps to reproduce:
import boto3
import json
payload = {
}
lambda_client = boto3.client("lambda", endpoint_url="http://localhost:3001", region_name="eu-west-1")
lambda_function_name = "Lambda"
payload_json = json.dumps(payload)
response = lambda_client.invoke(
InvocationType="Event", # This Event fails
FunctionName=lambda_function_name,
Payload=payload_json
)
Observed result:
ClientError: An error occurred (NotImplemented) when calling the Invoke operation: invocation-type: Event is not supported. RequestResponse is only supported.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- Amazon Linux:
-
sam --version
: SAM CLI, version 1.113.0 - AWS region: eu-west-1
{
"version": "1.113.0",
"system": {
"python": "3.11.3",
"os": "Linux-4.14.320-243.544.amzn2.x86_64-x86_64-with-glibc2.26"
},
"additional_dependencies": {
"docker_engine": "20.10.23",
"aws_cdk": "Not available",
"terraform": "1.7.2"
},
"available_beta_feature_env_vars": [
"SAM_CLI_BETA_FEATURES",
"SAM_CLI_BETA_BUILD_PERFORMANCE",
"SAM_CLI_BETA_TERRAFORM_SUPPORT",
"SAM_CLI_BETA_RUST_CARGO_LAMBDA"
]
}
Thanks for opening this issue, just to understand the context here, are you running sam local start-lambda
and then passing the endpoint to your script here?
Yes, of course, It works perfectly with "RequestResponse" InvocationType parameter ;)
Thanks for letting us know, this is something that we guard against since async execution isn't something that is currently implemented. I can tag this issue to a feature request instead.
As an alternative, it's possible to use our sam sync --watch
command to deploy to AWS and update code live, similar to how one would use sam local start-lambda
. This could be a workaround for now.