SvelteKit (Vite) POST request resulting in "Function not found..." response message.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.9k
- Forks
- 474
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 53
Description
UPDATED: After the original issue disappeared with a netlify update, the issue recently reappeared. See the comments below for details. I have provided a minimal recreation in the comments.
Describe the bug
I am using SvelteKit in my project. My site seems to work well for all GET requests including those that leverage endpoints. However, I have one endpoint that has handlers for both GET and POST requests. The GET request works fine, however when I submit a POST request to that same endpoint, I get the text response message "Function not found...".
This is not a problem I run into when running SvelteKit directly instead of through netlify-cli.
I verified that the corresponding .netlify/server/entries/endpoints file has both GET and POST functions.
Any suggestions for things to try? If this is a head-scratcher, I'll move forward with creating a test project that reproduces the issue.
Steps to reproduce
Submit a POST request to an enpoint that defines both GET and POST handlers.
Configuration
[build]
command = "npm run build"
publish = "dist"
[dev]
command = "npm run dev -- --host"
targetPort = 5173
port = 9090
autoLaunch = false
functionsPort = 9091
Environment
System:
OS: Linux 5.15 KDE neon 5.25
CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
Memory: 9.52 GB / 15.35 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 17.6.0 - ~/apps/nodejs/node-current/bin/node
Yarn: 1.22.17 - ~/apps/nodejs/node-current/bin/yarn
npm: 8.5.2 - ~/apps/nodejs/node-current/bin/npm
npmGlobalPackages:
netlify-cli: 10.5.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the POST request against a SvelteKit endpoint that defines both GET and POST handlers, using the provided netlify-cli configuration and npm run build. Compare the result with running SvelteKit directly; done means the POST request returns the endpoint response instead of "Function not found...".
Written by the indexing model from the issue text.
Assessment
- Tech stack
- vite
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100