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

Clound Functions Emulator Not handling query parameters for functions deployed locally. #3032

Closed
biologicalbattery opened this issue Jan 14, 2021 · 7 comments · Fixed by #3033

Comments

@biologicalbattery
Copy link

When deploying functions locally using the emulator, any time a request is to a function and the URL used to make that request has query parameters, the response is HTTP 400 error.

The following function was used:

export const helloWorld = functions.https.onRequest((req,res) => {
    console.log(req.query);
    res.send("Hello World");
});

When requesting this function using the url:
http://localhost:5001/{projectName}/{location}/helloWorld?id=test

I get a 400 error and in the emulator log the following happens:
function[helloWorld]
Beginning execution of "helloWorld"
14:52:13
W
function[helloWorld]
Your function timed out after ~60s. To configure this timeout, see
https://firebase.google.com/docs/functions/manage-functions#set_timeout_and_memory_allocation.
14:52:13
I
function[helloWorld]
C:\Users\Ansaar Dollie\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js:640
14:52:13
I
function[helloWorld]
throw new Error("Function timed out.");
14:52:13
I
function[helloWorld]
^
14:52:13
I
function[helloWorld]

14:52:13
I
function[helloWorld]
Error: Function timed out.
14:52:13
I
function[helloWorld]
at Timeout._onTimeout (C:\Users\Ansaar Dollie\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js:640:19)
14:52:13
I
function[helloWorld]
at listOnTimeout (internal/timers.js:554:17)
14:52:13
I
function[helloWorld]
at processTimers (internal/timers.js:497:7)

Firebase Tools version: 9.2.0

@samtstern
Copy link
Contributor

@ansaardollie thank you for reporting this, I can confirm this is a bug and I am investigating. I have no idea how this got past our tests ... I thought we have one for query params.

@samtstern
Copy link
Contributor

Ok this is caused by my recent changes, I can see the mistake in the logs:

[2021-01-14T14:03:57.461Z] [functions] Got req.url=/fir-dumpster/us-central1/helloWorld?id=ok, mapping to path=?id=ok

@bynicodevelop
Copy link

Hello,

I have an equivalent error with firebase emulators.

My code is

exports.populate = functions
  .https.onRequest(async (request, response) => {
    console.log(request.query);

    response.json({
      status: "ok"
    });
  });

My http request is :

http://localhost:5001/projectID/locationID/development-populate?n=10

And i have this error :

Capture d’écran 2021-01-15 à 11 49 12

My version of firebase is 9.2.0

@samtstern
Copy link
Contributor

@bynicodevelop this will be fixed in the next release, either 9.2.1 or 9.3.0 depending on what else ships.

@bynicodevelop
Copy link

Thanks for the quick answer, but how can I update firebase tools to avoid this problem now?

Because I'm stuck: D

maybe: npm i -g firebase-tools @ master?

@bynicodevelop
Copy link

Sorry,

supid question :D

npm i -g firebase-tools@9.1.2

This was referenced Mar 9, 2021
@jeydi243
Copy link

Hi everyone!
I'm using the firebase-tools version 9.20.0 and i have the same error.

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.

4 participants