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

Micronaut function support for AWS API Gateway #540

Closed
drissamri opened this issue Aug 28, 2018 · 12 comments
Closed

Micronaut function support for AWS API Gateway #540

drissamri opened this issue Aug 28, 2018 · 12 comments
Assignees
Labels
type: enhancement New feature or request
Milestone

Comments

@drissamri
Copy link

Expected Behaviour

Out of the box support for AWS Lambda that are used with an AWS API Gateway in front of it.
This seems like a common use case, which would be nice if this could be supported without having to provide custom code for it.

Maybe several handlers could be provided, like this is done in Spring?
https://github.com/spring-cloud/spring-cloud-function/blob/master/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/src/main/java/org/springframework/cloud/function/adapter/aws/SpringBootApiGatewayRequestHandler.java

Actual Behaviour

No out of the box support

@sdelamo
Copy link
Contributor

sdelamo commented Aug 31, 2018

I've added a section (API AWS Gateway) to the Functions AWS Lambda Guide

http://guides.micronaut.io/micronaut-function-aws-lambda/guide/index.html#awsApiGateway

@drissamri
Copy link
Author

drissamri commented Sep 5, 2018

thanks @sdelamo, but usually AWS API Gateway in combination with AWS Lambda is used with Proxy Integration AFAIK (mentioned in the AWS docs), in which it transforms the input and output.

Reference:
The Lambda custom integration, formerly known as the Lambda integration, is a legacy technology. We recommend that you use the Lambda proxy integration for any new API. For more information, see Build an API Gateway API with Lambda Proxy Integration

This is why Spring for example has a specific ApiGatewayRequestHandler which does the necessary mapping (and perhaps more). Something like this would most likely be preferable out of the box for Micronaut as well?

@musketyr
Copy link
Contributor

musketyr commented Oct 1, 2018

@drissamri you may find this library useful https://github.com/agorapulse/micronaut-libraries we faced the same issues

@fellmann
Copy link

+1 for this. Easy integration with API Gateway would be great, similar to https://github.com/awslabs/aws-serverless-java-container/tree/master/aws-serverless-java-container-spark for Spark.

@djeverson
Copy link

+1. This should be treated as a first-class citizen with Micronaut. We've been struggling with a complete POC of Micronaut on AWS Lambda.

@graemerocher graemerocher added the type: enhancement New feature or request label Dec 10, 2018
@graemerocher graemerocher added this to the 1.1.0 milestone Dec 10, 2018
@graemerocher
Copy link
Contributor

@graemerocher graemerocher self-assigned this Jan 31, 2019
@graemerocher
Copy link
Contributor

graemerocher added a commit that referenced this issue Jan 31, 2019
@drissamri
Copy link
Author

@graemerocher this seems to work with the generated API Gateway URL (e.g: https://fiyxdrgglb.execute-api.eu-west-1.amazonaws.com/dev/label) but doesn't seem to work with a custom domain.

The lambda is invoked but gives back a HTTP 404, should this be logged as a bug or is there something else that needs to be configured? It seems like there was a related bug in the past: aws/serverless-java-container#112

01:23:47 START RequestId: ea035c1f-f0c8-4be3-8a3b-4bcc5c0b9f50 Version: $LATEST
01:23:47 END RequestId: ea035c1f-f0c8-4be3-8a3b-4bcc5c0b9f50
01:23:47 REPORT RequestId: ea035c1f-f0c8-4be3-8a3b-4bcc5c0b9f50	Duration: 8.56 ms	Billed Duration: 100 ms Memory Size: 1024 MB	Max Memory Used: 148 MB

@musketyr
Copy link
Contributor

musketyr commented Mar 5, 2019

@graemerocher I dealt with a similar issue. with a custom name, you get everything into the path including stage context. feel free to use my solution

https://github.com/agorapulse/micronaut-libraries/blob/master/micronaut-function-aws-agp/src/main/groovy/com/agorapulse/micronaut/agp/ApiGatewayProxyHttpRequest.java#L203-L212

@djeverson
Copy link

support of custom domain is a requirement for us. This item should be re-opened to address.

@drissamri
Copy link
Author

I have created a new issue since this does seem to be a bug. If I can help out in any way with testing this since I have a domain setup in AWS, feel free to ping me.

@graemerocher
Copy link
Contributor

PRs are welcome. Otherwise will look into it next week. Thanks

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
None yet
Development

No branches or pull requests

6 participants