'firebase serve...'. Web service URL returns "Function X in location us-central1 in project Y does not exist"

1k views Asked by At

I have been happily running a Firebase web 'function' for a while via firebase serve --only functions. But something has gone awry (after I simply tried to move the project folder on my disk - You've probably seen my other post... Anyway, I have put stuff back at the original location and now I have a new problem).

When I run the function locally now, and hit the local web URL, I get this: (And there is no evidence my request callback code is ever called)

{"error":{"code":404,"status":"NOT_FOUND",
"message":"Function FredSays in location us-central1 in project fred-says does not exist",
"errors":["Function FredSays in location us-central1 in project fred-says does not exist"]}}

This seems to be Firebase doing some sort of sanity checking on the request before ever calling my code.

If I look in either the Firebase console, or the google cloud console, the function DOES exist with the right names and locations.

Any idea what is going wrong and how to fix this?

1

There are 1 answers

0
Luca Filip On

I had the same error. I found my fix by checking the following things:

  1. Make sure that in the functions folder the package.json "main" property point's to the right path & that the file exists (index.js).
  2. If you're using TypeScript make sure that the .ts file gets converted to a valid .js file. Also check the tsconfig.json "target" property to compile to ES5.