Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FIREBASE WARNING: Invalid query string segment - Warning when deploying simple Firebase Cloud function

This morning I started noticing a large amount of "FIREBASE WARNING: Invalid query string segment" errors in my functions log. In an attempt to figure out what was going on I ended up making various changes to function and deploying all my cloud functions several times.

While doing this I noticed that I was getting the error on a function that:

  1. Does not have a Firebase Query in it.
  2. Has not been invoked in months (it's a test function).

This leads me to believe that a change was made Firebase Cloud Functions recently that may be sporadically generating this error on deploy and/or execution of cloud functions regardless of whether the function has anything to do with real time database queries. Has anybody else noticed this error or have any insight into why it is occurring?

Relevant part of my cloud index.js file is as follows (should be enough to replicate the issue):

const cors = require('cors')({origin: true});
const functions = require('firebase-functions');
const admin = require('firebase-admin');

const firebaseRef = admin.database().ref();
const firestoreRef = admin.firestore();

exports.testCloudFunctions = functions.https.onRequest((request, response) => {
  cors(request, response, () => {
    const params = request.query;
    console.log(params)
    response.status(200).send({success: true, message: "Test Successful", params: params});
  });
});
like image 587
John Morrell Avatar asked Feb 16 '18 17:02

John Morrell


2 Answers

After talking with Firebase support, I learned this bug was introduced in the npm dependency @firebase/database: 0.1.10. You will have this dependency if you also have the latest firebase-admin dependency.

The warning

shouldn't have any impact on the function's overall processing.

If you want to remove the warning, you can force the npm dependency of @firebase/database: 0.1.9. I tested this adjustment and the warning was removed from my Firebase Console Logs.

The support agent also stated the fix has been made, but not released, so I would expect @firebase/database: 0.1.11+ to not experience this bug.

like image 168
Matt Goodrich Avatar answered Sep 28 '22 09:09

Matt Goodrich


Looks like a recently introduced bug which will hopefully be fixed soon.

like image 25
jc275 Avatar answered Sep 28 '22 10:09

jc275