firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Emulated Firestore REST API not working with cloud-firestore-emulator-v1.19.1.jar...

Open sarge1989 opened this issue 1 year ago • 1 comments

[REQUIRED] Environment info

firebase-tools: 13.3.1

Platform: all

[REQUIRED] Test case

Any type of query made via the firestore REST API

[REQUIRED] Steps to reproduce

  1. firebase init with emulator and firestore added.
  2. firebase.json as follows
  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "emulators": {
    "firestore": {
      "port": 8080
    },
    "ui": {
      "enabled": false
    },
    "singleProjectMode": true
  }
}
  1. run firebase emulators:start
  2. curl the following. Replace YOUR_PROJECT_NAME accordingly
curl --location 'http://localhost:8080/v1/projects/{{YOUR_PROJECT_NAME}}/databases/(default)/documents:runQuery' \
--header 'Authorization: Bearer owner' \
--header 'Content-Type: application/json' \
--data '{
    "structuredQuery": {
        "from": [{
            "collectionId": "anything",
            "allDescendants": true
        }],
        "where": {
            "fieldFilter": {
                "field": {
                    "fieldPath": "text"
                },
                "op": "EQUAL",
                "value": {
                    "stringValue": "hello world"
                }
            }
        }
    }
}'

[REQUIRED] Expected behavior

Should return something like

[
    {
        "readTime": "2024-02-24T08:09:46.192391Z",
        "done": true
    }
]

[REQUIRED] Actual behavior

Returns

{"error":{"code":500,"message":"Internal","status":"INTERNAL"}}

sarge1989 avatar Feb 24 '24 08:02 sarge1989

Just a quick update here, our team is currently investigating the cause of this issue. For now, I can only recommend downgrading to firebase-tools v13.3.0 as a workaround. Apologies for the inconvenience this may have caused.

joehan avatar Feb 27 '24 20:02 joehan