-
Notifications
You must be signed in to change notification settings - Fork 27
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
events.slice
is not a function
#96
Comments
Hello @dvargas92495, I agree that this is a bug, but generally speaking should not be happening (or at least not often) for real users. We will be releasing some new SDKs soon that do not contain this functionality. The reason it generally should not be happening is that we should not be chunking events for platforms that support post. Being as browsers for some time have effectively universally supported post, this likely was missed during testing, with diagnostic events being added at a point where the lack of post support was uncommon. I am concerned though that possibly POST support detection is not working correctly in some situation. Do you have any meta-data for browsers that have been encountering this error? Thank you, |
By this do you mean HTTP We are mainly hitting this during our |
@dvargas92495 HTTP POST support. The detection code for the js-client-sdk is here: https://github.com/launchdarkly/js-client-sdk/blob/8675ab6b0d1a4833e4e140af3658011bf48b2162/src/browserPlatform.js#L24 Technically it is support for CORS, but effectively we wouldn't be able to use HTTP POST from a browser without CORS support. When CORS isn't supported a workaround using HTTP GET is done. |
ah ok I think that gives me what I need - thank you! |
Describe the bug
Intermittently, I'm seeing this line throw a type error bc
events
is not an array, both in the browser and duringjest
testing.To reproduce
I could try to post a minimal reproducible repo if it would help, but I think I see what's going wrong in the code itself:
chunkEventsForUrl
is expectingevents
to be an arrayEventSender.sendEvents
here which is also expectingevents
to be an array.sendDiagnosticEvent
here, which is passing in only a single event to the whole flow, which then triggers theevents.slice
is not a function error. I believe the argument here should be[event]
- it's not clear to me what's sending the diagnostic event based on the traceback.My use case is a bit involved so it would take time to narrow down to a minimal reproducible example, especially since the error triggers non-deterministically. However, I believe the code fix here appears to be straightforward enough without one.
Expected behavior
Launch Darkly sdk to run without erroring
Logs
SDK version
└─┬ launchdarkly-react-client-sdk@3.0.4
└─┬ launchdarkly-js-client-sdk@3.1.2
└── launchdarkly-js-sdk-common@5.0.3
Language version, developer tools
npm -v
8.19.3
node -v
v16.19.0
OS/platform
Mac M1 Apple Silicon
Additional context
N/A
The text was updated successfully, but these errors were encountered: