import { onRequest } from "firebase-functions/v2/https";
import express from "express";
const app = express();
app.all("*", (_, res) => {
res.sendStatus(200)
})
export const api = onRequest(app);
[REQUIRED] Steps to reproduce
Deploy the given function, and try to make a OPTIONS request.
[REQUIRED] Expected behavior
The response status should be 200.
[REQUIRED] Actual behavior
The response status is 204.
This doesn't seem to be an issue with any other method. My initial assumption is that functions has something intercepting OPTIONS requests for the sake of firebase-auth- but this is not expected behavior for consumers. Especially when folks aren't actually using auth in their underlying implementation. Furthermore, this has been causing a lot of issues on our end in regards to cors configurations.
Were you able to successfully deploy your functions?
Isn't this an Express thing? Your repro is an Express app, which should install a default configuration of its CORS middleware, which looks like it intercepts OPTIONS requests and responds with 204.
Related issues
N/A
[REQUIRED] Version info
node: 20.9.0
firebase-functions: 4.5.0
firebase-tools: 12.9.1
firebase-admin: 11.8.0
[REQUIRED] Test case
[REQUIRED] Steps to reproduce
Deploy the given function, and try to make a
OPTIONS
request.[REQUIRED] Expected behavior
The response status should be
200
.[REQUIRED] Actual behavior
The response status is
204
.This doesn't seem to be an issue with any other method. My initial assumption is that functions has something intercepting
OPTIONS
requests for the sake offirebase-auth
- but this is not expected behavior for consumers. Especially when folks aren't actually using auth in their underlying implementation. Furthermore, this has been causing a lot of issues on our end in regards to cors configurations.Were you able to successfully deploy your functions?
Yes