run golang gin api project using aws lambda

Viewed 502

I am tring to run my go project using amazon lambda, this is my current main.go

https://gist.github.com/krakiun/61e4e4dc5ab91f557e481f0230ed3ba0

I tried several methods, but none worked How i can make run this project in lambda, in this moment if i run using router.Run(cfg.HTTP.ListenAddr) is working without any error,

with this log.Fatal(gateway.ListenAndServe(cfg.HTTP.ListenAddr, router)) is die with this error :

expected AWS Lambda environment variables [_LAMBDA_SERVER_PORT AWS_LAMBDA_RUNTIME_API] are not defined
exit status 1

How i can fix my code to run in aws lambda ?

1 Answers
Related