Redirects to function endpoints not working using netlify cli "netlify dev"

I’ve got a project where I had some redirect rules set up to handle some “functions” endpoints. It worked well for a while but when I updated the CLI version recently it seems to have stopped.

I can hit a function path directly, as in http://localhost:8888/.netlify/functions/dboxDecks/dboxDecks.js and it will work fine.

However when I try to go to its redirect ‘from’ path http://localhost:8888/decks it simply serves the root, index file of the project .

I should point out that when I used to run netlify dev a secondary terminal window launched and displayed some port information. Now this does not happen.

Here’s my netlify.toml file:

  publish = "build"
  functions = "functions"

  from = "/generate"
  to = "/.netlify/functions/generateSignature/generateSignature.js"
  status = 200

  from = "/decks"
  to = "/.netlify/functions/dboxDecks/dboxDecks.js"
  status = 200

  from = "/slides"
  to = "/.netlify/functions/dboxSlides/dboxSlides.js"
  status = 200

  from = "/thumbnail"
  to = "/.netlify/functions/dboxDeckThumbnail/dboxDeckThumbnail.js"
  status = 200

Anyone know what’s going on?

Hey there,

Can you give this topic a read, please, and let me know if this helps?

So I uninstalled netlify cli and reinstalled with npm i -g netlify-cli@latest and the issue still persists.

@willkp Can you please post the results of netlify version --verbose!

I have the same problem.

When I run $ netlify dev or $ netlify dev --live the redirects rules does not works.

If I publish the project all run correctly.

My Netlify config file is like that:

    command = "npm run build"
    publish = "dist"
    functions = "functions"
    framework = "#custom"
    command = "npm run dev"
    targetPort = 3030

My _redirects file is that:

/api	/.netlify/functions/api		200

This is not only a issue with functions redirects. It’s not working with any redirect rule.

Here the link to the demo project in production:

Here the link to the code:

And a capture with my netlify version --verbose!

As far as I know, we cannot host functions with the string “api” in their name - obscure bug. Mind trying it with a differently named function just to be sure?

Hi fool,

Using the string “api” in the name of my functions works well on Dev and Production. I can’t find any obscure bug.

However, I have changed the name of the function and the redirection and the problem persists.

Where there is a bug is in the latest version of Netlify CLI.

I found this and It’s not only a Gatsby problem:


Hey there,

Thanks for closing the loop and linking the bug.

As per, netlify-cli@2.51.0 has just been released which contains a fix for this issue.

Everything is fine width the update.