segmentio / analytics-react-native

The hassle-free way to add analytics to your React-Native app.
https://segment.com/docs/sources/mobile/react-native/
MIT License
367 stars 191 forks source link

Queue timeout before completed restoration #973

Closed zgordon02 closed 3 months ago

zgordon02 commented 4 months ago

Screenshot 2024-07-10 at 1 04 04 PM

Steps to reproduce Send various screen and track events

Here is an example screen event I am sending: SCREEN event saved {"name": "TEST_SCREEN", "properties": {"_environment": "LOCAL", "_otaVersion": "N/A"}, "type": "screen"}

Expected behavior No warning Actual behavior This warning appears multiple times per session. However, the events are shown properly in the segment console

zgordon02 commented 4 months ago

Important to note that I have left almost all options to their default:

    segmentClient.current = createClient({
      writeKey: environment?.segmentKey,
      trackAppLifecycleEvents: true,
    });
mayfairr commented 4 months ago

++ Also getting this.

"@segment/analytics-react-native": "^2.17.0",

umairmaqbool3 commented 4 months ago

I am also getting same warnings... checkerror

mcoeur commented 4 months ago

Same here with version 2.19.2. Adding a comment to get notifications on this thread 👌

seanadkinson commented 4 months ago

Also seeing these warnings spewed in my console.

MarkKravchuk commented 4 months ago

Same here, any ideas how to suppress or silence these warnings?

zgordon02 commented 4 months ago

Same here, any ideas how to suppress or silence these warnings?

I have not tried this, but the code should be something like this:

import { LogBox } from 'react-native';
// ...
LogBox.ignoreLogs(["An internal error occurred: Error: Queue timeout before completed restoration"]);

That being said, I would not recommend ignoring the warning. Segment should fix it

leethree commented 4 months ago

I think this is caused by this recent change https://github.com/segmentio/analytics-react-native/pull/943

The QueueFlushingPlugin has a default timeout of 500ms and it will fail if it's not intialized within that time. But in our testing it sometimes takes 2 seconds for the entire thing to be ready. So it will block every events from being sent.

zgordon02 commented 4 months ago

So it will block every events from being sent.

FWIW I have not noticed events dropped while seeing this warning. It appears to be functioning normally

anon-r-7 commented 3 months ago

Also getting this, following.

CoryWritesCode commented 3 months ago

also seeing this after upgrading

itajenglish commented 3 months ago

+1

DAVIS-PYTH commented 3 months ago

Commenting to get updated

itajenglish commented 3 months ago

I think this has been fixed in the last release. I no longer these warnings anymore after updating.

DAVIS-PYTH commented 3 months ago

Thanks @itajenglish

installing version 2.19.4 fixed this for me.

PS: I reached out on LinkedIn

zgordon02 commented 3 months ago

Seeing that others have mentioned it's fixed in the latest release, I'm closing this issue.

dhatGuy commented 3 months ago

It might be related. After upgrading to 2.19.4, I keep getting this in the log

INFO Flush triggered but queue restoration and settings loading not complete. Flush will be retried.

image

DAVIS-PYTH commented 3 months ago

same here with @dhatGuy

zgordon02 commented 3 months ago

@dhatGuy I could repoen this issue, but that warning may be unrelated to this one. Can you create a new issue?

dhatGuy commented 3 months ago

@dhatGuy I could repoen this issue, but that warning may be unrelated to this one. Can you create a new issue?

Yes, I have https://github.com/segmentio/analytics-react-native/issues/989

anon-r-7 commented 3 months ago

+1, also getting "Flush triggered but queue restoration and settings loading not complete. Flush will be retried" only after the upgrade.