You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have verified that the requested feature does not already exist or has not already been requested.
Description of the feature
Problem
The client can't run on edge runtimes (Cloudflare Workers, Vercel Edge, Deno Deploy) because:
All requests go through superagent, which relies on node:http/node:https (Node) or XHR (browser) — neither exists in these runtimes; they only provide fetch.
src/easypost.js builds the default User-Agent from os.platform()/os.release()/process.versions.node at module-eval time, so even importing the package throws.
Proposal
Replace superagent with the standard fetch API (built into Node ≥18, all browsers, and every edge runtime).
The coupling is well-contained: services only call _request() and consume response.body/status/headers, so a fetch-based _request returning the same shape leaves services/, models/, and errors/ untouched. Sketch:
URL/query via URL + URLSearchParams, Basic auth via an Authorization header, timeout via AbortSignal.timeout()
Static User-Agent string (no os/process)
Breaking: superagentMiddleware/requestMiddleware/useProxy expose superagent objects — replace with an injectable fetch option (covers proxying and mocking); requestHooks/responseHooks already use plain objects and survive as-is
Drops the superagent dependency and shrinks the install
Benefits
Runs everywhere: Node ≥18, browsers, Cloudflare Workers, Vercel Edge, Deno, Bun — one transport, zero polyfills.
Fewer dependencies: drops superagent and its transitive chain (formidable, hexoid, …), shrinking install size and supply-chain surface.
Eliminates a known bug class: [Bug]: Cannot instantiate new EasyPostClient in Nextjs 13 #439 (Next.js build failure via superagent → formidable → hexoid) was a symptom of this chain; fetch removes the class of problem rather than patching around it.
No bundler workarounds: users stop needing webpack overrides to build in Next.js and similar frameworks.
Future-proof: fetch is the platform standard; superagent-era conveniences (JSON parsing, query strings, timeouts) are each a few lines over fetch.
Feature Request Is New
Description of the feature
Problem
The client can't run on edge runtimes (Cloudflare Workers, Vercel Edge, Deno Deploy) because:
Proposal
Replace superagent with the standard fetch API (built into Node ≥18, all browsers, and every edge runtime).
The coupling is well-contained: services only call _request() and consume response.body/status/headers, so a fetch-based _request returning the same shape leaves services/, models/, and errors/ untouched. Sketch:
Benefits
Happy to contribute a PR if there's interest.