-
Notifications
You must be signed in to change notification settings - Fork 195
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
Starting app first time without network connection prevents events being pushed to Segment #901
Comments
@simon-westman-uba Hey Simon, this is super detailed and good report, I appreciate the time to test this out. We already have an idea of what's going on, it's not an intended behavior. I put this up on our sprint to get this fixed |
Thank you very much. I will keep an eye out for any upcoming updates and hope you will be able to solve this rather easy. |
Hi @simon-westman-uba apologies for the confusion and/or delay here. As @oscb said, thank you for the detailed report, we really do appreciate it. Can you let me know if this is an issue you're still experiencing? If so, we will prioritize it over the next sprint. Thank you for your patience |
Hi @alanjcharles I do still see this issue as explained above. Thank you for looking into this. |
We are seeing the same issue. It affects our iPhone users in China because they need to accept a special network permission dialog like this before the app having access to the internet. It seems even after the user granted the internet access, the Segment SDK still won't send the events during the app session. @alanjcharles is there any chance this can be prioritized? |
hi folks- apologies for the delays here; we've had some turnover we're working through so we really appreciate your patience. I definitely understand the need to get this prioritized. To get started, can i ask if you have tried the solution we provide here in our readme? It's not super easy to find as it is a
please let me know your thoughts on this and we can go from there. Thanks again! @leethree @simon-westman-uba |
@alanjcharles Hi Alan, thank you for the update. I haven't tried the flush policy but I don't think it will work in our case because if the SDK failed to get the settings from Segment server, it won't send the events when flushing. |
hi @leethree @simon-westman-uba thanks for the follow-ups. I am actively looking into this and have a few things I'd like to discuss.
Thanks, looking forward to hearing from you! |
Hope this helps! |
Hi @leethree Thanks! If I understand your last comment correctly, your issue is not the same as the one initially listed. In the initial post, the issue was the events created during that initial session were never sent to Segment, even when the user did log back into/load the app What you are describing is events from the initial session being sent, just at an undetermined time. I understand that may not be ideal, but there is really nothing we can do to account for that. It is not possible for us to flush or send events to an endpoint if there is no internet connection. Instead, you should manually call Since what you are describing is not actual data loss, I would recommend reaching out to If i have misunderstood and you are experiencing actual data loss (as in the events never make it to Segment) please let me know and we can go from there. Thanks! |
@alanjcharles Thank you so much for looking into this. So I have been testing this again with the following versions:
And I still experience the exact same issue as described in the initial description, on both Android and iOS. I do confirm that the issue still is that the events from the initial launch of the app while offline are lost completely, even after I restart with internet connection. I tested the flush policies method as you described. I did one try with initializing with the flush policies but removing them when network disappears and adding them back when network appears again, just as described in the docs you linked. But since I, for this test, always start without internet I also did one test where I always initialize with passing an empty array to
Both of these tests failed as well, on both Android and iOS, resulting in the same issue where the events from the initial launch are completely lost. Unfortunately I do not have any tips for debugging this. The only way I have managed to reproduce this is by doing a Release build of my app and test it on a physical device, because then I can do it in the following order:
This gets a bit trickier in Debug since you need the JS code to be on the device while being offline. And even if you get the JS code bundled into your build you still need to see the logs. One thing I can think of is to make your computer connect to a Wifi that does not have access to the internet. In that way the Metro bundler should still work on the local network but the app will never have access to the internet. I am not sure if that would produce the same issue/error in the Segment SDK initialization, but could be worth a shot. |
Hi @simon-westman-uba no problem at all, happy to help where I can! Thank you for the detailed overview of your debugging process. It is super helpful. Would you be able to copy your last comment and send it to In an attempt to keep things organized, we are trying to keep reports on this repository to strictly black & white bug reports or enhancements/feature requests. Thanks so much! |
I have noticed that if I install the app, but open it the very first time without any internet connection, so that the Segment SDK gets initialized without internet connection, no events will ever be pushed to Segment for that session, even after I regain internet connection again.
It is first after I restart the app that events are getting into Segment again, but only for the new session after the restart. The events that should have been created and pushed during the very first session that started without internet connection are lost for ever.
I can see these logs when running locally on iOS, which might be related to this issue:
The workaround I currently implemented for this is to check for internet connection before initializing the Segment SDK, and if it is the very first start of the app I do not initialize the SDK until internet connection is available through a network listener.
Any subsequent start of the app, after the Segment SDK has been initialized successfully with internet connection, does work as expected even without internet connection.
Also, I could not find anything about this in the documentation. If this was a known issue I would at least expect the documentation to state "Please make sure to have internet connection the first time you initialize the SDK".
analytics-react-native
version:Both Android and iOS.
Tested on Galaxy S21 5G with Android 13 and iPhone 11 with iOS 17.0.2
Steps to reproduce
Expected behavior
I would expect to see events being pushed to Segment after step 5 since internet connection will be available again at that point.
Actual behavior
No events at all are being pushed to Segment.
I have to restart the app, and only any new events will be pushed after the restart.
The text was updated successfully, but these errors were encountered: