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

functions cannot get user's User-Agent when you call it from hosting emulator by using rewrites #2970

dora1998 opened this issue Dec 27, 2020 · 3 comments · Fixed by #3028


Copy link

[REQUIRED] Environment info

firebase-tools: 9.1.0

Platform: macOS

[REQUIRED] Test case

  1. Create a project that uses hosting and functions.
  2. Call a function from hosting by rewrites.
  3. When you test on local emulator, the function cannot get user's User-Agent.

The reproducible sample is below.

[REQUIRED] Steps to reproduce

  1. git clone
  2. yarn install && yarn serve --project YOUR_PROJECT_ID
  3. Access to http://localhost:5001/YOUR_PROJECT_ID/us-central1/checkUA, then you'll see your user agent.
  4. However, when you access to http://localhost:5000/foobar, you'll see FirebaseCLI/9.1.0 regardless of your User-Agent.

I think this line set the User-Agent regardless of user's one.

[REQUIRED] Expected behavior

Functions can get user's UA.

[REQUIRED] Actual behavior

Functions always get FirebaseCLI/9.1.0 as User-Agent on local emulator.

Copy link

@dora1998 thanks for reporting this! Seems like a clear bug in our new apiv2 code.

Copy link

Sorry I'm so slow in coming to these. Let me take a look.

Copy link

Well, that was pretty straight forward to fix. Assuming all goes well, watch for it in a new release of firebase-tools once this is closed.

This was referenced Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging a pull request may close this issue.

3 participants