Skip to content
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

Persistence queue does not seem to persist between sessions #324

Closed
rafaellehmkuhl opened this issue Dec 6, 2024 · 6 comments
Closed

Persistence queue does not seem to persist between sessions #324

rafaellehmkuhl opened this issue Dec 6, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@rafaellehmkuhl
Copy link

rafaellehmkuhl commented Dec 6, 2024

Bug description

I have an application where I'm implementing event-tracking with PostHog. This application is mainly used offline, as it's a mission app. Users usually go to the field, use it several times while offline, and eventually go back home and open it again, now online.

I use Sentry for error-tracking, and it stores the events in the IndexedDB. I'm trying PostHog for event-tracking, and initially it seemed to have persistence options in the library, but after testing a little bit and reading the docs, it seems like its only persisting configuration and user-data, but not the events queue.

In #176 it is mentioned the existence of an offline queue, but it seems to be working only during the session, this is, if the user comes back online without closing the application, the events in the queue will be sent, but if not, they will be lost when the user closes the application.

I'm opening as a bug report because it seems like an undesired behavior, since for offline-first apps this means losing most of the events, but I understand it can be considered a feature request. No problem if the maintainers see it in that way and change the tags.

As a workaround I'm going to implement the persistence on my side, as I liked PostHog a lot. If you see an opening for merging the feature in this library, let me know.

How to reproduce

  1. Open you application while online
  2. Capture an event
  3. Go offline
  4. Capture a new event
  5. Close you application
  6. Go online
  7. Open your application again
  8. The event that was captured while offline will never appear in the PostHog servers
@rafaellehmkuhl rafaellehmkuhl added the bug Something isn't working label Dec 6, 2024
@rafaellehmkuhl
Copy link
Author

I just realized this repository is not for the currently used JS library, so I've reopened the issue there. Feel free to close it if needed.

@daibhin
Copy link
Contributor

daibhin commented Dec 6, 2024

Hi @rafaellehmkuhl - can I confirm what platform / framework you're trying to include PostHog in?

@mhyassin
Copy link

mhyassin commented Dec 6, 2024

@daibhin Not the author, but we've posthog in react native & it seems like that we're suffering from the same issue, I can't really reproduce it but on our dashboards not all users get merged to their respective anonymous users after being identified

@rafaellehmkuhl
Copy link
Author

rafaellehmkuhl commented Dec 6, 2024

Hi @rafaellehmkuhl - can I confirm what platform / framework you're trying to include PostHog in?

As it's an open source project the entire stack can be checked in the repository, but it's a Vue3 based application written in Typescript.

But I should add that the problem does not seem to be related to Vue since I tried integrating it in pure Typescript and had the same problem.

@marandaneto
Copy link
Member

@daibhin Not the author, but we've posthog in react native & it seems like that we're suffering from the same issue, I can't really reproduce it but on our dashboards not all users get merged to their respective anonymous users after being identified

this seems to be a different issue, please raise a new issue with more context, thanks.

@marandaneto
Copy link
Member

Since this is not RN, closing in favor of PostHog/posthog-js#1583

@marandaneto marandaneto closed this as not planned Won't fix, can't repro, duplicate, stale Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants