Firebase Admin not retried on auth request connection error

Open
#852 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
firebase, python

Research direction

Start at HttpClient.init and trace how AuthorizedSession is created, then inspect AuthorizedSession.credentials.before_request to confirm where auth-request retries are configured. Verify that connection-aborted auth requests use the intended retry configuration and that the existing request retry behavior remains unchanged.

Written by the indexing model from the issue text.

Description

api: core

Even though DEFAULT_RETRY_CONFIG is good enough

DEFAULT_RETRY_CONFIG = retry.Retry(
    connect=1, read=1, status=4, status_forcelist=[500, 503],
    raise_on_status=False, backoff_factor=0.5, **_ANY_METHOD)

I'm still periodically getting ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')). I started thinking it is very weird, because it seems that this connection error should be retried, no? It turned out, that this connection error occurs not in the request itself, which properly retries connection errors. It happens inside AuthorizedSession.credentials.before_request, which for auth requests instead of DEFAULT_RETRY_CONFIG uses

retry_adapter = requests.adapters.HTTPAdapter(max_retries=3)

I think the right approach would be to form auth_request manually with the correct retry config in HttpClient.__init__ and pass it to AuthorizedSession on creation.

What are your thoughts?

Dominant language
Python
Stars
1.2k
Forks
359
Avg merge
5d 6m
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from firebase/firebase-admin-python

All issues in firebase/firebase-admin-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.