-
Notifications
You must be signed in to change notification settings - Fork 318
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
.listen causes spurious periodic snapshot to be dumped #275
Comments
I found a few problems with this issue:
|
Hey @rawmean. Unfortunately this is just the way the
Generally speaking, we are currently not working on supporting new APIs for the Realtime Database. Even the As far as I can see, you only have three options here:
Duplicate of #267. |
Thanks @hiranya911 . Is it possible to increase the token lifetime to more than one hour. It feels like I am using an orphan/depricated API. I am subscribed to a paid service (firebase). I am not a Node.js or Java developer. Maybe you can suggest a better way if I explain my use-case: Would it help if I create an anonymous user and have the server (which uses I appreciate the help. |
Hi @rawmean. Token expiry time is a Google-wide default. That is for security reasons. A leaked/exposed token with a long expiry time could have disastrous consequences. Given your use case, I think you can get around the issue by not using OAuth2. Admin SDK doesn't support this mode of authentication. But Pyrebase library supports this (see bullet point 2 in my previous comment), and you should be able to implement your program without issues using that. |
@hiranya911 I was using Pyrebase up until a month go, but it has its own critical problems with Would it help if I create an anonymous user and have the server (which uses .listen) to access the database whereby avoiding this token expiration problem? |
Admin SDK does not support accessing the database as a user. We support OAuth2 only. I should also point out that our firebase-admin-python/firebase_admin/_sseclient.py Lines 15 to 18 in 18c2395
So you're likely to encounter similar issues with both libraries. But at least Pyrebase supports accessing the database as a client (which is something we don't allow). |
It seems you're in a tough position.
I think I know why this is. We encountered a similar problem and fixed it in our code: #221. But unfortunately we make OAuth2 mandatory. Pyrebase doesn't mandate OAuth2, but it's probably suffering from the above performance issue. |
I can't possibly be the only firebase user who is interested in using Python with the real-time database and does not want to pay 10x more than what the actual download should be? What am I missing? Real-time database is at the core of Firebase and Python is not some obscure language. you seem like an experienced developer and surely you can see how broken this API is. Can I/you escalate this? Again, this is a paid service provided by a large company. This is not a science project provided by some individual. |
You can try reporting at https://firebase.google.com/support/. Please note that Real-time Database is feature frozen. Meaning we're not working on new APIs. The existing firebase-admin-python/firebase_admin/db.py Lines 359 to 362 in 18c2395
On top of that, we don't see a huge demand for server-side Python support for RTDB. The cases where you'd want to use an API like You need a couple of things to fall into place for your use case to be viable in Python:
Given the circumstances, my advice to you is to try and implement your own |
Hey @rawmean. I was chatting with a team member about this issue, and he pointed out a couple of other options that may be viable for you. I'll list them as 4 and 5 as an add-on to my earlier comment:
|
Thank you @hiranya911 for thinking about this and for your guidance. I have done #4 already. My clients (iOS apps) upload their schedule to the RTDB and my server pays attention to the uploaded schedules and turns on their car's climate based on user schedule. The listen is done on the schedule portion of the database only. There are about 4000 entries and it's growing fast. If I allow anonymous user login, does the 1-hour token restriction still apply? My data on the server is encrypted already so making it visible is not a big risk. #5 seems promising. The transition would not be easy because I have ~8000 iOS clients so I have to somehow maintain both RTDB and Firestore for a while. |
What you need is no-auth. Any form of auth token (OAuth2 tokens, ID tokens etc) has a TTL, and the client must reconnect when the token expires. But if you make your database publicly readable, you can stream updates from it without any auth tokens, and the session will remain valid unless it gets interrupted by a network issue. However, our SDKs don't support this. So you will have to write something on you own. You should be able to reuse our I would also like to point you towards Cloud Functions RTDB triggers: https://cloud.google.com/functions/docs/calling/realtime-database#functions_firebase_rtdb-python As your database continues to grow, you will eventually come to a point, that a single server listening on the database is simply not going to scale, even if you somehow manage to solve your current problems. Cloud Functions should help you scale up to arbitrarily large volumes of data. You can register a trigger on a wildcard path like |
[REQUIRED] Step 3: Describe the problem
Please see this: https://stackoverflow.com/questions/54504339/python-firebase-admin-listener-automatically-fires-every-hour
Steps to reproduce:
Please see the example code provided above.
Problem: the
.listed
causes the entire database to be returned once per hour even when there is no change. Use the sample code provided to reproduce the issue.Relevant Code:
Please see the code in: https://stackoverflow.com/questions/54504339/python-firebase-admin-listener-automatically-fires-every-hour
The text was updated successfully, but these errors were encountered: