Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async Client Commit raises TypeError: Unexpected type of call <class 'google.cloud.firestore_v1.types.firestore.CommitResponse'> under emulator #286

Closed
crwilcox opened this issue Jan 6, 2021 · 6 comments
Labels
api: firestore Issues related to the googleapis/python-firestore API. external This issue is blocked on a bug with the actual product. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@crwilcox
Copy link
Contributor

crwilcox commented Jan 6, 2021

branching from #64 (comment)

Thank you @mr-bjerre

Really appreciate the new support of AsyncClient !

One issue though. It doesn't work with the firestore emulator. The following script raises and exception

TypeError: Unexpected type of call <class 'google.cloud.firestore_v1.types.firestore.CommitResponse'>

Start the firestore emulator and run the script

import asyncio
from google.cloud.firestore import AsyncClient
import os


os.environ["FIRESTORE_EMULATOR_HOST"] = "localhost:8080"

client = AsyncClient()


async def save():
    return (
        await client.collection("test")
        .document("test")
        .set({"message": "Hello World!"})
    )


if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(save())

The same issue goes for retrieving data.

@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/python-firestore API. label Jan 6, 2021
@crwilcox crwilcox changed the title Async Client Watch raises TypeError: Unexpected type of call <class 'google.cloud.firestore_v1.types.firestore.CommitResponse'> Async Client Commit raises TypeError: Unexpected type of call <class 'google.cloud.firestore_v1.types.firestore.CommitResponse'> Jan 6, 2021
@crwilcox crwilcox changed the title Async Client Commit raises TypeError: Unexpected type of call <class 'google.cloud.firestore_v1.types.firestore.CommitResponse'> Async Client Commit raises TypeError: Unexpected type of call <class 'google.cloud.firestore_v1.types.firestore.CommitResponse'> under emulator Jan 6, 2021
@crwilcox
Copy link
Contributor Author

crwilcox commented Jan 6, 2021

Note, this only occurs under emulation.

@crwilcox
Copy link
Contributor Author

crwilcox commented Jan 6, 2021

Exception has occurred: TypeError
Unexpected type of call <class 'google.cloud.firestore_v1.types.firestore.CommitResponse'>
  File "/Users/crwilcox/workspace/python-firestore/google/cloud/firestore_v1/services/firestore/async_client.py", line 691, in commit
    response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
  File "/Users/crwilcox/workspace/python-firestore/google/cloud/firestore_v1/async_batch.py", line 58, in commit
    commit_response = await self._client._firestore_api.commit(
  File "/Users/crwilcox/workspace/python-firestore/google/cloud/firestore_v1/async_document.py", line 127, in set
    write_results = await batch.commit(**kwargs)
  File "/Users/crwilcox/scratch/python-firestore/watch.py", line 13, in document_set
    await async_client.collection("test").document("test").set({"message": "Hello World!"})
  File "/Users/crwilcox/scratch/python-firestore/watch.py", line 17, in <module>
    loop.run_until_complete(document_set())

@crwilcox
Copy link
Contributor Author

crwilcox commented Jan 6, 2021

I am marking this issue as external and have opened an issue against the api-core package. can close once resolved.

@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Jan 6, 2021
@crwilcox crwilcox added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels Jan 8, 2021
@yoshi-automation yoshi-automation removed the triage me I really want to be triaged. label Jan 8, 2021
@joakimnordling
Copy link

Is there any estimation when we could see a release that would include the fix for this issue?

@adamserafini
Copy link

adamserafini commented Mar 31, 2021

If I'm understanding the thread of issues correctly, it seems this PR fixes the issue right? #288 But not sure when it will be "released", I am not clear on that.

Would also be keen to know when emulator will be released that will work with asyncio (we even decided to avoid the asyncio client completely in Firestore until it works).

@crwilcox
Copy link
Contributor Author

v2.1.0 was released yesterday: https://pypi.org/project/google-cloud-firestore/

If you see an issue after upgrading with the emulator, please open an issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/python-firestore API. external This issue is blocked on a bug with the actual product. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

4 participants