serverless-localstack icon indicating copy to clipboard operation
serverless-localstack copied to clipboard

Golang function triggers "no such file or directory" when mountCode -> True

Open kmai opened this issue 4 years ago • 2 comments
trafficstars

I'm trying to invoke a function locally using localstack and a Golang binary as a handler.

If I mount the directory (mountCode: True), I get the following message when doing the invoke:

# serverless invoke --function hello -p event.json
Serverless: Using serverless-localstack
{
    "errorMessage": "RequestId: b669e3f0-8ff3-1b84-748d-066ac5b8578e Error: fork/exec /var/task/bin/adaptor-k8s: no such file or directory",
    "errorType": "exitError"
}

If I set mountCode: False, the function works without issues.

kmai avatar Jan 26 '21 12:01 kmai

Thanks for reporting @kmai . Can you please share some details about your LocalStack configuration? Please note that Lambda code mounting requires the LAMBDA_REMOTE_DOCKER and HOST_TMP_FOLDER environment variables to be configured properly - see here: https://github.com/localstack/localstack#using-local-code-with-lambda Please keep us posted how it goes, thanks!

whummer avatar Feb 20 '21 19:02 whummer

Could this be related to https://github.com/localstack/localstack/issues/6181, where the mount overrides files within the container?

ptrhck avatar Jun 03 '22 16:06 ptrhck