Questions tagged [aws-lambda-go]

21 questions
38
votes
2 answers

exec format error when running AWS Golang Lambda

I have a go application, structured like this: cmd|reports|main.go main.go imports internal/reports package and has a single function, main(), which delegates call to aws-lambda-go/lambda.Start() function. Code is build running the commands…
Ivan
  • 867
  • 1
  • 8
  • 15
11
votes
1 answer

AWS Lambda Go function not getting request body when called via API GW

First off, one might say this question is very similar to HTTP request body not getting to AWS lambda function via AWS API Gateway or Getting json body in aws Lambda via API gateway However, none of these questions address using Golang, and the…
Bimde
  • 722
  • 8
  • 20
5
votes
1 answer

Mock context.Context to test lambdacontext.FromContext

I'm building an aws lambda using aws-sdk-go and aws-lambda-go and I'm stuck with a little problem. I want to test my lambda handler. To do so, I need to mock a valid context.Context containing valid attributes for lamdacontext.LambdaContext and…
AndreaM16
  • 3,917
  • 4
  • 35
  • 74
4
votes
1 answer

func init() vs func main() for initalizing global state in AWS Lambda handlers

Looking at the Using global state section in the official AWS Lambda function handler in Go doc https://docs.aws.amazon.com/lambda/latest/dg/golang-handler.html suggests to initialise all global state in func init() i.e. Any package level vars which…
3
votes
1 answer

AWS Lambda Go: The VM errors out in mounting the folder, /var/task/main no such file or directory. How to resolve?

I created a "hellogo" lambda, and tried to run it locally using sam package sam deploy sam local start-api accessing : http://localhost:3000/hellogo The docker has the hellogo folder shared in preferences. While accessing I see the below error from…
Espresso
  • 5,378
  • 4
  • 35
  • 66
2
votes
0 answers

Is there a way to read session tags from within an AWS lambda?

I have an AWS lambda written in Go which is invoked using: aws lambda invoke … I am setting session (sts) tags before invoking the lambda. Is there a way from within the lambda to get the session of the caller and read the tags which were set?
dolan
  • 1,716
  • 11
  • 22
2
votes
1 answer

How do I get the URL parameters with AWS lambda functions?

I am using Netlify functions for an API, most of which is working perfectly fine, apart from when I am needing to access URL parameters Here is a snippet of what I have to get the parameter: func Handler(ctx context.Context, request…
Liam Clarke
  • 243
  • 4
  • 13
2
votes
1 answer

Unable to invoke lambda function from localstack via aws cli

I have the lambda function pushed as I can see it in localstack, based on below command/output aws lambda get-function --function-name books1 --endpoint-url=http://localhost:4574 { "Code": { "Location":…
1
vote
1 answer

Terraform resource AWS LAMBDA GO Error : "fork/exec /var/task/main: no such file or directory"

I have a go script and I am making Terraform resource aws_lambda_function with runtime configurations as such : handler = "main" memory_size = 512 timeout = 360 runtime = "go1.x" In my go code, I have imported the modules…
1
vote
1 answer

How to allow anonymous access to images compressed by Lambda

I am using the AWS Lambda function named 'compress' by 'evanchiu' I have set the source folder and destination folder. Both folders have 'Objects can be public' permission. I am uploading images to the source folder, which is an S3 bucket with…
Chakra
  • 2,525
  • 8
  • 43
  • 82
1
vote
0 answers

Invoke python application from lambda written in go

I'm developing an aws based application entirely in golang though I have a piece of python code I need to invoke in a lambda function as a separate subprocess. The python code is written as a CLI application and it's hard to make a lambda out of…
CaptainRR
  • 421
  • 5
  • 17
0
votes
1 answer

Trivial GO lambda in IMAGE fails with /bin/sh: ./lambda-handler: Permission denied

I am using the aws provided docker file to build a SAM template. The sam build and deploy works as expected, however when calling the endpoint I get Internal Server Error with /bin/sh: ./lambda-handler: Permission denied The file is referencing is…
0
votes
1 answer

Go lambda S3 file upload results in new object with size of 0

I'm writing my first golang api with aws lambda. The idea being to be able to record audio from a browser and save as an object in s3. I've gotten to the point of being able to save an object in the desired location in the s3 bucket, but the file…
0
votes
2 answers

AWS Lambda GO PathError (Windows 10)

I've done the following in PowerShell in VSCode: PS D:\Project Resume> set GOOS=linux PS D:\Project Resume> set GOARCH=amd64 PS D:\Project Resume> set CGO_ENABLED=0 PS D:\Project Resume> cd .\dist\events\ PS D:\Project Resume\dist\events> go build…
Kieran Ojakangas
  • 495
  • 4
  • 18
0
votes
1 answer

AWS Go Lambda: If/else Issue

I'm just trying to pick up Golang in the AWS Lambda flavor. I feel like the answer here is super simple, but I can't put my finger on it, nor could I find a post similar to this problem just yet. //Lambda Function Go Code package main import…
Kieran Ojakangas
  • 495
  • 4
  • 18
1
2