-
Notifications
You must be signed in to change notification settings - Fork 36
[BUG] Importing the @openfeature/launchdarkly-client-provider throws a TypeError #659
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
Comments
@toddbaert Just created the issue about the constructor error. Please let me know if you need more details. |
Thanks @juanparadox . Can you confirm the versions you're using (I'm assuming both @ latest)? And are you using yarn or npm? (They behave a bit differently with peer dependencies, which may be related to the problem). |
@toddbaert Yeah! They are both at the latest versions and I am using pnpm. |
I believe pnpm doesn't automatically install peer dependencies. Can you confirm |
@toddbaert I just manually installed |
Ok thanks again! I'll try to replicate the issue myself and get back to you 🙏 |
Thank you very much! |
Fixes: #659 This PR fixes an issue created with [this change](#650), which removed the `events` polyfill package from `@openfeature/core` where is wasn't always needed (see that issue for details). The problem was that we still imported `events` in the `@openfeature/core` module, but can't use the `events` bundled in the `@openfeature/web-sdk` since the bundled package there isn't accessible from imports in `@openfeature/core`. This PR _**removes all imports of `events`**_ from `@openfeature/core`, and instead only imports types. Imports of `events` only now occur in the web-sdk (where it's bundled) and server-sdk (where it's made available by the node runtime), not in the common module. Unfortunately this issue was a bit tough to track down, because `events` is VERY common, and lots of bundlers, etc will add it, so it's frequently available "accidentally". Thanks to @juanparadox for the report. --------- Signed-off-by: Todd Baert <[email protected]>
@juanparadox fix is released. Please let me know if your problem is resolved (you'll need to update core and web sdk) |
@toddbaert Fix looks to have worked! Thank you! |
Observed behavior
I installed the
@openfeature/web-sdk
and@openfeature/launchdarkly-client-provider
packages usingpnpm install
.Upon trying to simply import the
LaunchDarklyClientProvider
viaimport { LaunchDarklyClientProvider } from "@openfeature/launchdarkly-client-provider";
and running my local app (it's the boilerplate Vite React project that the Vite install provides) a TypeError.Expected Behavior
I expected the provider to be able to be imported without a
TypeError
being thrown so that it can be instantiated into theOpenFeature.setProvider
method.Steps to reproduce
@openfeature/web-sdk
library (This may not be necessary as the issue occurs when just importing the provider library below)@openfeature/launchdarkly-client-provider
libraryfeatureFlags.ts
with the following (this is as bare of code you can write to reproduce the issue, I understand it's not creating a LaunchDarklyClientProvider instance or doing anything with the import, you could skip this step and just import the provider library directly into a file your app is already using)The text was updated successfully, but these errors were encountered: