Closed peter-palmer closed 2 years ago
I have deployed in Firebase Functions, calling the function by HTTP, but I'm getting this error:
index.js
const functions = require("firebase-functions"); const cors_proxy = require("cors-anywhere"); const options = { originWhitelist: [], // Allow all origins requireHeader: ["origin", "x-requested-with"], }; cors_proxy.createServer(options); exports.corsProxyRequest = functions.https.onRequest((req, res) => { req.url = req.url.replace("/corsProxyRequest/https:/", "/https://"); cors_proxy.emit("request", req, res); });
firebase.json
{ "rewrites": [ { "source": "**", "function": "corsProxyRequest" } ] }
When I make a call...
The emit method is defined on the return value of createServer. But you're trying to use it on the cors_proxy object instead.
emit
createServer
cors_proxy
It looks like your snippet is based on #160, except modified to be broken.
I have deployed in Firebase Functions, calling the function by HTTP, but I'm getting this error:
index.js
firebase.json
When I make a call...