googleapis / python-firestore

Apache License 2.0
218 stars 75 forks source link

FireStore Client Functions are not responding #967

Closed Adeel-Intizar closed 1 month ago

Adeel-Intizar commented 1 month ago

Hi, My Code in production was working find but suddenly, firestore functions like get, set etc. have stopped responding and system goes in Not Responding State, the Collection and Document reference of Firebase DB is correct, there is no issues there

Environment details

Code example

# example

cred = credentials.Certificate("secret-key.json")
app = firebase_admin.initialize_app(cred)
store = firestore.client()

login = auth.sign_in_with_email_and_password(email, password)
doc_ref = store.collection('schools').document(login['localId'])

try:
    doc = doc_ref.get()

    if doc.exists:
        data = doc.to_dict()
        print(f"Document Data: {data}")
    else:
        print("No Such Document")
except Exception as e:
    print(f"An Error Occurred: {e}")

The above code doesn't return anything, just goes into not responding state, kind of infinite loop i guess

please help me if I am doing something wrong here, or how can i overcome this issue, i need it to work ASAP, Thank you

Adeel-Intizar commented 1 month ago

ERROR:grpc._plugin_wrapping:AuthMetadataPluginCallback "<google.auth.transport.grpc.AuthMetadataPlugin object at 0x7d28dc6d8af0>" raised exception! Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/grpc/_plugin_wrapping.py", line 105, in call self._metadata_plugin( File "/usr/local/lib/python3.10/dist-packages/google/auth/transport/grpc.py", line 95, in call callback(self._get_authorization_headers(context), None) File "/usr/local/lib/python3.10/dist-packages/google/auth/transport/grpc.py", line 81, in _get_authorization_headers self._credentials.before_request( File "/usr/local/lib/python3.10/dist-packages/google/auth/credentials.py", line 228, in before_request self._blocking_refresh(request) File "/usr/local/lib/python3.10/dist-packages/google/auth/credentials.py", line 191, in _blocking_refresh self.refresh(request) File "/usr/local/lib/python3.10/dist-packages/google/oauth2/service_account.py", line 441, in refresh accesstoken, expiry, = _client.jwt_grant( File "/usr/local/lib/python3.10/dist-packages/google/oauth2/_client.py", line 308, in jwt_grant response_data = _token_endpoint_request( File "/usr/local/lib/python3.10/dist-packages/google/oauth2/_client.py", line 279, in _token_endpoint_request _handle_error_response(response_data, retryable_error) File "/usr/local/lib/python3.10/dist-packages/google/oauth2/_client.py", line 72, in _handle_error_response raise exceptions.RefreshError( google.auth.exceptions.RefreshError: ('invalid_grant: Invalid JWT Signature.', {'error': 'invalid_grant', 'error_description': 'Invalid JWT Signature.'})

Adeel-Intizar commented 1 month ago

Found the issue, Firebase had disable my service account key, just had to create a new one, it fixed the issue