444B / streamlit-analytics2

👀 Track & visualize user interactions with your streamlit app
MIT License
22 stars 2 forks source link

Firestore not playing nice with file_uploader #39

Closed 444B closed 7 months ago

444B commented 7 months ago

Original issue by jucor on 2021-04-20 20:31:21+00:00

When one of the widgets is a file_uploader and Firestore is enabled, an error is thrown at stop_tracking complaining about something something not being a string something something. (sorry, did not save the exact error anymore, I worked around it, see below).

This error does not appear when Firestore is not enabled.

I suspect this is because the return value of a file uploader is sometimes None and sometimes an instance of class UploadedFile, which is not a string. That causes a problem at seralization time into Firestore.

Workaround: I only call start_tracking() after having instanciated my file_uploader widget, meaning I cannot track any widget that comes before it. Sad, but the only way to make it work so far.

Alternative: adding a conditional to automatically convert the value of file_uploader into a string (containing maybe just the filename, not the whole uploaded file).

444B commented 7 months ago

Comment by jrieke on 2021-12-29 02:05:40+00:00

That's weird, the return value of file uploader is actually never stored in Firestore. I can't test this right now because I don't have an instance of Firestore set up. Maybe this was also fixed with #3. If you see this again, please post the full error message, then I can give it a look!