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

AbortSignal is not defined #82

Open
MooseSaeed opened this issue Feb 7, 2023 · 10 comments
Open

AbortSignal is not defined #82

MooseSaeed opened this issue Feb 7, 2023 · 10 comments

Comments

@MooseSaeed
Copy link

MooseSaeed commented Feb 7, 2023

I'm using Posthog node client in the backend of Nuxtjs app and I'm getting these errors in the console.

ERROR  AbortSignal is not defined                                                                                02:55:25

  at PostHogClient.<anonymous> (server.js:1570:17)
  at step (server.js:436:27)
  at Object.next (server.js:385:53)
  at server.js:378:71
  at new Promise (<anonymous>)
  at __awaiter (server.js:364:12)
  at PostHogClient.module.exports.../manifold/node_modules/posthog-node/lib/index.cjs.js.PostHogCore.fetchWithRetry (server.js:1567:16)
  at PostHogClient.<anonymous> (server.js:1314:52)
  at step (server.js:436:27)
  at Object.next (server.js:385:53)

It's a simple getAllFlags() attempt where i'm initializing the client in a Typescript Singleton object. It successfully returns the flags values on page load, but the problem is that I keep getting the above error on each page refresh.

@neilkakkar
Copy link
Contributor

Hey @MooseSaeed it sounds like you're on node 14-, while AbortSignal is defined only in node 15+. I'll update the package node requirements 👀

@MooseSaeed
Copy link
Author

MooseSaeed commented Feb 7, 2023

@neilkakkar Thanks for responding. I have upgraded node version to 16.13.1 and I'm still getting the error. Maybe the issue is associated with Typescript?

@neilkakkar
Copy link
Contributor

Is it exactly the same error, or is it somewhat different? Mind removing and installing posthog-node from scratch to see if it persists?

@MooseSaeed
Copy link
Author

@neilkakkar No matter what I try, I get the same same error. I uninstalled and reinstalled posthog-node and I even cleaned out my lock file, but nothing appears to work for some reason.
On the frontend, I'm using the javascript client, which works well, however the node client continues throwing these errors.

@Ruegen
Copy link

Ruegen commented May 15, 2023

if you have an outdated version of node this polyfill worked for us until we got the update done
https://www.npmjs.com/package/abort-controller

@StockBet
Copy link

so this issue has been open for almost 1 year... yet it is still not fixed? c'mon guys @posthog-bot

@neilkakkar
Copy link
Contributor

@StockBet do you have a reproducible example I can try out? I'm failing to reproduce this on node 15+

@StockBet
Copy link

StockBet commented Dec 20, 2023 via email

@neilkakkar
Copy link
Contributor

A simple project setup where it doesn't work - node + posthog installation - a github repo link works :) - pretty hard to debug if I can't tell what might be going wrong

@StockBet
Copy link

I finally figured out the issue. @neilkakkar

Turns out Render (which I use to deploy my node server) uses 14.17.0 by default for some reason.

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

4 participants