Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: invocation-type: Event is not supported. RequestResponse is only supported. #6900

Open
ijtarano opened this issue Apr 3, 2024 · 3 comments
Labels
area/local/start-lambda sam local start-lambda command type/feature Feature request

Comments

@ijtarano
Copy link

ijtarano commented Apr 3, 2024

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)

  1. Amazon Linux:
  2. sam --version: SAM CLI, version 1.113.0
  3. 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"
  ]
}
@ijtarano ijtarano added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Apr 3, 2024
@lucashuy
Copy link
Contributor

lucashuy commented Apr 3, 2024

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?

@lucashuy lucashuy added area/local/start-lambda sam local start-lambda command stage/bug-repro The issue/bug needs to be reproduced and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Apr 3, 2024
@ijtarano
Copy link
Author

ijtarano commented Apr 4, 2024

Yes, of course, It works perfectly with "RequestResponse" InvocationType parameter ;)

@lucashuy
Copy link
Contributor

lucashuy commented Apr 5, 2024

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.

@lucashuy lucashuy added type/feature Feature request and removed stage/bug-repro The issue/bug needs to be reproduced labels Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/local/start-lambda sam local start-lambda command type/feature Feature request
Projects
None yet
Development

No branches or pull requests

2 participants