-
Notifications
You must be signed in to change notification settings - Fork 66
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
LD remote api calls fail when beforeunload event has been triggered #198
Comments
Scanned through the code a bit just now. |
…ities with fstream and tar (#198)
It's possible that #199 has resolved this, but I think it's not totally clear whether that is the same issue. Please let me know how things look with the latest release. |
The patch I did has had a very positive impact on this. So far the only errors we have tracked that I believe is related to this are from clients that has not yet updated the latest version. I have not discovered any errors originating from versions that includes the patch. |
@edvinerikson I didn't realize until yesterday that the support request I've been working on, involving some analytics stats that seemed to be out of line with the configured rollout percentages, was for your company. If I had, I would've asked you for some additional details that might've helped to clarify whether that issue is really the same as this one. Specifically: is the behavior you're describing, where the app navigates to a "bankid://" URL, something that only happens for certain users based on a feature flag— and if so, do you know whether that is the same large group of users that was being under-represented in the analytics? If so, that semi-confirms a hunch we had, but I'm still a little confused about why the impact would be so large. The fix in #199 was for a situation where the SDK would continue making all of its HTTP requests synchronously when it should have gone back to the default async behavior. That's desirable, but I would have still expected the unnecessary sync requests to work— I'm not sure why they would fail, causing identify() calls not to work and event data to be lost. |
We are not sure if the percentage rollout issue is caused by this. I am slightly suspecting that it might be as it's a fairly large user base that "lost connection" to launchdarkly. The reason those calls fail is because there is a special case added in the httpRequest function that simply prevents any chromium browser above version 73 to make synchronous api calls. It's that condition that a majority of our user base got hit by. https://github.com/launchdarkly/js-client-sdk/blob/master/src/httpRequest.js#L22 |
@edvinerikson Ohhhhhhhh... yes, I see. The reason for that conditional behavior is that Chrome doesn't support sync HTTP when the page is closing (they expect you to use the Beacon API instead), and we were assuming that we would only be trying to make sync HTTP requests when the page is closing. That explains it. Thanks. Note that this means our "try to send the events at the last minute if the page is closing" logic doesn't really accomplish anything in Chrome now; our goal is to use the Beacon API, but we had run into some snags with that. So the current behavior is a compromise. |
Would it make sense to attempt doing a asynchronous request in this scenario? IMO it's better than just aborting, but I am not sure what side-effects that could have. |
The possible side effect would probably just be that it wouldn't accomplish anything— the page would almost always close too fast for the request to actually happen. And you might get an error message in the console, which is probably not a problem because even if someone has monitoring set up that would cause annoying alerts when there's a console error, it probably would not get to send an alert for the same reason (the page closes too fast). So, yes, until we can get Beacon to work, it might make sense to fall back to async for this. |
* change HTTP response handling to avoid CORS header errors * don't use Promise.finally() * allow Electron and Node SDKs to report their own SDK version * apply markdown templates * markdown fixes * rename package ids * add new JS SDK test/demo page * misc doc edits * fixing merge error * fixing merge error * fix broken links on npmjs.com (#193) * update lockfiles for new packages * fix changelog formatting error that messes up the release script * Specify unpkg default target file in package.json for launchdarkly-js-client-sdk and launchdarkly-js-sdk-common. * Correct requestor call to fetch flags on a received ping event. * Implement Hooks API (#196) * Initial commit reusing withLDProvider * Added sitenav. Cleaned up filenames. * Updated readme with hooks api docs. Fixed linting errors. * Fixed linting errors. * Update README.md * bumping our lerna version to resolve transitive dependency vulnerabilities with fstream and tar (#198) * fix goals query logic for Electron, also fix handling of invalid content type * add ability to alter URL in events * Update browserPlatform definition to detect when an EventSource polyfill is available and has published that it supports setting the method used for the stream. When this is the case, the platform publishes that it supports using REPORT with EventSource and will provide the polyfill implementation if the SDK attempts a EventSource connection with the method set to REPORT. * Fix initial linter warnings. * Fix another linter warning. * fix a broken readme link (#202) * removing a stray character in the readme * fix stream reconnect logic and add stream connection logging * linter * assume logger always exists, as we do in other components * fix and simplify how the logger object is passed around * make it so eventUrlTransformer actually does something * linter * copy flags object to prevent subtle update problem in Electron * additional fix + test * make bootstrapped flags available immediately * Refactor some of the EventSource constructor selection logic. * Change browserPlatform.js to check config options when determining EventSource implementation to use. Added tests for EventSource factory in browserPlatform.js * Deal with linter. * change how supported options are detected in EventSource polyfill * fix broken homepage attributes (#209) * improve bad initialization messages (#210) * improve bad initialization messages * remove the spaces * fixing a broken link in a logged message (#212) * add jsdelivr attribute to js packages (#213) * adding an option to disable the camel-casing of flag keys (#214) * adding an option disabling the camel-casing of flag keys * update comment * update comment * fix linter errors * address pr feedback * updated readme * [ch45487] useCamelCaseFlagKeys option (#215) * Initial commit * Update initLDClient.ts * PR fixes. Added prettier. * Update withLDProvider.test.tsx * Fixed lint errors. Added test for useCamelCase false on server changes. * Removed prettier. * Re-added prettier * Update yarn.lock * Update prettier and lock files. * Fixed more linting issues. * fix a typo * use persistent anonymous user logic by default in react sdk (#216) * use persistent anonymous user logic by default in react sdk * added a comment * minor test change * missed a line * remove React package from monorepo * make link text match link * improve log format and add configurable prefix * fix test * linter * deprecate samplingInterval * linter * improve log message for stream connection failures (#221) * improve log message for stream connection failures * update the reconnection warning so that it only displays for the first set of each reconnection attempts * also test that the original put is getting called * updating tests * updating tests * Revert "updating tests" This reverts commit 84163cdf8b5af6a6e969d777b946a8a2973919ed. * better abstraction * minor change * updating the js-common readme to mention client-side node (#222) * remove common package, no more monorepo * add Releaser metadata * npm audit fix * unify Rollup config * migrate new demo code to new package structure * moved example folder * syntax fix in demo * fix directory name * fix linting * use spread operator instead of Object.assign * don't close client on beforeunload, but do flush events * typo * clarify test postconditions * misc test app improvements for testing beforeunload handler * rm unused yarn.lock * rm typedoc dependency, don't commit installation of it during release * fix paths * fix file copying logic * pr template * revert * fix programmatically reported version string * upgrade Typescript to avoid Typedoc incompatibility * Revert "upgrade Typescript to avoid Typedoc incompatibility" This reverts commit 34d9a0f. * update Babel, Jest, Rollup * remove old releaser (#229) * remove unused Rollup plugins, update dependencies * use new config validation mechanism in js-sdk-common 3.x * add image-loading event delivery logic factored out of js-sdk-common * enable diagnostic events in JS SDK * lint * fix tests * use common 3.0.0-beta2 * use 3.1.0-beta3, fix property name * lint * use js-sdk-common 3.1.0 * use js-sdk-common 3.1.1 for event payload ID fix * use js-sdk-common 3.1.2 and loosen our other dependency * fix license * use js-sdk-common 3.2.0-beta1 * SDK name should be js-client-sdk * misc fixes * use js-sdk-common 3.2.0 * use js-sdk-common 3.2.0 * standardize linting * use js-sdk-common 3.2.1 * use js-sdk-common 3.2.2 * update package-lock * update js-sdk-common dependency for initialization error bugfix * update js-sdk-common for content type bugfix; update some dev dependencies * remove unsafe usage of hasOwnProperty * use js-sdk-common 3.2.5 * resolve security vulnerability in acorn dependency (#240) * update js-sdk-common to get console logging IE bugfix * update js-sdk-common for duplicate diagnostic event fix * update js-sdk-common for TS decl fix, improve TS compilation test (#243) * bump to 3.2.9 to get startsWith fix (#244) * add option to disable sync event flush (#245) * update js-sdk-common + some dev dependencies * No longer remove non-section hash in substring and regex matching * linting * the linting target to run in CI is "lint:all", not "lint" * new js-common-sdk version (#249) * resolve node-notifier vulnerability by updating jest dep (#250) * adding contextKind to goal events, bumping js-common to get alias function (#251) * pin typedoc to unblock our releases (#252) * Removed the guides link * add inlineUsersToEvents to TypeScript defs by updating js-sdk-common * Update common JS SDK library to use fixes for debug event generation issues. * Update package lock. * use Releaser v2 config + newer CI image (#256) * Updated readme headers (#258) * don't log a warning about custom goal being unknown * lint + comment * Release js-client-sdk with the header transformation change * Updates docs link * bump js-sdk-common version for better localstorage error handling * Update launchdarkly-js-sdk-common for JSON error handling fix (sc-142333) * update lockfile Co-authored-by: Eli Bishop <eli@launchdarkly.com> Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com> Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com> Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com> Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com> Co-authored-by: Yusinto Ngadiman <yusinto@gmail.com> Co-authored-by: Zach Davis <zach@launchdarkly.com> Co-authored-by: Elliot <35050275+Apache-HB@users.noreply.github.com> Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com> Co-authored-by: Louis Chan <lchan@launchdarkly.com> Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com> Co-authored-by: Ember Stevens <ember.stevens@launchdarkly.com> Co-authored-by: ember-stevens <79482775+ember-stevens@users.noreply.github.com>
* don't use Promise.finally() * allow Electron and Node SDKs to report their own SDK version * apply markdown templates * markdown fixes * rename package ids * add new JS SDK test/demo page * misc doc edits * fixing merge error * fixing merge error * fix broken links on npmjs.com (#193) * update lockfiles for new packages * fix changelog formatting error that messes up the release script * Specify unpkg default target file in package.json for launchdarkly-js-client-sdk and launchdarkly-js-sdk-common. * Correct requestor call to fetch flags on a received ping event. * Implement Hooks API (#196) * Initial commit reusing withLDProvider * Added sitenav. Cleaned up filenames. * Updated readme with hooks api docs. Fixed linting errors. * Fixed linting errors. * Update README.md * bumping our lerna version to resolve transitive dependency vulnerabilities with fstream and tar (#198) * fix goals query logic for Electron, also fix handling of invalid content type * add ability to alter URL in events * Update browserPlatform definition to detect when an EventSource polyfill is available and has published that it supports setting the method used for the stream. When this is the case, the platform publishes that it supports using REPORT with EventSource and will provide the polyfill implementation if the SDK attempts a EventSource connection with the method set to REPORT. * Fix initial linter warnings. * Fix another linter warning. * fix a broken readme link (#202) * removing a stray character in the readme * fix stream reconnect logic and add stream connection logging * linter * assume logger always exists, as we do in other components * fix and simplify how the logger object is passed around * make it so eventUrlTransformer actually does something * linter * copy flags object to prevent subtle update problem in Electron * additional fix + test * make bootstrapped flags available immediately * Refactor some of the EventSource constructor selection logic. * Change browserPlatform.js to check config options when determining EventSource implementation to use. Added tests for EventSource factory in browserPlatform.js * Deal with linter. * change how supported options are detected in EventSource polyfill * fix broken homepage attributes (#209) * improve bad initialization messages (#210) * improve bad initialization messages * remove the spaces * fixing a broken link in a logged message (#212) * add jsdelivr attribute to js packages (#213) * adding an option to disable the camel-casing of flag keys (#214) * adding an option disabling the camel-casing of flag keys * update comment * update comment * fix linter errors * address pr feedback * updated readme * [ch45487] useCamelCaseFlagKeys option (#215) * Initial commit * Update initLDClient.ts * PR fixes. Added prettier. * Update withLDProvider.test.tsx * Fixed lint errors. Added test for useCamelCase false on server changes. * Removed prettier. * Re-added prettier * Update yarn.lock * Update prettier and lock files. * Fixed more linting issues. * fix a typo * use persistent anonymous user logic by default in react sdk (#216) * use persistent anonymous user logic by default in react sdk * added a comment * minor test change * missed a line * remove React package from monorepo * make link text match link * improve log format and add configurable prefix * fix test * linter * deprecate samplingInterval * linter * improve log message for stream connection failures (#221) * improve log message for stream connection failures * update the reconnection warning so that it only displays for the first set of each reconnection attempts * also test that the original put is getting called * updating tests * updating tests * Revert "updating tests" This reverts commit 84163cdf8b5af6a6e969d777b946a8a2973919ed. * better abstraction * minor change * updating the js-common readme to mention client-side node (#222) * remove common package, no more monorepo * add Releaser metadata * npm audit fix * unify Rollup config * migrate new demo code to new package structure * moved example folder * syntax fix in demo * fix directory name * fix linting * use spread operator instead of Object.assign * don't close client on beforeunload, but do flush events * typo * clarify test postconditions * misc test app improvements for testing beforeunload handler * rm unused yarn.lock * rm typedoc dependency, don't commit installation of it during release * fix paths * fix file copying logic * pr template * revert * fix programmatically reported version string * upgrade Typescript to avoid Typedoc incompatibility * Revert "upgrade Typescript to avoid Typedoc incompatibility" This reverts commit 34d9a0f. * update Babel, Jest, Rollup * remove old releaser (#229) * remove unused Rollup plugins, update dependencies * use new config validation mechanism in js-sdk-common 3.x * add image-loading event delivery logic factored out of js-sdk-common * enable diagnostic events in JS SDK * lint * fix tests * use common 3.0.0-beta2 * use 3.1.0-beta3, fix property name * lint * use js-sdk-common 3.1.0 * use js-sdk-common 3.1.1 for event payload ID fix * use js-sdk-common 3.1.2 and loosen our other dependency * fix license * use js-sdk-common 3.2.0-beta1 * SDK name should be js-client-sdk * misc fixes * use js-sdk-common 3.2.0 * use js-sdk-common 3.2.0 * standardize linting * use js-sdk-common 3.2.1 * use js-sdk-common 3.2.2 * update package-lock * update js-sdk-common dependency for initialization error bugfix * update js-sdk-common for content type bugfix; update some dev dependencies * remove unsafe usage of hasOwnProperty * use js-sdk-common 3.2.5 * resolve security vulnerability in acorn dependency (#240) * update js-sdk-common to get console logging IE bugfix * update js-sdk-common for duplicate diagnostic event fix * update js-sdk-common for TS decl fix, improve TS compilation test (#243) * bump to 3.2.9 to get startsWith fix (#244) * add option to disable sync event flush (#245) * update js-sdk-common + some dev dependencies * No longer remove non-section hash in substring and regex matching * linting * the linting target to run in CI is "lint:all", not "lint" * new js-common-sdk version (#249) * resolve node-notifier vulnerability by updating jest dep (#250) * adding contextKind to goal events, bumping js-common to get alias function (#251) * pin typedoc to unblock our releases (#252) * Removed the guides link * add inlineUsersToEvents to TypeScript defs by updating js-sdk-common * Update common JS SDK library to use fixes for debug event generation issues. * Update package lock. * use Releaser v2 config + newer CI image (#256) * Updated readme headers (#258) * don't log a warning about custom goal being unknown * lint + comment * Release js-client-sdk with the header transformation change * Updates docs link * bump js-sdk-common version for better localstorage error handling * Update launchdarkly-js-sdk-common for JSON error handling fix (sc-142333) * update lockfile * add basicLogger export Co-authored-by: Eli Bishop <eli@launchdarkly.com> Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com> Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com> Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com> Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com> Co-authored-by: Yusinto Ngadiman <yusinto@gmail.com> Co-authored-by: Zach Davis <zach@launchdarkly.com> Co-authored-by: Elliot <35050275+Apache-HB@users.noreply.github.com> Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com> Co-authored-by: Louis Chan <lchan@launchdarkly.com> Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com> Co-authored-by: Ember Stevens <ember.stevens@launchdarkly.com> Co-authored-by: ember-stevens <79482775+ember-stevens@users.noreply.github.com>
* apply markdown templates * markdown fixes * rename package ids * add new JS SDK test/demo page * misc doc edits * fixing merge error * fixing merge error * fix broken links on npmjs.com (#193) * update lockfiles for new packages * fix changelog formatting error that messes up the release script * Specify unpkg default target file in package.json for launchdarkly-js-client-sdk and launchdarkly-js-sdk-common. * Correct requestor call to fetch flags on a received ping event. * Implement Hooks API (#196) * Initial commit reusing withLDProvider * Added sitenav. Cleaned up filenames. * Updated readme with hooks api docs. Fixed linting errors. * Fixed linting errors. * Update README.md * bumping our lerna version to resolve transitive dependency vulnerabilities with fstream and tar (#198) * fix goals query logic for Electron, also fix handling of invalid content type * add ability to alter URL in events * Update browserPlatform definition to detect when an EventSource polyfill is available and has published that it supports setting the method used for the stream. When this is the case, the platform publishes that it supports using REPORT with EventSource and will provide the polyfill implementation if the SDK attempts a EventSource connection with the method set to REPORT. * Fix initial linter warnings. * Fix another linter warning. * fix a broken readme link (#202) * removing a stray character in the readme * fix stream reconnect logic and add stream connection logging * linter * assume logger always exists, as we do in other components * fix and simplify how the logger object is passed around * make it so eventUrlTransformer actually does something * linter * copy flags object to prevent subtle update problem in Electron * additional fix + test * make bootstrapped flags available immediately * Refactor some of the EventSource constructor selection logic. * Change browserPlatform.js to check config options when determining EventSource implementation to use. Added tests for EventSource factory in browserPlatform.js * Deal with linter. * change how supported options are detected in EventSource polyfill * fix broken homepage attributes (#209) * improve bad initialization messages (#210) * improve bad initialization messages * remove the spaces * fixing a broken link in a logged message (#212) * add jsdelivr attribute to js packages (#213) * adding an option to disable the camel-casing of flag keys (#214) * adding an option disabling the camel-casing of flag keys * update comment * update comment * fix linter errors * address pr feedback * updated readme * [ch45487] useCamelCaseFlagKeys option (#215) * Initial commit * Update initLDClient.ts * PR fixes. Added prettier. * Update withLDProvider.test.tsx * Fixed lint errors. Added test for useCamelCase false on server changes. * Removed prettier. * Re-added prettier * Update yarn.lock * Update prettier and lock files. * Fixed more linting issues. * fix a typo * use persistent anonymous user logic by default in react sdk (#216) * use persistent anonymous user logic by default in react sdk * added a comment * minor test change * missed a line * remove React package from monorepo * make link text match link * improve log format and add configurable prefix * fix test * linter * deprecate samplingInterval * linter * improve log message for stream connection failures (#221) * improve log message for stream connection failures * update the reconnection warning so that it only displays for the first set of each reconnection attempts * also test that the original put is getting called * updating tests * updating tests * Revert "updating tests" This reverts commit 84163cdf8b5af6a6e969d777b946a8a2973919ed. * better abstraction * minor change * updating the js-common readme to mention client-side node (#222) * remove common package, no more monorepo * add Releaser metadata * npm audit fix * unify Rollup config * migrate new demo code to new package structure * moved example folder * syntax fix in demo * fix directory name * fix linting * use spread operator instead of Object.assign * don't close client on beforeunload, but do flush events * typo * clarify test postconditions * misc test app improvements for testing beforeunload handler * rm unused yarn.lock * rm typedoc dependency, don't commit installation of it during release * fix paths * fix file copying logic * pr template * revert * fix programmatically reported version string * upgrade Typescript to avoid Typedoc incompatibility * Revert "upgrade Typescript to avoid Typedoc incompatibility" This reverts commit 34d9a0f. * update Babel, Jest, Rollup * remove old releaser (#229) * remove unused Rollup plugins, update dependencies * use new config validation mechanism in js-sdk-common 3.x * add image-loading event delivery logic factored out of js-sdk-common * enable diagnostic events in JS SDK * lint * fix tests * use common 3.0.0-beta2 * use 3.1.0-beta3, fix property name * lint * use js-sdk-common 3.1.0 * use js-sdk-common 3.1.1 for event payload ID fix * use js-sdk-common 3.1.2 and loosen our other dependency * fix license * use js-sdk-common 3.2.0-beta1 * SDK name should be js-client-sdk * misc fixes * use js-sdk-common 3.2.0 * use js-sdk-common 3.2.0 * standardize linting * use js-sdk-common 3.2.1 * use js-sdk-common 3.2.2 * update package-lock * update js-sdk-common dependency for initialization error bugfix * update js-sdk-common for content type bugfix; update some dev dependencies * remove unsafe usage of hasOwnProperty * use js-sdk-common 3.2.5 * resolve security vulnerability in acorn dependency (#240) * update js-sdk-common to get console logging IE bugfix * update js-sdk-common for duplicate diagnostic event fix * update js-sdk-common for TS decl fix, improve TS compilation test (#243) * bump to 3.2.9 to get startsWith fix (#244) * add option to disable sync event flush (#245) * update js-sdk-common + some dev dependencies * No longer remove non-section hash in substring and regex matching * linting * the linting target to run in CI is "lint:all", not "lint" * new js-common-sdk version (#249) * resolve node-notifier vulnerability by updating jest dep (#250) * adding contextKind to goal events, bumping js-common to get alias function (#251) * pin typedoc to unblock our releases (#252) * Removed the guides link * add inlineUsersToEvents to TypeScript defs by updating js-sdk-common * Update common JS SDK library to use fixes for debug event generation issues. * Update package lock. * use Releaser v2 config + newer CI image (#256) * Updated readme headers (#258) * don't log a warning about custom goal being unknown * lint + comment * Release js-client-sdk with the header transformation change * Updates docs link * bump js-sdk-common version for better localstorage error handling * Update launchdarkly-js-sdk-common for JSON error handling fix (sc-142333) * update lockfile * add basicLogger export * Update common for application tags support. (#265) * Re-remove package-lock.json and add it to the .gitignore. (#266) Co-authored-by: Eli Bishop <eli@launchdarkly.com> Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com> Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com> Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com> Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com> Co-authored-by: Yusinto Ngadiman <yusinto@gmail.com> Co-authored-by: Zach Davis <zach@launchdarkly.com> Co-authored-by: Elliot <35050275+Apache-HB@users.noreply.github.com> Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com> Co-authored-by: Louis Chan <lchan@launchdarkly.com> Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com> Co-authored-by: Ember Stevens <ember.stevens@launchdarkly.com> Co-authored-by: ember-stevens <79482775+ember-stevens@users.noreply.github.com> Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
* add new JS SDK test/demo page * misc doc edits * fixing merge error * fixing merge error * fix broken links on npmjs.com (#193) * update lockfiles for new packages * fix changelog formatting error that messes up the release script * Specify unpkg default target file in package.json for launchdarkly-js-client-sdk and launchdarkly-js-sdk-common. * Correct requestor call to fetch flags on a received ping event. * Implement Hooks API (#196) * Initial commit reusing withLDProvider * Added sitenav. Cleaned up filenames. * Updated readme with hooks api docs. Fixed linting errors. * Fixed linting errors. * Update README.md * bumping our lerna version to resolve transitive dependency vulnerabilities with fstream and tar (#198) * fix goals query logic for Electron, also fix handling of invalid content type * add ability to alter URL in events * Update browserPlatform definition to detect when an EventSource polyfill is available and has published that it supports setting the method used for the stream. When this is the case, the platform publishes that it supports using REPORT with EventSource and will provide the polyfill implementation if the SDK attempts a EventSource connection with the method set to REPORT. * Fix initial linter warnings. * Fix another linter warning. * fix a broken readme link (#202) * removing a stray character in the readme * fix stream reconnect logic and add stream connection logging * linter * assume logger always exists, as we do in other components * fix and simplify how the logger object is passed around * make it so eventUrlTransformer actually does something * linter * copy flags object to prevent subtle update problem in Electron * additional fix + test * make bootstrapped flags available immediately * Refactor some of the EventSource constructor selection logic. * Change browserPlatform.js to check config options when determining EventSource implementation to use. Added tests for EventSource factory in browserPlatform.js * Deal with linter. * change how supported options are detected in EventSource polyfill * fix broken homepage attributes (#209) * improve bad initialization messages (#210) * improve bad initialization messages * remove the spaces * fixing a broken link in a logged message (#212) * add jsdelivr attribute to js packages (#213) * adding an option to disable the camel-casing of flag keys (#214) * adding an option disabling the camel-casing of flag keys * update comment * update comment * fix linter errors * address pr feedback * updated readme * [ch45487] useCamelCaseFlagKeys option (#215) * Initial commit * Update initLDClient.ts * PR fixes. Added prettier. * Update withLDProvider.test.tsx * Fixed lint errors. Added test for useCamelCase false on server changes. * Removed prettier. * Re-added prettier * Update yarn.lock * Update prettier and lock files. * Fixed more linting issues. * fix a typo * use persistent anonymous user logic by default in react sdk (#216) * use persistent anonymous user logic by default in react sdk * added a comment * minor test change * missed a line * remove React package from monorepo * make link text match link * improve log format and add configurable prefix * fix test * linter * deprecate samplingInterval * linter * improve log message for stream connection failures (#221) * improve log message for stream connection failures * update the reconnection warning so that it only displays for the first set of each reconnection attempts * also test that the original put is getting called * updating tests * updating tests * Revert "updating tests" This reverts commit 84163cdf8b5af6a6e969d777b946a8a2973919ed. * better abstraction * minor change * updating the js-common readme to mention client-side node (#222) * remove common package, no more monorepo * add Releaser metadata * npm audit fix * unify Rollup config * migrate new demo code to new package structure * moved example folder * syntax fix in demo * fix directory name * fix linting * use spread operator instead of Object.assign * don't close client on beforeunload, but do flush events * typo * clarify test postconditions * misc test app improvements for testing beforeunload handler * rm unused yarn.lock * rm typedoc dependency, don't commit installation of it during release * fix paths * fix file copying logic * pr template * revert * fix programmatically reported version string * upgrade Typescript to avoid Typedoc incompatibility * Revert "upgrade Typescript to avoid Typedoc incompatibility" This reverts commit 34d9a0f. * update Babel, Jest, Rollup * remove old releaser (#229) * remove unused Rollup plugins, update dependencies * use new config validation mechanism in js-sdk-common 3.x * add image-loading event delivery logic factored out of js-sdk-common * enable diagnostic events in JS SDK * lint * fix tests * use common 3.0.0-beta2 * use 3.1.0-beta3, fix property name * lint * use js-sdk-common 3.1.0 * use js-sdk-common 3.1.1 for event payload ID fix * use js-sdk-common 3.1.2 and loosen our other dependency * fix license * use js-sdk-common 3.2.0-beta1 * SDK name should be js-client-sdk * misc fixes * use js-sdk-common 3.2.0 * use js-sdk-common 3.2.0 * standardize linting * use js-sdk-common 3.2.1 * use js-sdk-common 3.2.2 * update package-lock * update js-sdk-common dependency for initialization error bugfix * update js-sdk-common for content type bugfix; update some dev dependencies * remove unsafe usage of hasOwnProperty * use js-sdk-common 3.2.5 * resolve security vulnerability in acorn dependency (#240) * update js-sdk-common to get console logging IE bugfix * update js-sdk-common for duplicate diagnostic event fix * update js-sdk-common for TS decl fix, improve TS compilation test (#243) * bump to 3.2.9 to get startsWith fix (#244) * add option to disable sync event flush (#245) * update js-sdk-common + some dev dependencies * No longer remove non-section hash in substring and regex matching * linting * the linting target to run in CI is "lint:all", not "lint" * new js-common-sdk version (#249) * resolve node-notifier vulnerability by updating jest dep (#250) * adding contextKind to goal events, bumping js-common to get alias function (#251) * pin typedoc to unblock our releases (#252) * Removed the guides link * add inlineUsersToEvents to TypeScript defs by updating js-sdk-common * Update common JS SDK library to use fixes for debug event generation issues. * Update package lock. * use Releaser v2 config + newer CI image (#256) * Updated readme headers (#258) * don't log a warning about custom goal being unknown * lint + comment * Release js-client-sdk with the header transformation change * Updates docs link * bump js-sdk-common version for better localstorage error handling * Update launchdarkly-js-sdk-common for JSON error handling fix (sc-142333) * update lockfile * add basicLogger export * Update common for application tags support. (#265) * Re-remove package-lock.json and add it to the .gitignore. (#266) * Use a combination of dependencies that is compatible. (#269) (#270) * Update js-sdk-common to 3.7.0 (#271) Co-authored-by: Eli Bishop <eli@launchdarkly.com> Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com> Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com> Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com> Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com> Co-authored-by: Yusinto Ngadiman <yusinto@gmail.com> Co-authored-by: Zach Davis <zach@launchdarkly.com> Co-authored-by: Elliot <35050275+Apache-HB@users.noreply.github.com> Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com> Co-authored-by: Louis Chan <lchan@launchdarkly.com> Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com> Co-authored-by: Ember Stevens <ember.stevens@launchdarkly.com> Co-authored-by: ember-stevens <79482775+ember-stevens@users.noreply.github.com> Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
* fixing merge error * fixing merge error * fix broken links on npmjs.com (#193) * update lockfiles for new packages * fix changelog formatting error that messes up the release script * Specify unpkg default target file in package.json for launchdarkly-js-client-sdk and launchdarkly-js-sdk-common. * Correct requestor call to fetch flags on a received ping event. * Implement Hooks API (#196) * Initial commit reusing withLDProvider * Added sitenav. Cleaned up filenames. * Updated readme with hooks api docs. Fixed linting errors. * Fixed linting errors. * Update README.md * bumping our lerna version to resolve transitive dependency vulnerabilities with fstream and tar (#198) * fix goals query logic for Electron, also fix handling of invalid content type * add ability to alter URL in events * Update browserPlatform definition to detect when an EventSource polyfill is available and has published that it supports setting the method used for the stream. When this is the case, the platform publishes that it supports using REPORT with EventSource and will provide the polyfill implementation if the SDK attempts a EventSource connection with the method set to REPORT. * Fix initial linter warnings. * Fix another linter warning. * fix a broken readme link (#202) * removing a stray character in the readme * fix stream reconnect logic and add stream connection logging * linter * assume logger always exists, as we do in other components * fix and simplify how the logger object is passed around * make it so eventUrlTransformer actually does something * linter * copy flags object to prevent subtle update problem in Electron * additional fix + test * make bootstrapped flags available immediately * Refactor some of the EventSource constructor selection logic. * Change browserPlatform.js to check config options when determining EventSource implementation to use. Added tests for EventSource factory in browserPlatform.js * Deal with linter. * change how supported options are detected in EventSource polyfill * fix broken homepage attributes (#209) * improve bad initialization messages (#210) * improve bad initialization messages * remove the spaces * fixing a broken link in a logged message (#212) * add jsdelivr attribute to js packages (#213) * adding an option to disable the camel-casing of flag keys (#214) * adding an option disabling the camel-casing of flag keys * update comment * update comment * fix linter errors * address pr feedback * updated readme * [ch45487] useCamelCaseFlagKeys option (#215) * Initial commit * Update initLDClient.ts * PR fixes. Added prettier. * Update withLDProvider.test.tsx * Fixed lint errors. Added test for useCamelCase false on server changes. * Removed prettier. * Re-added prettier * Update yarn.lock * Update prettier and lock files. * Fixed more linting issues. * fix a typo * use persistent anonymous user logic by default in react sdk (#216) * use persistent anonymous user logic by default in react sdk * added a comment * minor test change * missed a line * remove React package from monorepo * make link text match link * improve log format and add configurable prefix * fix test * linter * deprecate samplingInterval * linter * improve log message for stream connection failures (#221) * improve log message for stream connection failures * update the reconnection warning so that it only displays for the first set of each reconnection attempts * also test that the original put is getting called * updating tests * updating tests * Revert "updating tests" This reverts commit 84163cdf8b5af6a6e969d777b946a8a2973919ed. * better abstraction * minor change * updating the js-common readme to mention client-side node (#222) * remove common package, no more monorepo * add Releaser metadata * npm audit fix * unify Rollup config * migrate new demo code to new package structure * moved example folder * syntax fix in demo * fix directory name * fix linting * use spread operator instead of Object.assign * don't close client on beforeunload, but do flush events * typo * clarify test postconditions * misc test app improvements for testing beforeunload handler * rm unused yarn.lock * rm typedoc dependency, don't commit installation of it during release * fix paths * fix file copying logic * pr template * revert * fix programmatically reported version string * upgrade Typescript to avoid Typedoc incompatibility * Revert "upgrade Typescript to avoid Typedoc incompatibility" This reverts commit 34d9a0f. * update Babel, Jest, Rollup * remove old releaser (#229) * remove unused Rollup plugins, update dependencies * use new config validation mechanism in js-sdk-common 3.x * add image-loading event delivery logic factored out of js-sdk-common * enable diagnostic events in JS SDK * lint * fix tests * use common 3.0.0-beta2 * use 3.1.0-beta3, fix property name * lint * use js-sdk-common 3.1.0 * use js-sdk-common 3.1.1 for event payload ID fix * use js-sdk-common 3.1.2 and loosen our other dependency * fix license * use js-sdk-common 3.2.0-beta1 * SDK name should be js-client-sdk * misc fixes * use js-sdk-common 3.2.0 * use js-sdk-common 3.2.0 * standardize linting * use js-sdk-common 3.2.1 * use js-sdk-common 3.2.2 * update package-lock * update js-sdk-common dependency for initialization error bugfix * update js-sdk-common for content type bugfix; update some dev dependencies * remove unsafe usage of hasOwnProperty * use js-sdk-common 3.2.5 * resolve security vulnerability in acorn dependency (#240) * update js-sdk-common to get console logging IE bugfix * update js-sdk-common for duplicate diagnostic event fix * update js-sdk-common for TS decl fix, improve TS compilation test (#243) * bump to 3.2.9 to get startsWith fix (#244) * add option to disable sync event flush (#245) * update js-sdk-common + some dev dependencies * No longer remove non-section hash in substring and regex matching * linting * the linting target to run in CI is "lint:all", not "lint" * new js-common-sdk version (#249) * resolve node-notifier vulnerability by updating jest dep (#250) * adding contextKind to goal events, bumping js-common to get alias function (#251) * pin typedoc to unblock our releases (#252) * Removed the guides link * add inlineUsersToEvents to TypeScript defs by updating js-sdk-common * Update common JS SDK library to use fixes for debug event generation issues. * Update package lock. * use Releaser v2 config + newer CI image (#256) * Updated readme headers (#258) * don't log a warning about custom goal being unknown * lint + comment * Release js-client-sdk with the header transformation change * Updates docs link * bump js-sdk-common version for better localstorage error handling * Update launchdarkly-js-sdk-common for JSON error handling fix (sc-142333) * update lockfile * add basicLogger export * Update common for application tags support. (#265) * Re-remove package-lock.json and add it to the .gitignore. (#266) * Use a combination of dependencies that is compatible. (#269) (#270) * Update js-sdk-common to 3.7.0 (#271) * Update node version used during release. (#272) * Update common to 3.8.1 (#273) Co-authored-by: Eli Bishop <eli@launchdarkly.com> Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com> Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com> Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com> Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com> Co-authored-by: Yusinto Ngadiman <yusinto@gmail.com> Co-authored-by: Zach Davis <zach@launchdarkly.com> Co-authored-by: Elliot <35050275+Apache-HB@users.noreply.github.com> Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com> Co-authored-by: Louis Chan <lchan@launchdarkly.com> Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com> Co-authored-by: Ember Stevens <ember.stevens@launchdarkly.com> Co-authored-by: ember-stevens <79482775+ember-stevens@users.noreply.github.com> Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
* fixing merge error * fixing merge error * fix broken links on npmjs.com (#193) * update lockfiles for new packages * fix changelog formatting error that messes up the release script * Specify unpkg default target file in package.json for launchdarkly-js-client-sdk and launchdarkly-js-sdk-common. * Correct requestor call to fetch flags on a received ping event. * Implement Hooks API (#196) * Initial commit reusing withLDProvider * Added sitenav. Cleaned up filenames. * Updated readme with hooks api docs. Fixed linting errors. * Fixed linting errors. * Update README.md * bumping our lerna version to resolve transitive dependency vulnerabilities with fstream and tar (#198) * fix goals query logic for Electron, also fix handling of invalid content type * add ability to alter URL in events * Update browserPlatform definition to detect when an EventSource polyfill is available and has published that it supports setting the method used for the stream. When this is the case, the platform publishes that it supports using REPORT with EventSource and will provide the polyfill implementation if the SDK attempts a EventSource connection with the method set to REPORT. * Fix initial linter warnings. * Fix another linter warning. * fix a broken readme link (#202) * removing a stray character in the readme * fix stream reconnect logic and add stream connection logging * linter * assume logger always exists, as we do in other components * fix and simplify how the logger object is passed around * make it so eventUrlTransformer actually does something * linter * copy flags object to prevent subtle update problem in Electron * additional fix + test * make bootstrapped flags available immediately * Refactor some of the EventSource constructor selection logic. * Change browserPlatform.js to check config options when determining EventSource implementation to use. Added tests for EventSource factory in browserPlatform.js * Deal with linter. * change how supported options are detected in EventSource polyfill * fix broken homepage attributes (#209) * improve bad initialization messages (#210) * improve bad initialization messages * remove the spaces * fixing a broken link in a logged message (#212) * add jsdelivr attribute to js packages (#213) * adding an option to disable the camel-casing of flag keys (#214) * adding an option disabling the camel-casing of flag keys * update comment * update comment * fix linter errors * address pr feedback * updated readme * [ch45487] useCamelCaseFlagKeys option (#215) * Initial commit * Update initLDClient.ts * PR fixes. Added prettier. * Update withLDProvider.test.tsx * Fixed lint errors. Added test for useCamelCase false on server changes. * Removed prettier. * Re-added prettier * Update yarn.lock * Update prettier and lock files. * Fixed more linting issues. * fix a typo * use persistent anonymous user logic by default in react sdk (#216) * use persistent anonymous user logic by default in react sdk * added a comment * minor test change * missed a line * remove React package from monorepo * make link text match link * improve log format and add configurable prefix * fix test * linter * deprecate samplingInterval * linter * improve log message for stream connection failures (#221) * improve log message for stream connection failures * update the reconnection warning so that it only displays for the first set of each reconnection attempts * also test that the original put is getting called * updating tests * updating tests * Revert "updating tests" This reverts commit 84163cdf8b5af6a6e969d777b946a8a2973919ed. * better abstraction * minor change * updating the js-common readme to mention client-side node (#222) * remove common package, no more monorepo * add Releaser metadata * npm audit fix * unify Rollup config * migrate new demo code to new package structure * moved example folder * syntax fix in demo * fix directory name * fix linting * use spread operator instead of Object.assign * don't close client on beforeunload, but do flush events * typo * clarify test postconditions * misc test app improvements for testing beforeunload handler * rm unused yarn.lock * rm typedoc dependency, don't commit installation of it during release * fix paths * fix file copying logic * pr template * revert * fix programmatically reported version string * upgrade Typescript to avoid Typedoc incompatibility * Revert "upgrade Typescript to avoid Typedoc incompatibility" This reverts commit 34d9a0f. * update Babel, Jest, Rollup * remove old releaser (#229) * remove unused Rollup plugins, update dependencies * use new config validation mechanism in js-sdk-common 3.x * add image-loading event delivery logic factored out of js-sdk-common * enable diagnostic events in JS SDK * lint * fix tests * use common 3.0.0-beta2 * use 3.1.0-beta3, fix property name * lint * use js-sdk-common 3.1.0 * use js-sdk-common 3.1.1 for event payload ID fix * use js-sdk-common 3.1.2 and loosen our other dependency * fix license * use js-sdk-common 3.2.0-beta1 * SDK name should be js-client-sdk * misc fixes * use js-sdk-common 3.2.0 * use js-sdk-common 3.2.0 * standardize linting * use js-sdk-common 3.2.1 * use js-sdk-common 3.2.2 * update package-lock * update js-sdk-common dependency for initialization error bugfix * update js-sdk-common for content type bugfix; update some dev dependencies * remove unsafe usage of hasOwnProperty * use js-sdk-common 3.2.5 * resolve security vulnerability in acorn dependency (#240) * update js-sdk-common to get console logging IE bugfix * update js-sdk-common for duplicate diagnostic event fix * update js-sdk-common for TS decl fix, improve TS compilation test (#243) * bump to 3.2.9 to get startsWith fix (#244) * add option to disable sync event flush (#245) * update js-sdk-common + some dev dependencies * No longer remove non-section hash in substring and regex matching * linting * the linting target to run in CI is "lint:all", not "lint" * new js-common-sdk version (#249) * resolve node-notifier vulnerability by updating jest dep (#250) * adding contextKind to goal events, bumping js-common to get alias function (#251) * pin typedoc to unblock our releases (#252) * Removed the guides link * add inlineUsersToEvents to TypeScript defs by updating js-sdk-common * Update common JS SDK library to use fixes for debug event generation issues. * Update package lock. * use Releaser v2 config + newer CI image (#256) * Updated readme headers (#258) * don't log a warning about custom goal being unknown * lint + comment * Release js-client-sdk with the header transformation change * Updates docs link * bump js-sdk-common version for better localstorage error handling * Update launchdarkly-js-sdk-common for JSON error handling fix (sc-142333) * update lockfile * add basicLogger export * Update common for application tags support. (#265) * Re-remove package-lock.json and add it to the .gitignore. (#266) * Use a combination of dependencies that is compatible. (#269) (#270) * Update js-sdk-common to 3.7.0 (#271) * Update node version used during release. (#272) * Update common to 3.8.1 (#273) * Update common version for jitter and backoff. (#274) Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com> Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com> Co-authored-by: Eli Bishop <eli@launchdarkly.com> Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com> Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com> Co-authored-by: Yusinto Ngadiman <yusinto@gmail.com> Co-authored-by: Zach Davis <zach@launchdarkly.com> Co-authored-by: Elliot <35050275+Apache-HB@users.noreply.github.com> Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com> Co-authored-by: Louis Chan <lchan@launchdarkly.com> Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com> Co-authored-by: Ember Stevens <ember.stevens@launchdarkly.com> Co-authored-by: ember-stevens <79482775+ember-stevens@users.noreply.github.com> Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
* fixing merge error * fixing merge error * fix broken links on npmjs.com (#193) * update lockfiles for new packages * fix changelog formatting error that messes up the release script * Specify unpkg default target file in package.json for launchdarkly-js-client-sdk and launchdarkly-js-sdk-common. * Correct requestor call to fetch flags on a received ping event. * Implement Hooks API (#196) * Initial commit reusing withLDProvider * Added sitenav. Cleaned up filenames. * Updated readme with hooks api docs. Fixed linting errors. * Fixed linting errors. * Update README.md * bumping our lerna version to resolve transitive dependency vulnerabilities with fstream and tar (#198) * fix goals query logic for Electron, also fix handling of invalid content type * add ability to alter URL in events * Update browserPlatform definition to detect when an EventSource polyfill is available and has published that it supports setting the method used for the stream. When this is the case, the platform publishes that it supports using REPORT with EventSource and will provide the polyfill implementation if the SDK attempts a EventSource connection with the method set to REPORT. * Fix initial linter warnings. * Fix another linter warning. * fix a broken readme link (#202) * removing a stray character in the readme * fix stream reconnect logic and add stream connection logging * linter * assume logger always exists, as we do in other components * fix and simplify how the logger object is passed around * make it so eventUrlTransformer actually does something * linter * copy flags object to prevent subtle update problem in Electron * additional fix + test * make bootstrapped flags available immediately * Refactor some of the EventSource constructor selection logic. * Change browserPlatform.js to check config options when determining EventSource implementation to use. Added tests for EventSource factory in browserPlatform.js * Deal with linter. * change how supported options are detected in EventSource polyfill * fix broken homepage attributes (#209) * improve bad initialization messages (#210) * improve bad initialization messages * remove the spaces * fixing a broken link in a logged message (#212) * add jsdelivr attribute to js packages (#213) * adding an option to disable the camel-casing of flag keys (#214) * adding an option disabling the camel-casing of flag keys * update comment * update comment * fix linter errors * address pr feedback * updated readme * [ch45487] useCamelCaseFlagKeys option (#215) * Initial commit * Update initLDClient.ts * PR fixes. Added prettier. * Update withLDProvider.test.tsx * Fixed lint errors. Added test for useCamelCase false on server changes. * Removed prettier. * Re-added prettier * Update yarn.lock * Update prettier and lock files. * Fixed more linting issues. * fix a typo * use persistent anonymous user logic by default in react sdk (#216) * use persistent anonymous user logic by default in react sdk * added a comment * minor test change * missed a line * remove React package from monorepo * make link text match link * improve log format and add configurable prefix * fix test * linter * deprecate samplingInterval * linter * improve log message for stream connection failures (#221) * improve log message for stream connection failures * update the reconnection warning so that it only displays for the first set of each reconnection attempts * also test that the original put is getting called * updating tests * updating tests * Revert "updating tests" This reverts commit 84163cdf8b5af6a6e969d777b946a8a2973919ed. * better abstraction * minor change * updating the js-common readme to mention client-side node (#222) * remove common package, no more monorepo * add Releaser metadata * npm audit fix * unify Rollup config * migrate new demo code to new package structure * moved example folder * syntax fix in demo * fix directory name * fix linting * use spread operator instead of Object.assign * don't close client on beforeunload, but do flush events * typo * clarify test postconditions * misc test app improvements for testing beforeunload handler * rm unused yarn.lock * rm typedoc dependency, don't commit installation of it during release * fix paths * fix file copying logic * pr template * revert * fix programmatically reported version string * upgrade Typescript to avoid Typedoc incompatibility * Revert "upgrade Typescript to avoid Typedoc incompatibility" This reverts commit 34d9a0f. * update Babel, Jest, Rollup * remove old releaser (#229) * remove unused Rollup plugins, update dependencies * use new config validation mechanism in js-sdk-common 3.x * add image-loading event delivery logic factored out of js-sdk-common * enable diagnostic events in JS SDK * lint * fix tests * use common 3.0.0-beta2 * use 3.1.0-beta3, fix property name * lint * use js-sdk-common 3.1.0 * use js-sdk-common 3.1.1 for event payload ID fix * use js-sdk-common 3.1.2 and loosen our other dependency * fix license * use js-sdk-common 3.2.0-beta1 * SDK name should be js-client-sdk * misc fixes * use js-sdk-common 3.2.0 * use js-sdk-common 3.2.0 * standardize linting * use js-sdk-common 3.2.1 * use js-sdk-common 3.2.2 * update package-lock * update js-sdk-common dependency for initialization error bugfix * update js-sdk-common for content type bugfix; update some dev dependencies * remove unsafe usage of hasOwnProperty * use js-sdk-common 3.2.5 * resolve security vulnerability in acorn dependency (#240) * update js-sdk-common to get console logging IE bugfix * update js-sdk-common for duplicate diagnostic event fix * update js-sdk-common for TS decl fix, improve TS compilation test (#243) * bump to 3.2.9 to get startsWith fix (#244) * add option to disable sync event flush (#245) * update js-sdk-common + some dev dependencies * No longer remove non-section hash in substring and regex matching * linting * the linting target to run in CI is "lint:all", not "lint" * new js-common-sdk version (#249) * resolve node-notifier vulnerability by updating jest dep (#250) * adding contextKind to goal events, bumping js-common to get alias function (#251) * pin typedoc to unblock our releases (#252) * Removed the guides link * add inlineUsersToEvents to TypeScript defs by updating js-sdk-common * Update common JS SDK library to use fixes for debug event generation issues. * Update package lock. * use Releaser v2 config + newer CI image (#256) * Updated readme headers (#258) * don't log a warning about custom goal being unknown * lint + comment * Release js-client-sdk with the header transformation change * Updates docs link * bump js-sdk-common version for better localstorage error handling * Update launchdarkly-js-sdk-common for JSON error handling fix (sc-142333) * update lockfile * add basicLogger export * Update common for application tags support. (#265) * Re-remove package-lock.json and add it to the .gitignore. (#266) * Use a combination of dependencies that is compatible. (#269) (#270) * Update js-sdk-common to 3.7.0 (#271) * Update node version used during release. (#272) * Update common to 3.8.1 (#273) * Update common version for jitter and backoff. (#274) * Update typedoc and make associated documentation changes. (#275) Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com> Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com> Co-authored-by: Eli Bishop <eli@launchdarkly.com> Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com> Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com> Co-authored-by: Yusinto Ngadiman <yusinto@gmail.com> Co-authored-by: Zach Davis <zach@launchdarkly.com> Co-authored-by: Elliot <35050275+Apache-HB@users.noreply.github.com> Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com> Co-authored-by: Louis Chan <lchan@launchdarkly.com> Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com> Co-authored-by: Ember Stevens <ember.stevens@launchdarkly.com> Co-authored-by: ember-stevens <79482775+ember-stevens@users.noreply.github.com> Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
* bumping our lerna version to resolve transitive dependency vulnerabilities with fstream and tar (#198) * fix goals query logic for Electron, also fix handling of invalid content type * add ability to alter URL in events * Update browserPlatform definition to detect when an EventSource polyfill is available and has published that it supports setting the method used for the stream. When this is the case, the platform publishes that it supports using REPORT with EventSource and will provide the polyfill implementation if the SDK attempts a EventSource connection with the method set to REPORT. * Fix initial linter warnings. * Fix another linter warning. * fix a broken readme link (#202) * removing a stray character in the readme * fix stream reconnect logic and add stream connection logging * linter * assume logger always exists, as we do in other components * fix and simplify how the logger object is passed around * make it so eventUrlTransformer actually does something * linter * copy flags object to prevent subtle update problem in Electron * additional fix + test * make bootstrapped flags available immediately * Refactor some of the EventSource constructor selection logic. * Change browserPlatform.js to check config options when determining EventSource implementation to use. Added tests for EventSource factory in browserPlatform.js * Deal with linter. * change how supported options are detected in EventSource polyfill * fix broken homepage attributes (#209) * improve bad initialization messages (#210) * improve bad initialization messages * remove the spaces * fixing a broken link in a logged message (#212) * add jsdelivr attribute to js packages (#213) * adding an option to disable the camel-casing of flag keys (#214) * adding an option disabling the camel-casing of flag keys * update comment * update comment * fix linter errors * address pr feedback * updated readme * [ch45487] useCamelCaseFlagKeys option (#215) * Initial commit * Update initLDClient.ts * PR fixes. Added prettier. * Update withLDProvider.test.tsx * Fixed lint errors. Added test for useCamelCase false on server changes. * Removed prettier. * Re-added prettier * Update yarn.lock * Update prettier and lock files. * Fixed more linting issues. * fix a typo * use persistent anonymous user logic by default in react sdk (#216) * use persistent anonymous user logic by default in react sdk * added a comment * minor test change * missed a line * remove React package from monorepo * make link text match link * improve log format and add configurable prefix * fix test * linter * deprecate samplingInterval * linter * improve log message for stream connection failures (#221) * improve log message for stream connection failures * update the reconnection warning so that it only displays for the first set of each reconnection attempts * also test that the original put is getting called * updating tests * updating tests * Revert "updating tests" This reverts commit 84163cdf8b5af6a6e969d777b946a8a2973919ed. * better abstraction * minor change * updating the js-common readme to mention client-side node (#222) * remove common package, no more monorepo * add Releaser metadata * npm audit fix * unify Rollup config * migrate new demo code to new package structure * moved example folder * syntax fix in demo * fix directory name * fix linting * use spread operator instead of Object.assign * don't close client on beforeunload, but do flush events * typo * clarify test postconditions * misc test app improvements for testing beforeunload handler * rm unused yarn.lock * rm typedoc dependency, don't commit installation of it during release * fix paths * fix file copying logic * pr template * revert * fix programmatically reported version string * upgrade Typescript to avoid Typedoc incompatibility * Revert "upgrade Typescript to avoid Typedoc incompatibility" This reverts commit 34d9a0f. * update Babel, Jest, Rollup * remove old releaser (#229) * remove unused Rollup plugins, update dependencies * use new config validation mechanism in js-sdk-common 3.x * add image-loading event delivery logic factored out of js-sdk-common * enable diagnostic events in JS SDK * lint * fix tests * use common 3.0.0-beta2 * use 3.1.0-beta3, fix property name * lint * use js-sdk-common 3.1.0 * use js-sdk-common 3.1.1 for event payload ID fix * use js-sdk-common 3.1.2 and loosen our other dependency * fix license * use js-sdk-common 3.2.0-beta1 * SDK name should be js-client-sdk * misc fixes * use js-sdk-common 3.2.0 * use js-sdk-common 3.2.0 * standardize linting * use js-sdk-common 3.2.1 * use js-sdk-common 3.2.2 * update package-lock * update js-sdk-common dependency for initialization error bugfix * update js-sdk-common for content type bugfix; update some dev dependencies * remove unsafe usage of hasOwnProperty * use js-sdk-common 3.2.5 * resolve security vulnerability in acorn dependency (#240) * update js-sdk-common to get console logging IE bugfix * update js-sdk-common for duplicate diagnostic event fix * update js-sdk-common for TS decl fix, improve TS compilation test (#243) * bump to 3.2.9 to get startsWith fix (#244) * add option to disable sync event flush (#245) * update js-sdk-common + some dev dependencies * No longer remove non-section hash in substring and regex matching * linting * the linting target to run in CI is "lint:all", not "lint" * new js-common-sdk version (#249) * resolve node-notifier vulnerability by updating jest dep (#250) * adding contextKind to goal events, bumping js-common to get alias function (#251) * pin typedoc to unblock our releases (#252) * Removed the guides link * add inlineUsersToEvents to TypeScript defs by updating js-sdk-common * Update common JS SDK library to use fixes for debug event generation issues. * Update package lock. * use Releaser v2 config + newer CI image (#256) * Updated readme headers (#258) * don't log a warning about custom goal being unknown * lint + comment * Release js-client-sdk with the header transformation change * Updates docs link * bump js-sdk-common version for better localstorage error handling * Update launchdarkly-js-sdk-common for JSON error handling fix (sc-142333) * update lockfile * add basicLogger export * Update common for application tags support. (#265) * Re-remove package-lock.json and add it to the .gitignore. (#266) * Switch to 5.0 of the SDK common. * Use a combination of dependencies that is compatible. (#269) * Use a combination of dependencies that is compatible. (#269) (#270) * Update js-sdk-common to 3.7.0 (#271) * Update node version used during release. (#272) * Update common to 3.8.1 (#273) * Update common version for jitter and backoff. (#274) * Update typedoc and make associated documentation changes. (#275) * Update to prerelease package. (#276) * Update release config to use node 14. * Update typedoc and make associated documentation changes. (#275) (#277) * Update to pre-release common 5.0.0-alpha.2 * Update typings.d.ts (#278) Co-authored-by: Yusinto Ngadiman <yus@launchdarkly.com> * Update to js-sdk-common 5.0.0-alpha.3 * [sc-177790] Replaced getUser with getContext (#279) * Replaced getUser with getContext * Remove contextKind * Update GoalManager.js Co-authored-by: Yusinto Ngadiman <yus@launchdarkly.com> * Update GoalManager.js (#280) * Switch to 5.0 of the SDK common. * Use a combination of dependencies that is compatible. (#269) * Update to prerelease package. (#276) * Update release config to use node 14. * Update typedoc and make associated documentation changes. (#275) (#277) * Update to pre-release common 5.0.0-alpha.2 * Update typings.d.ts (#278) Co-authored-by: Yusinto Ngadiman <yus@launchdarkly.com> * Update to js-sdk-common 5.0.0-alpha.3 * [sc-177790] Replaced getUser with getContext (#279) * Replaced getUser with getContext * Remove contextKind * Update GoalManager.js Co-authored-by: Yusinto Ngadiman <yus@launchdarkly.com> * Update GoalManager.js Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Co-authored-by: Yusinto Ngadiman <yus@launchdarkly.com> * Update GoalManager.js (#281) Co-authored-by: Yusinto Ngadiman <yus@launchdarkly.com> * Update SDK common version. (#282) * Update release metadata. Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com> Co-authored-by: Eli Bishop <eli@launchdarkly.com> Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com> Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com> Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com> Co-authored-by: Zach Davis <zach@launchdarkly.com> Co-authored-by: Elliot <35050275+Apache-HB@users.noreply.github.com> Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com> Co-authored-by: Louis Chan <lchan@launchdarkly.com> Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com> Co-authored-by: Ember Stevens <ember.stevens@launchdarkly.com> Co-authored-by: ember-stevens <79482775+ember-stevens@users.noreply.github.com> Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Co-authored-by: Yusinto Ngadiman <yusinto@gmail.com> Co-authored-by: Yusinto Ngadiman <yus@launchdarkly.com>
Describe the bug
When LaunchDarkly attempts to open connections to the server api close to when a
beforeunload
event occurs, those connections / api calls fails in a unexpected way.So far what we've seen this is mostly a issue on chromium browsers. We've seen the issue on browsers such as Chrome, Opera, Samsung mobile and other Chromium based browsers.
However, we do capture the bug on Safari/Webkit browsers too, just not at the same volume.
To reproduce
TL;DR
Trigger a
beforeunload
event and then try to refetch data from LD backend and it will fail.A minimal reproduction case: https://codesandbox.io/s/distracted-zhukovsky-uzljh
Story time.. Our main customer base is Swedish customers. In Sweden, we have a national authentication system (BankID) that any Swedish company can use as a mechanism to identify, verify and bind legal contracts with their customers.
This authentication system provides a consumer facing mobile app, this is where customers inputs their password (our app never deals with the password). Our mobile app integrates with this bankid mobile app as well as their server-side api. The flow works kind of like this:
We initiate a authentication process by executing a rest endpoint in their backend.
Their backend returns back a UUID token.
We forward this token to our mobile app.
Our mobile app will then attempt to open the bankid mobile app using a custom scheme
window.location = "bankid://initiate?token=<UUID>"
Since
bankid://
is not a supported protocol in any browser or system, the browser will simply trigger abeforeunload
event, but will never navigate away from the page.However, the mobile OS (IOS, Android, etc) will intercept these calls and see if there are any native apps on the phone that has expressed interest in this specific protocol.
Since the bankid mobile app has expressed interest in this protocol, the OS will launch that app and forward the data
/initiate?token=<UUID>
to a handler within the app. The bankid app will then associate that token with the user that the bankid app has been associated with.The bankid mobile app will then ask if the user agrees to sign in to the service that the token has been associated with (LeoVegas in our case). If there is a agreement, the bankid service will then mark the token as authenticated and our backend will consider the user authenticated. When all this is done, the bankid mobile app will issue a "go back" command which is going to take the user back to whatever app that initiated the authentication process. In our case that is our mobile app.
Once back in our app, we will run a call to our backend and fetch the user that got associated with the bankid token. When the user data is fetched, we use that data to construct a
LDUser
and pass that toidentify
. This call toidentify
fails.Expected behavior
The LD SDK should succeed fetched the data from the backend. Our own api calls work as expected so there is definitely something LD does in order to have these calls fail.
Logs
Expected application/json content type but got ""
SDK version
2.16.0
OS/platform
Android, Chromium
Additional context
I have a slight theory that using the native
fetch
method is what makes our own api calls succeed. To my knowledge, LaunchDarkly uses XHR. There could be a case where XHR calls fail if they are executed when the page has not been interacted with by a user and the beforeunload event has been triggered.The text was updated successfully, but these errors were encountered: