analytics-node icon indicating copy to clipboard operation
analytics-node copied to clipboard

Support for other backend JS runtimes (Web Workers, Deno)

Open davidhousedev opened this issue 1 year ago • 3 comments

We are hoping to dispatch backend events from Shopify's Hydrogen framework, which is deployed in Web Workers. Do you all have any plans to add a source that's compatible with JS web workers? This could also be applicable to other edge-enabled frameworks like NextJS and Remix.

davidhousedev avatar Jul 19 '22 19:07 davidhousedev

Hi @davidhousedev! We are planning to add support for worker environments in analytics.js ... stay tuned as we should release this summer.

pooyaj avatar Jul 20 '22 17:07 pooyaj

cc @chrisradek @silesky

pooyaj avatar Jul 20 '22 17:07 pooyaj

Now it is Autumn already... Do we have a more lightweight version for serverless, node and web workers?

I especially would appreciate fewer dependencies (ideally ZERO) for the node version.

huksley avatar Sep 14 '22 12:09 huksley

@pooyaj and Segment team, do you have any updates on the support and ability to use this library in/with Web Workers?

azat-co avatar Dec 05 '22 17:12 azat-co

@huksleyand @davidhousedev https://github.com/segmentio/analytics-next/tree/master/packages/node supports lambda.

Not tested yet, but it should not be hard to also support CF workers and web workers if it doesn't already, as it uses system fetch, and nothing else that should be node specific (there is a process.version reference that can be refactored, but that's it). If anyone has an interest in contributing / testing, it'd be much appreciated!

silesky avatar Dec 07 '22 03:12 silesky

@segment/analytics-node now supports cloudflare workers (and presumably, other worker runtimes).

silesky avatar Jan 10 '23 05:01 silesky