-
Notifications
You must be signed in to change notification settings - Fork 26
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
onlyEvaluateLocally is always producing empty array in Node.js 21.7 #228
Comments
@PostHog/team-feature-success |
Same issue in Node.js v22 |
Looks like we are getting error:
Since this is node.js version dependent, I am going to guess it is a bug in Node.js SDK. |
thanks for the report @gajus , I seemingly can't reproduce with either 21.7 or 22. Can you double check please the API keys are correct? |
Okay, no, it is def node version specific. Generated new set of tokens. Works with 21.6. Breaks with 21.7 and 22. |
weird, thanks 🤔 , let me try generating some new tokens too. |
While I am not certain what's the cause of the issue, I was able to fix it by overriding the fetch client with this.client = new PostHog(apiToken, {
featureFlagsPollingInterval: 120_000,
fetch: async (url, options) => {
const response = await get(url, {
body: options.body,
headers: options.headers,
method: options.method.toUpperCase() as 'GET',
signal: options.signal,
});
return {
json: async () => JSON.parse(response.body),
status: response.statusCode,
text: async () => response.body,
};
},
fetchRetryCount: 0,
personalApiKey,
preloadFeatureFlags: false,
requestTimeout: 5_000, // Measured in milliseconds. Defaults to 30_000 (30 seconds)
}); |
We tracked down the issue to be due to how @sentry/node v8 beta version instruments code in v21.6+. Thank you for helping to troubleshoot. |
Bug description
This code path produces an empty object in Node.js 21.7, but works as expected in Node.js 21.6.
Replicated the same behavior with
posthog-node@4.0.1
andposthog-node@3.2.0
How to reproduce
Related sub-libraries
Additional context
This issue is in relation to Contra account.
https://us.posthog.com/project/8910
The text was updated successfully, but these errors were encountered: