Can't access Netlify functions on deploy

Hi all,

I have a Gatsby site which is deployed to Netlify via Gatsby Cloud. I’m having trouble implementing Netlify lambda functions, and to trouble shoot, I added a simple helloWorld.js lambda function in the /functions folder (as specified in my netlify.toml):

exports.handler = async function () {
  return {
    statusCode: 200,
    body: JSON.stringify({ message: "Hello World" })

When I visit localhost:8800/.netlify/functions/helloWorld in netlify dev I get the expected JSON response, but when visiting <deploy url>/.netlify/functions/helloWorld I get redirected to the site’s 404 page.

Here is the deploy:

Any help greatly appreciated! :face_with_monocle:

Hi, @StudioMASS. I don’t show any functions processed in that deploy. Also, I don’t see netlify.toml file when I download the deploy either. You can download it here:

The download deploy button can be seen in the screenshot below:


So, I do think the issue is almost certainly that the function isn’t being deployed.

That looks like a manual deploy. Did you use the Netlify CLI tool to deploy? If so, do the directory with the function and file “netlify.toml” both exist in the directory you are publishing?

Excellent tip, had a poke around inside and turns out the functions weren’t making their way into the deploy folder. Added them to static/functions and now they are deploying (although not showing up in the Netlify UI). Thanks!