cloud-functions-emulator icon indicating copy to clipboard operation
cloud-functions-emulator copied to clipboard

inconsistency with production regarding base route /

Open mderazon opened this issue 8 years ago • 3 comments

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

mderazon avatar Mar 29 '17 11:03 mderazon

Which behavior do you prefer?

jmdobry avatar Mar 29 '17 17:03 jmdobry

The emulator one.

Not sure, but it might be something in my code, any idea why the production function behaves like that ?

mderazon avatar Mar 29 '17 17:03 mderazon

I prefer the Emulator's behavior as well, I'll investigate what's going on with production.

jmdobry avatar Mar 30 '17 00:03 jmdobry