PostHog / posthog-js-lite

Reimplementation of posthog-js to be as light and modular as possible.
https://posthog.com/docs/libraries
MIT License
70 stars 36 forks source link

"Possible Unhandled Promise Rejection" when offline #70

Closed SchlagerKhan closed 1 year ago

SchlagerKhan commented 1 year ago

Bug description

Without internet access, the client will eventually warn about an Possible Unhandled Promise Rejection.

I'm guessing this is a minor issue - but still, it is:

  1. A possible risk of misbehavior
  2. Annoying

I at least wish for a way of silencing these warnings, but maybe also a new option property (called onFetchError?) for handling these situations.

How to reproduce

  1. Set the client.options.fetchRetryCount to 0 (optional)
  2. Run a basic local instance of ReactNative that implements PostHogProvider
    • I have only tested on ios simulator, but it should be the same on android.
  3. Turn off the internet on your computer
  4. The warning should appear within a few seconds

Related sub-libraries

Additional context

react-native@0.69.8
posthog-react-native@2.5.0

Thank you for your bug report – we love squashing them!

benjackwhite commented 1 year ago

Thanks for this, fix is on its way

weyert commented 1 year ago

Wouldn't there be a similar issue with posthog-node?

neilkakkar commented 1 year ago

Not after this: https://github.com/PostHog/posthog-js-lite/pull/75