Hi there, I’m experiencing the following issue:
According to this documentation, we should be able to use an index.js file inside of a folder name to reach the endpoint.
E.g. /functions/hello-world.js
should be equivalent to /functions/hello-world/index.js
This works fine in production (I’m using a custom build process via Gatsby Cloud, the onPostBuild
hook and @netlify/zip-it-and-ship-it
).
Examples:
https://gatsby-cloud-netlify-functions.netlify.app/.netlify/functions/test
https://gatsby-cloud-netlify-functions.netlify.app/.netlify/functions/hello-world
However, this does not work when utilizing netlify dev
during local development with a corresponding netlify.toml
file. When I attempt to hit the functions on localhost, I receive the following console errors:
GET http://localhost:8888/.netlify/functions/hello-world
Request from ::ffff:127.0.0.1: GET /.netlify/functions/hello-world
Response with status 200 in 9 ms.
GET http://localhost:8888/.netlify/functions/test
Request from ::ffff:127.0.0.1: GET /.netlify/functions/test
Response with status 404 in 0 ms.
Request from ::ffff:127.0.0.1: GET /.netlify/functions/test.html
Response with status 404 in 0 ms.
Request from ::ffff:127.0.0.1: GET /.netlify/functions/test.htm
Response with status 404 in 0 ms.
Request from ::ffff:127.0.0.1: GET /.netlify/functions/test/index.html
Response with status 404 in 0 ms.
Request from ::ffff:127.0.0.1: GET /.netlify/functions/test/index.htm
Response with status 404 in 0 ms.
Here’s my minimal repo configuration:
Base Repo: gatsby-starter-default
Folder Hierarchy:
.
|-- src
| |-- functions
| | |-- hello-world.js
| | |-- test
| | | |-- index.js
netlify.toml:
[build]
functions="public/functions" #this is for gatsby cloud config
[dev]
functions="src/functions"
Running gatsby with netlify dev
and what should be all the appropriate ports.
Any advice would be appreciated.