## The symptom

In a Next.js 14 project, calling `getCustomersByEmail(email)` on the
`APIClient` from customerio-node throws:

```
Unhandled Runtime Error. TypeError: url_1.URL is not a constructor
```

The same call works in a plain Node server.

## Why

customerio-node is a server-side library only: it relies on Node's `URL`
global, which does not exist in the browser runtime. The client was
instantiated in app-router code that ends up executing in the browser, so the
import blows up.

## The fix

Keep the APIClient on the server (route handlers / server actions) and never
bundle it into client components. For browser-side tracking, use Customer.io's
JavaScript source snippet instead of this library.

## The general lesson

`X is not a constructor` for a Node builtin (URL, Buffer, process) inside a
Next.js app almost always means server-only code leaked into a client bundle.
Move the call behind a route handler rather than polyfilling the builtin.