6

I keep having these warnings in the Firebase Logs Console: "FIREBASE WARNING: Invalid query string segment:"

I checked everything but I can't find some reasons.

Do you have any ideas ?

Configuration

{
"name": "functions",
"description": "Cloud Functions for Firebase",
"dependencies": {
"firebase-admin": "~5.8.1",
"firebase-functions": "^0.8.1"
},
"private": true
}

Test case: a very simple cloud function:

exports.test = functions.database
.ref('/scores/{sportId}/{matchId}')
.onWrite(event => {

const sportId = event.params.sportId;
const matchId = event.params.matchId;

const awayTeamScore = event.data.child("awayTeamScore").val();
const dateLastUpdate = event.data.child("dateLastUpdate").val();
const homeTeamScore = event.data.child("homeTeamScore").val();
const status = event.data.child("status").val();

var awayTeamScoreSnapshot = event.data.child("awayTeamScore");
var dateLastUpdateSnapshot = event.data.child("dateLastUpdate");
var homeTeamScoreSnapshot = event.data.child("homeTeamScore");
var statusSnapshot = event.data.child("status");

return admin.database().ref(/indexMatchLeague/${matchId}).once('value').then(league => {
console.log(matchId, homeTeamScore, awayTeamScore, status);
/*
var promises = [];
league.forEach(leagueSnap => {
const leagueId = leagueSnap.key;
const leagueVal = leagueSnap.val();
console.log(leagueId, leagueVal);
});
return Promise.all(promises);
*/
return null;
});
});
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Ericbcn
  • 191
  • 2
  • 6
  • 1
    This seems like a syntax error: `admin.database().ref(/indexMatchLeague/${matchId})`. Replace it with ``admin.database().ref(`/indexMatchLeague/${matchId}`)``. – Frank van Puffelen Feb 16 '18 at 15:46
  • same thing here. I did not change anything but reupload my functions. Maybe the firebase team does some updates – Jürgen Brandstetter Feb 16 '18 at 18:03
  • It seems like something is wrong with the triggers listening to the DB. You can try (here https://console.cloud.google.com/functions/list) if you functions itself is still working. – Jürgen Brandstetter Feb 16 '18 at 18:25
  • Looks like a [recently introduced bug](https://github.com/firebase/firebase-js-sdk/issues/517) which will hopefully be fixed soon. – jc275 Feb 16 '18 at 19:12
  • My example had a typo, I fixed it. Anyway there is a bug in this Firebase release, they say to force dependencies to "@firebase/database": 0.1.9 – Ericbcn Feb 19 '18 at 14:01
  • Google has confirmed to me that it indeed is a Bug and they are looking at it. I had raised a support ticket and this is what they have to say in their email: "Thanks for the confirmation. We indeed see a bug on database triggers but should not have an overall impact to the functions processing. It has been brought to the attention of the right team and is being prioritized appropriately." – Ram Iyer Feb 21 '18 at 05:49

0 Answers0