Functions redirecting to incorrect url

for my site venerable-seahorse-82372a.netlify.app, I’m trying to get my fetch calls to hit function endpoints. my call looks like fetch("/api/user") .... this is happening both locally with netlify dev and on my deployed site.

my netlify.toml looks like the below

[functions]
  node_bundler = "esbuild"
  directory = "netlify/functions"

[[redirects]]
  from = "/api/*"
  to = "/.netlify/functions/:splat"
  status = 200

Unless I’m mistaken, I would expect the url to be redirected from my-site.com/api/user to my-site.com/functions/user during fetch but instead I’m getting this output in my logs:

Response with status 404 in 597 ms.
Rewrote URL to /.netlify/functions/server
Request from ::1: GET /.netlify/functions/server
[Vue Router warn]: No match found for location with path "/api/user"

and the deployed site gives me a 404: POST https://venerable-seahorse-82372a.netlify.app/api/login [HTTP/2 404 Not Found 101ms]

My user.js is not in an api folder, it’s in a netlify/functions folder, but I have no idea why it’s trying to GET from /.netlify/functions/server. I don’t reference server anywhere. My toml file has a defined functions folder, my site has a defined functions folder, and the redirect should send it to functions/:splat. I’ve deleted and re-created my site, deleted my .netlify folder, deleted and re-installed node_modules, re-linked and re-built, but still it’s trying to send the GET to server/ and I don’t know what else to try.

any help would be greatly appreciated!

hi there, before we dig in, did you see this brand new guide on debugging redirects?

I strongly suggest you give it a thorough read through and see if this fixes your problem:

if not, please post again, and we’ll try and troubleshoot.