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

API Gateway Proxy Integration payload format 2.0 incompatible #1317

Closed
forresthopkinsa opened this issue Mar 25, 2022 · 9 comments
Closed

API Gateway Proxy Integration payload format 2.0 incompatible #1317

forresthopkinsa opened this issue Mar 25, 2022 · 9 comments
Assignees
Labels
type: enhancement New feature or request

Comments

@forresthopkinsa
Copy link
Contributor

Expected Behavior

API Gateway HTTP API using proxy integration with a Lambda running Micronaut should work by default

Actual Behaviour

Micronaut silently fails to parse parameters from the default Proxy Integration payload format (2.0) and so every request is read as a GET / (and it is very, very difficult to troubleshoot)

Steps To Reproduce

  1. Create a Micronaut Application from Micronaut Launch using all defaults, with the 'aws-lambda' feature
  2. Deploy jar to a Corretto 11 Lambda
  3. Set Lambda handler to io.micronaut.function.aws.proxy.MicronautLambdaHandler
  4. Create an HTTP API in APIGW
  5. Hook up an ANY /{proxy+} route to the Micronaut lambda
  6. Try to POST the APIGW default endpoint with a valid body for BookController.save
  7. Server responds:
{
  "message": "Method Not Allowed",
  "_links": {
    "self": {
      "href": "https://myapigw.execute-api.us-east-2.amazonaws.comnull",
      "templated": false
    }
  },
  "_embedded": {
    "errors": [
      {
        "message": "Method [GET] not allowed for URI [https://myapigw.execute-api.us-east-2.amazonaws.comnull]. Allowed methods: [POST]"
      }
    ]
  }
}

Environment Information

micronaut-cli.yml

applicationType: default
defaultPackage: com.example
testFramework: junit
sourceLanguage: java
buildTool: gradle
features: [annotation-api, app-name, aws-lambda, gradle, jackson-databind, java, java-application, junit, logback, micronaut-build, readme, shade, yaml]

Example Application

No response

Version

3.4.0

@forresthopkinsa
Copy link
Contributor Author

Gitter thread

@forresthopkinsa
Copy link
Contributor Author

forresthopkinsa commented Mar 26, 2022

Related: #321, #1054

@msailes
Copy link
Contributor

msailes commented Mar 26, 2022

While working on this, you might want to consider if you want to add support for Application Load Balancers. The request / response format is very similar.

@nanodeath
Copy link

This is also a blocker for using lambda function URLs, which only support Payload format version 2.0.

@yurikilian
Copy link

yurikilian commented Nov 30, 2022

While working on this, you might want to consider if you want to add support for Application Load Balancers. The request / response format is very similar.

Guys, any plans to support ALB payload on this issue? If not lets open a new one to separated conrtibuition.

@driverpt
Copy link
Contributor

driverpt commented Jan 5, 2023

@sdelamo @alvarosanchez @msailes , any ETA on this one?

@sdelamo
Copy link
Contributor

sdelamo commented Jan 7, 2023

Currently, micronaut-function-aws-api-proxy supports only Payload format version 1.0.

if you select aws-cdk, amazon-api-gateway, aws-lambda, we setup the gateway to use payload 1.0.

HttpLambdaIntegration integration = HttpLambdaIntegration.Builder.create("HttpLambdaIntegration", function)
    .payloadFormatVersion(VERSION_1_0)
 .build();
HttpApi api = HttpApi.Builder.create(this, "micronaut-function-api")
    .defaultIntegration(integration)
    .build();

@sdelamo sdelamo added the type: enhancement New feature or request label Jan 7, 2023
@driverpt
Copy link
Contributor

@sdelamo , we require ALB Lambda Integration. Do you have any guidance on how to implement this? I would like to give it a shot.

@sdelamo
Copy link
Contributor

sdelamo commented Jun 14, 2023

Micronaut Framework 4.0 supports v1, v2 and ALB events.

@sdelamo sdelamo self-assigned this Jun 14, 2023
@sdelamo sdelamo closed this as completed Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
No open projects
Status: Done
Status: Done
Development

No branches or pull requests

6 participants