Redirects fail in dev after 'ntl link'

This is a follow up to an earlier post - Thanks @coelmay for helping me narrow it down.

Here are the steps for me to reproduce this dev mode issue on my ubuntu 20.02 machine:

  • Clone the repo to a test directory git clone testdir. This repo contains the getting started tutorial code including a public/_redirects file with contents: /api/* /.netlify/functions/:splat. The redirect works at the live site, that is, correctly redirects to
  • cd test && npm install
  • Start dev server: ntl dev
  • Browse to localhost:8888/api/hello-world → get 200 response with “hello world! I have a undefined”. The redirect works! (undefined appears because the site is not linked so an environment variable is missing.)
  • Link directory to the site via ntl link
  • Browse to localhost:8888/api/hello-world → “404 Not Found Path: /api/hello-world/index.htm”
  • Browse to localhost:8888/.netlify/functions/hello-world → “200 hello world! I have a super secret”
    So the function works, but the redirect is broken in dev.

Thanks for any help on this!

Thanks @troutshorty

Have you looked through current issues with Netlify CLI? If there is nothing that matches, you can create an issue.

Thanks @coelmay for the issues link – will do!

Update: It seems to be an unresolved issue: Functions 404 with Netlify Dev and a linked project · Issue #955 · netlify/cli · GitHub reported in June 2020