Netlify Go Functions not found

I’m new to Netlify and serverless so I’m going through the simple example in the Netlify docs on functions. I’ve set up a Go function in an existing JS project. I don’t see any errors in the logs, but the Go functions are not being recognized after deploy:


And the function route is not found at /.netlify/lambda/hello

Is there another step I am missing?

TOML File with functions folder

Functions file main.go

Did you build/compile the go file in to a binary? You can do that locally on your machine or do it in our buildbot, but it has to be compiled before it can be deployed.

1 Like

Thanks for the response, @futuregerald . I didn’t do a build step on my own. Definitely assumed the build would happen automatically because I set the GO_GET_PATH (probably misunderstood the documentation). Can you point me to instructions on how to use the build bot?

I ended up trying to build on my own and the functions are still not being recognized :frowning_face:

HI @yurm04,

If you’re building locally then you need to make sure you are setting the proper compile targets since it’ll be executed in a lambda container on linux. If you build on mac, then you’ll get a mac binary by default. That means your local build command would have to be something like this:

GOOS=linux GOARCH=amd64 go build function_name.go

You can build it in our build environment during your build as well. I have a go function deploying in

I chain the build command in my package.json as an npm script, though it can be run directly as part of your build command. The build command can be found in that repo at

"build:lambda": "netlify-lambda build src/lambda && go get ./src/lambda/... && go build -o lambda/validate-user ./src/lambda/validate-user.go"

The relevant part for building the go function is:
go build -o lambda/validate-user ./src/lambda/validate-user.go"

Note that you still need to make sure you have your GO_IMPORT_PATH environment variable set. I have it in my netlify.toml:

What about many functions?

I need more than one handler, I need to put them in same file? But if I want to use faunadb, I need to create separated files?

@rof, I’m not sure what you mean, why would you put them in the same file? Each function has to be it’s own file. You can change the building of multiple Go functions in the same way that you build one. each needs to be its own binary at the end of your build process. For example I have a private repo that uses the following build command that builds multiple Go functions:

"build:functions": "mkdir -p functions && go get ./src/functions/... && go build -o functions/fetchunanswered ./src/functions/fetchunanswered/fetchunanswered.go && go build -o functions/openhelpdeskconvo ./src/functions/openhelpdeskconvo/openhelpdeskconvo.go && go build -o functions/savetonotes ./src/functions/savetonotes/savetonotes.go && go build -o functions/fetchunanswerednewtopics ./src/functions/fetchunanswerednewtopics/fetchunanswerednewtopics.go && go build -o functions/tagunanswered ./src/functions/tagunanswered/tagunanswered.go && go build -o functions/fetchrecentpostbyemail ./src/functions/fetchrecentpostbyemail/fetchrecentpostbyemail.go && go build -o functions/tagansweredbutton ./src/functions/tagansweredbutton/tagansweredbutton.go && go build -o functions/tagsolvedbystaff ./src/functions/tagsolvedbystaff/tagsolvedbystaff.go && go build -o functions/fetchadmintopics ./src/functions/fetchadmintopics/fetchadmintopics.go"