0

I have a standard REST API using Express, exposed via a Firebase Cloud Function.

const api = express() api.get('/test', (req, res) => res.status(403).json({ "REASON": "UNAUTHORIZED" })) exports.api = functions.https.onRequest(api) 

Remote

When I deploy it and send GET https://<remote>/api/test via Postman I get 403 { "REASON": "UNAUTHORIZED" } as expected.

Local

When I run firebase emulators:start --only functions to serve these functions locally and test them, I do see functions: HTTP trigger initialized at http://localhost:5001/.../api in my terminal, but when I send GET http://localhost:5001/.../api/test via Postman I get 200 Not Found.

Am I missing something?

2
  • 1
    If you have reproduction steps for something with the Firebase emulator suite that isn't working the way you expect, I suggest filing an issue on the Firebase CLI GitHub. github.com/firebase/firebase-tools Commented Feb 22, 2020 at 22:11
  • 1
    It was indeed a defect in the Firebase CLI, it seems to be fixed in the latest version (7.13.1) Commented Feb 23, 2020 at 20:37

1 Answer 1

1

It was indeed a defect in the Firebase CLI, it seems to be fixed in the latest version (7.13.1)

Installed the latest version using: npm install -g firebase-tools@latest

Note: it did require me to update to compatible version of firebase-functions and firebase-admin as well.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.