Skip to content

Error with using equalTo (new syntax) #6929

@dmonin

Description

@dmonin

System

  • Operating System version: OSX (latest)
  • Firebase SDK version: 9.15.0
  • Firebase Product: database
  • Node.js version: 16.13.0
  • NPM version: 8.1.0

Problem

I get following error while trying access nodes with query, and equalTo:
@firebase/database: FIREBASE INTERNAL ERROR: Server Error: ClientId[30]:ErrorId[5]: Error on incoming message

Database

{
   "accounts": { 
     "test": { "uid": "abc1"}
   }
}

Initialization

import { initializeApp } from "firebase-admin/app";
import { getDatabase } from "firebase-admin/database";
const app = initializeApp({
    databaseURL: process.env.FIREBASE_DATABASE_URL
});
const db = getDatabase(app);

Older v8 syntax works fine

This code works fine:

  const uid = 'abc1';
  const accountsRef = db.ref('accounts');
  const result = await accountsRef.orderByChild('uid').equalTo(uid).get();
  const data = await result.val();

Newer v9 Syntax, doesn't work (?). It used to work in version 9.14.0

The newer version of this code returns an error: ErrorId[5]: Error on incoming message

  import {get, ref, equalTo, query, orderByChild} from 'firebase/database';
  const uid = 'abc1';
  const accountsRef = ref(db, 'accounts');
  const accountsQuery = query(accountsRef, orderByChild('uid'), equalTo(uid));
  // ---------------------------------------------------------------^ without equalTo, it works.

  const result = await get(accountsQuery);
  const data = await result.val();

Notes

After removing equalTo from the second example, it works fine.
Version 9.14.0, works fine. So this is new since version 9.15.0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions