stackovermat
stackovermat

Reputation: 435

Uncaught (in promise) Error: FIRESTORE (4.10.1) INTERNAL ASSERTION FAILED: Unknown relation: array-contains

I get this error message in my browser when I call my web page Uncaught (in promise) Error: FIRESTORE (4.10.1) INTERNAL ASSERTION FAILED: Unknown relation: array-contains

I'm using Firestore. The funny thing is, that this works on my local machine and on the online dev machine, but on online production machine (clone of the dev machine) I get the error above.

Firestore introduced just some time ago a new way to query that lets you search within an array (see code below where("userIds", "array-contains", userId).

All npm packages on the machines are the same version.

Any idea, where I can look for differences?

code

import "firebase/firestore"
import firebase from "firebase/app"

export function fetch({ userId }) {
  const db = firebase.firestore()

  return db.collection("/collection")
    .where("userIds", "array-contains", userId)
    .get()
    .then(querySnap => {
        return querySnap.docs
    })
    .catch(err => {
      console.error(err)
      throw err
    })
}

Upvotes: 0

Views: 618

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 598728

The array-contains operator was introduced in version 6.0.0 of the Node.js SDK. According to the error message your production server is running 4.10.1, which doesn't support the array operators yet. To solve the problem you will need to update the server to Admin SDK version 6.0.0 or later.

Upvotes: 3

Related Questions