Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase functions emulator does not provide Query params #1314

Closed
jans-y opened this issue May 18, 2019 · 6 comments · Fixed by #1332
Closed

Firebase functions emulator does not provide Query params #1314

jans-y opened this issue May 18, 2019 · 6 comments · Fixed by #1332

Comments

@jans-y
Copy link

jans-y commented May 18, 2019

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.

@abeisgoat abeisgoat self-assigned this May 19, 2019
@abeisgoat
Copy link
Contributor

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

@thomaswb
Copy link

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

@abeisgoat
Copy link
Contributor

If it's urgent @thomaswb then please downgrade to firebase-tools@6.8.0 so you can continue your work.

@RoryDungan
Copy link

I'm having this issue too on WSL/Ubuntu 18.04. Doesn't happen with firebase-tools@6.9.2 so downgrading to that was fine as a workaround. While the req.query was empty, req.body seems unaffected.

@JaapWeijland
Copy link

Issue also confirmed here.

@abeisgoat abeisgoat assigned samtstern and unassigned abeisgoat May 21, 2019
@abeisgoat
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants