Skip to content

SvelteKit (Vite) POST request resulting in "Function not found..." response message. #4873

Open
@kyllerss

Description

@kyllerss

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions