Simple Function Returns 404, but it's working fine in Netlify Dev

Hi,

Site: hmutils.netlify.app
Directory structure:

  • netlify
    • functions
      • echo
        • index.mts

Contents of index.mts:

import type { Context, Config } from "@netlify/functions"

export default async (req: Request, context: Context) => {
    const { value } = context.params;
    return new Response(value);
};

export const config: Config = {
    path: "/echo/:value",
}

Function endpoint: https://hmutils.netlify.app/echo/:value
Function test: https://hmutils.netlify.app/echo/test

I also see this and other functions in here:

Netlify Dev is running the function and it’s working fine, but the deployed function in Netlify responds with 404:

404
Not Found

The project is a Svelte Kit initial project and I use pnpm instead of npm.

That not found comes from SvelteKit. It won’t be possible to use Functions at a custom path with SvelteKit as it takes over all the paths before the function.

Yes, thank you, I figured it out as well. I changed it to use Svelte routes instead of Netlify functions.

thank you.