I’ve added a Netlify Function (
myfunc), set my functions directory in netlify.toml:
[build] publish = "docs/.vuepress/dist" command = "vuepress build docs" functions = "api"
& I have it working within Netlify Dev (i.e. after running
netlify dev, I can
curl http://localhost:34567/myfunc & get a response) but when I try to fetch the endpoint from my frontend in local development, I hit issues. When I try to fetch the localhost URL (http://localhost:34567/myfunc) in my frontend, I hit the CORS problem. When I try to fetch the URL as recommended in this guide (/.netlify/api/myfunc), I get a 404.
Any sense of what I’m doing wrong? I looked into netlify-lambda & whether I need it but just got more confused. Any insight here would be appreciated.