cloud-functions-emulator
cloud-functions-emulator copied to clipboard
inconsistency with production regarding base route /
I am seeing some inconsistencies with the base route / behavior of the emulator and the real GCF.
code:
const router = require('router')()
const finalhandler = require('finalhandler')
exports.myfunc = (req, res) => {
return router(req, res, finalhandler(req, res))
}
router.get('/', (req, res) => {
res.send("Okay, it's working.")
})
when I open the local version everything is working fine: http://localhost:8010/my-proj/us-central1/myfunc or http://localhost:8010/my-proj/us-central1/myfunc/
Okay, it's working.
But when I deploy it to GCF, I am getting this: https://us-central1-my-proj.cloudfunctions.net/myfunc
Cannot GET null
If I try and add a / there:
https://us-central1-my-proj.cloudfunctions.net/myfunc/
It's working fine
Which behavior do you prefer?
The emulator one.
Not sure, but it might be something in my code, any idea why the production function behaves like that ?
I prefer the Emulator's behavior as well, I'll investigate what's going on with production.