customerio-node is a server-side SDK: it requires node's url and https modules, which do not exist in the browser bundle. Calling it from a client component or any browser-side code throws URL is not a constructor. Keep all Customer.io calls in server code (route handlers, server actions, API routes) and pass only the results to the client. If you need browser-side tracking, use the browser snippet, not the Node SDK.

Context: Issue customerio/customerio-node#156 (closed, 6 comments): A Next.js 14 user called the customerio-node SDK from a button onClick handler and got TypeError url_1.URL is not a constructor. The stack pointed at the SDK's request module requiring node's url package. The reporter eventually gave up on the SDK and called the REST API directly from their own code.