Reputation:
I am getting the following error when running the Firestore emulator locally and hitting it with the following URI:
http://localhost:8025/v1/projects/my-project/databases/db/documents/cities/LA
{
"error": {
"code": 400,
"message": "Document parent name \"projects/my-project/databases/db/documents/cities\" lacks \"/\" at index 56.",
"status": "INVALID_ARGUMENT"
}
}
I am using this API reference as a guide. Where am I going wrong in my project name construction?
Upvotes: 2
Views: 1656
Reputation: 96
I am also running into this error, and the problem was you can't specify the document's id
in the URL's path, you need to add documentId
in the query of that URL.
So in your case, when creating a document with an id that the client specified, the correct URL is:
http://localhost:8025/v1/projects/my-project/databases/db/documents/cities?documentId=LA
Edit:
This was documented here:
https://cloud.google.com/firestore/docs/reference/rest/v1/projects.databases.documents/createDocument
Upvotes: 4
Reputation: 317562
The Firestore emulator provided by the Firebase CLI doesn't implement the REST API you're looking at. That API is for the cloud-hosted database instance for your project.
What the emulator does support is building your Android, iOS, web, and nodejs app locally.
Upvotes: 0