Skip to content
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

posthog.getAllFlags not working #77

Open
SebTVisage opened this issue Aug 26, 2022 · 6 comments
Open

posthog.getAllFlags not working #77

SebTVisage opened this issue Aug 26, 2022 · 6 comments
Assignees

Comments

@SebTVisage
Copy link

SebTVisage commented Aug 26, 2022

Hi. I'm using posthog-node 2.0.2 and I get the following error when calling getAllFlags:

TypeError: undici__default.default.fetch is not a function
    at PostHogClient.fetch (/node_app/back/api/node_modules/@visage/visage-server-common/node_modules/posthog-node/src/posthog-node.ts:53:19)
    at /node_app/back/api/node_modules/@visage/visage-server-common/node_modules/posthog-core/src/index.ts:647:33
    at /node_app/back/api/node_modules/@visage/visage-server-common/node_modules/posthog-core/src/utils.ts:23:25
    at step (/node_app/back/api/node_modules/@visage/visage-server-common/node_modules/node_modules/tslib/tslib.es6.js:102:23)
    at Object.next (/node_app/back/api/node_modules/@visage/visage-server-common/node_modules/node_modules/tslib/tslib.es6.js:83:53)
    at fulfilled (/node_app/back/api/node_modules/@visage/visage-server-common/node_modules/node_modules/tslib/tslib.es6.js:73:58)
@neilkakkar
Copy link
Contributor

Hey @SebTVisage , what's getAll ?

@SebTVisage
Copy link
Author

SebTVisage commented Aug 26, 2022

Ok actually it's the same with isFeatureEnabled.

Sorry I meant getAllFlags (mentioned in the docs). I've edited the issue

@SebTVisage SebTVisage changed the title posthog.getAll not working posthog.getAllFlags not working Aug 26, 2022
@neilkakkar
Copy link
Contributor

Hmm, just tested the library again, I don't face the same.

How're you using the library? Some reproduction instructions would be nice.

@SebTVisage
Copy link
Author

On a node 12 project using TS. I'll try to give you a reproduction repo. I do this more or less:

import { PostHog } from 'posthog-node';
import config from '../config';

export const postHogClient = new PostHog(config.thirdParties.posthog.apiKey, {
  personalApiKey: config.thirdParties.posthog.personalKey,
});

// In another file:
import { postHogClient } from '<path to file above>';
// In a function I do just something like this
const featureFlags = await postHogClient.getAllFlags('some-user-id');

I'll try to do a reproduction repo

@neilkakkar
Copy link
Contributor

For a quick check, we're using node 16, try if that works? Might mean we need to update the supported node versions 🤔

@benjackwhite
Copy link
Contributor

This will be fixed here but it does bump the minimum version to v14.7.0 PostHog/posthog-js-lite#22

@benjackwhite benjackwhite self-assigned this Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants