Python Firebase Admin SDK Listener sometimes throws Bad Gateway errors after DB is updated
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Start with the Python Realtime Database listener path used by db.reference(...).listen(exampleFunc) and the reported requests.exceptions.HTTPError 502 response after database updates. Review the listener setup and any available project IDs and timestamps against server-side logs. Done means identifying a reproducible cause or documenting how the intermittent failure should be handled.
Written by the indexing model from the issue text.
Description
[READ] Step 1: Are you in the right place?
Yes
[REQUIRED] Step 2: Describe your environment
- Operating System version: cos-stable-101-17162-40-5
- Firebase SDK version: latest?
- Firebase Product: realtime database, admin SDK
- Python version: 3.8
- Pip version: latest?
[REQUIRED] Step 3: Describe the problem
I have a database with customers data in it. When a new customer is added, a Firebase function triggers and updates '' to [user.uid]: to represent credits in my system. I have a google cloud VM that has an admin sdk database listener setup. Every month or so, after a new customer signs up, all of my listeners will randomly throw an error. The error I am seeing is:
requests.exceptions.HTTPError: 502 Server Error: Bad Gateway for url: https://-default-rtdb.firebaseio.com/.json
I am using the realtime listener described in this stack overflow post top answer:
https://stackoverflow.com/questions/49863708/python-firebase-realtime-listener
Steps to reproduce:
Hard to reproduce, but I can also provide my project ID and exact times for the issue so that the Firebase team can look into server-side logs to see what the issue might be.
Relevant Code:
from firebase_admin import db
def exampleFunc(event):
try:
print(event)
except Exception as e:
return
#in startup function
listener1=db.reference('<listening location 1>').listen(exampleFunc)
listener2=db.reference('<listening location 2>').listen(exampleFunc)
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 359
- Avg merge
- 5d 6m
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from firebase/firebase-admin-python
-
api: remoteconfig
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
firebase/firebase-admin-python#957 · 1 comment ·
-
api: database type: feature request
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
firebase/firebase-admin-python#978 · 1 comment ·
-
[FR] Support VERIFY_AND_CHANGE_EMAIL in generate_email_action_link (parity with firebase-admin-node) Openapi: auth
firebase/firebase-admin-python#949 · 2 comments · 1 reaction · 1 assignee ·
-
Difficulty 4/5 3-5 days Newbie friendliness 43/100
firebase/firebase-admin-python#945 · 1 comment · 1 reaction ·
All issues in firebase/firebase-admin-python
Similar issues
-
Add: hunch Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
DiamondLightSource/dodal#2211 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
openml/openml-python#1749 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
sipyourdrink-ltd/bernstein#6191 ·