-
Notifications
You must be signed in to change notification settings - Fork 86
Closed
Labels
api: firestoreIssues related to the googleapis/python-firestore API.Issues related to the googleapis/python-firestore API.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.
Description
Environment details
- OS type and version: macos 13.4 (22F66)
- Python version: 3.11.0
- pip version: pip 22.3.1
google-cloud-firestoreversion: 2.10.0
Steps to reproduce
- run code below
- get error
Code example
docker run --rm -d -p 8090:8090 --name firestore-emulator google/cloud-sdk:emulators gcloud emulators firestore start --host-port=0.0.0.0:8090import asyncio
import os
from google.cloud.firestore_v1.services.firestore import FirestoreAsyncClient
from google.cloud.firestore_v1.types import Write, Document, Value, BatchWriteRequest
async def main():
fs_client = FirestoreAsyncClient()
_batch = [
Write(
update=Document(
name=f"projects/dummy-project/databases/(default)/documents/my_collection/abc",
fields={
"rpt": Value(double_value=123.456)
},
)
),
Write(
update=Document(
name=f"projects/dummy-project/databases/(default)/documents/my_collection/def",
fields={
"rpt": Value(double_value=456.789)
},
)
)
]
response = await fs_client.batch_write(request=BatchWriteRequest(
database="projects/dummy-project/databases/(default)",
writes=_batch
))
print(response)
if __name__ == "__main__":
os.environ["FIRESTORE_EMULATOR_HOST"] = "localhost:8090"
asyncio.run(main())Stack trace
/Users/ben.marengo/code/pyenvs/scratch311/bin/python /Users/ben.marengo/code/scratch/bq_to_firestore/with_fs_async_client.py
Traceback (most recent call last):
File "/Users/ben.marengo/code/pyenvs/scratch311/lib/python3.11/site-packages/google/api_core/grpc_helpers_async.py", line 81, in __await__
response = yield from self._call.__await__()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ben.marengo/code/pyenvs/scratch311/lib/python3.11/site-packages/grpc/aio/_call.py", line 290, in __await__
raise _create_rpc_error(self._cython_call._initial_metadata,
grpc.aio._call.AioRpcError: <AioRpcError of RPC that terminated with:
status = StatusCode.PERMISSION_DENIED
details = "Permission denied on resource project dummy-project."
debug_error_string = "UNKNOWN:Error received from peer ipv4:142.250.200.10:443 {grpc_message:"Permission denied on resource project dummy-project.", grpc_status:7, created_time:"2023-06-20T14:51:51.60572+01:00"}"
>
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/ben.marengo/code/scratch/bq_to_firestore/with_fs_async_client.py", line 40, in <module>
asyncio.run(main())
File "/Users/ben.marengo/.pyenv/versions/3.11.0/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/Users/ben.marengo/.pyenv/versions/3.11.0/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ben.marengo/.pyenv/versions/3.11.0/lib/python3.11/asyncio/base_events.py", line 650, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/Users/ben.marengo/code/scratch/bq_to_firestore/with_fs_async_client.py", line 30, in main
response = await fs_client.batch_write(request=BatchWriteRequest(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ben.marengo/code/pyenvs/scratch311/lib/python3.11/site-packages/google/cloud/firestore_v1/services/firestore/async_client.py", line 1847, in batch_write
response = await rpc(
^^^^^^^^^^
File "/Users/ben.marengo/code/pyenvs/scratch311/lib/python3.11/site-packages/google/api_core/grpc_helpers_async.py", line 84, in __await__
raise exceptions.from_grpc_error(rpc_error) from rpc_error
google.api_core.exceptions.PermissionDenied: 403 Permission denied on resource project dummy-project. [links {
description: "Google developer console API key"
url: "https://console.developers.google.com/project/dummy-project/apiui/credential"
}
, reason: "CONSUMER_INVALID"
domain: "googleapis.com"
metadata {
key: "service"
value: "firestore.googleapis.com"
}
metadata {
key: "consumer"
value: "projects/dummy-project"
}
]
Process finished with exit code 1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api: firestoreIssues related to the googleapis/python-firestore API.Issues related to the googleapis/python-firestore API.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.