Open antoinezambelli opened 6 years ago
Getting new behavior...quite likely I missed a git pull
somewhere along the way and adding the server key in fixed it. I'll reopen if I can reproduce under current conditions.
Behavior still present...though it has now managed to reconnect at least once on its own before timing out.
I can confirm that closing and reopening the stream doesn't help.
Is there any easy way to catch the timeout exception? Setting the entire firebase auth procedure in a timer thread works to reconnect - but if we get a redirect error (instead of auth error) then the thread is dead until the timer closes and reopens everything?
@antoinezambelli did you eventually find a way to solve the timeout problem? And if so, how?
If memory serves, I never resolved it. Trying to do a fully python
firebase
app was riddled with problems (for me). I eventually dropped the python
firebase
structure, and just did everything with a javascript
server calling python
scripts - it proved to be a really stable way of doing things (in my case). Mind you, this was a couple years ago so maybe something's improved.
I'm getting the following error on my
stream
after a while of it being up, despite having setup the Service Account Credentials.raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://****.firebaseio.com/****.json
It seems to be a timeout issue. I've seen a few issues here about that but they all indicate it should be fixed with SAC. Note that I've only encountered this issue when there is no activity on the stream (left it open after stopping dev work for the day). I haven't had constant activity for very long at a time, so maybe it happens in that case as well.
Here is my code in case I messed up the setup:
Some thoughts off the bat: 1) I actually forgot to add the
apiKey
for a while but it still worked (with timeout issues). Should thatapiKey
be theServer Key
or theWeb API key
found inSettings>General
in the Firebase console?2) I could always close and reopen the
stream
on a timer...but that seems ugly.3) Is there a way to catch that
HTTPError
so I only reopen the stream if/when it goes down?4) Is a simple ping needed to keep the stream active? Like I said I haven't tested this with activity throughout.
I'm hoping I just messed something up and there's actually an easy fix.