Python app hosted on app engine is not able to connect with Firestore where as working on local

Viewed 1555

I have created a new project on GCP. I am trying to select/add data from firestore (already in native mode) from Python flask app. From local env. I am able to connect to firestore. But once I hosted my app on App engine, my API is not able to connect with Firestore. It's throwing the below error:

TypeError: with_scopes_if_required() got an unexpected keyword argument 'default_scopes'

_create_composite_credentials (/layers/google.python.pip/pip/lib/python3.7/site-packages/google/api_core/grpc_helpers.py:238)

I am not sure what I am missing here. I appreciate any support.

Thanks

1 Answers

I had the same issue, and I just fixed it today.

As you can see in the changelog https://googleapis.dev/python/google-api-core/latest/changelog.html recently they have updated the requirements for google-auth lib. You need to check your requirements.txt. In my case, we had two libs pinned that we weren't using directly.

google-auth==1.21.1
google-auth-oauthlib==0.4.1

I just removed them from the requirements.txt so that dependencies versions are handled automatically, and it solved the issue.

So I guess it depends on your case, on how you are managing dependencies, but you might want to play with google-auth versions.

Related