awslabs / aws-lambda-go-api-proxy

lambda-go-api-proxy makes it easy to port APIs written with Go frameworks such as Gin (https://gin-gonic.github.io/gin/ ) to AWS Lambda and Amazon API Gateway.
Apache License 2.0
1.09k stars 200 forks source link

fix(fiber): Fix fiber returning 500 internal server error #181

Closed marvin-w closed 1 year ago

marvin-w commented 1 year ago

Fixes #175 Fixes #162

Description of changes:

https://github.com/awslabs/aws-lambda-go-api-proxy/commit/fde59295b7aa31f7d8f65997da1a94bad8f69303 caused a regression in the fiber adapter logic as we previously would try to get the source IP from nil, which internally would just return an empty string.

Since above commit, the RemoteAddr is not nil anymore, but is lacking the required port that is needed in order to parse it as a *TCPAddr

This commit makes sure the port section is always added if it does not exist. Furthermore, it adds a test that prevents this from happening again and we now have logging in place.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

=> I do.