Firebase-tools: Firebase functions emulator does not provide Query params

Created on 18 May 2019  路  6Comments  路  Source: firebase/firebase-tools

Request URL and Query params are incorrectly parsed inside functions emulator when the slash / is missing at the end of the URL.

[REQUIRED] Environment info


firebase-tools: 6.10.0


Platform: macOS 10.14.4

[REQUIRED] Test case

  1. Init functions in the directory with TS enabled.
  2. Paste whis code to see the express parsed url or params
import * as functions from 'firebase-functions';

export const helloWorld = functions.https.onRequest((request, response) => {
 response.send({
    url: request.url,
    query: request.query
  });
});

[REQUIRED] Steps to reproduce

  1. $ firebase emulators:start
  2. Call the functions with some query params:
    a. http://localhost:5001/.../us-central1/helloWorld/?foo=bar&test=string
    b. http://localhost:5001/.../us-central1/helloWorld?foo=bar&test=string (no slash before ?)

[REQUIRED] Expected behavior

  1. a. =>聽you will get correctly parsed url or query params

[REQUIRED] Actual behavior

  1. b. => url will be "/" and params will be an empty object "{}"

This worked before correctly and it also works when deployed.

emulator-suite functions

Most helpful comment

I second the request, and it's urgent for me. This was working fine until the last update to firebase tools.

All 6 comments

Thanks, will take a look on Monday, we've definitely seen some data getting dropped in the request proxy.

I second the request, and it's urgent for me. This was working fine until the last update to firebase tools.

If it's urgent @thomaswb then please downgrade to [email protected] so you can continue your work.

I'm having this issue too on WSL/Ubuntu 18.04. Doesn't happen with [email protected] so downgrading to that was fine as a workaround. While the req.query was empty, req.body seems unaffected.

Issue also confirmed here.

This may be a regression when we began dropping segments off of paths for 6.10.0.

@samtstern could you take a look, probably around removePathSegments call.

Was this page helpful?
0 / 5 - 0 ratings