Skip to content

fix!: require @workos-inc/node >=10.4.0 (eventemitter3 Vite dev crash #106)#107

Merged
nicknisi merged 2 commits into
mainfrom
fix/eventemitter3-peer-floor-106
Jun 24, 2026
Merged

fix!: require @workos-inc/node >=10.4.0 (eventemitter3 Vite dev crash #106)#107
nicknisi merged 2 commits into
mainfrom
fix/eventemitter3-peer-floor-106

Conversation

@nicknisi

Copy link
Copy Markdown
Member

Summary

Fixes #106. Pins the transitive @workos-inc/node peer floor to >=10.4.0, the version that removed eventemitter3.

Root cause

The TanStack Start client hydration entry imports the app's src/start.ts, which imports authkitMiddleware from this package's main entry. In Vite dev there's no tree-shaking, so the whole server barrel — including its transitive @workos/authkit-session@workos-inc/node chain — is eagerly evaluated in the browser. @workos-inc/node 8.11.110.3.x bundled eventemitter3, whose CJS index.js (default-imported by its own index.mjs) cannot be served as raw ESM by Vite, so the browser throws:

Uncaught SyntaxError: The requested module '.../eventemitter3/index.js' does not provide an export named 'default' (at index.mjs:1:8)

@workos-inc/node@10.4.0 replaced eventemitter3 with an internal emitter, removing the landmine at the source.

Why this fix

  • The crash is in a transitive dependency; the cure is ensuring consumers resolve @workos-inc/node >= 10.4.0.
  • This package doesn't import @workos-inc/node directly (it's @workos/authkit-session's peer), so we declare the floor as a peer here to enforce it for consumers. It intersects with authkit-session's ^8 || ^9 || ^10 to an effective >=10.4.0 <11.
  • engines.node bumped to >=22.11.0 to match what @workos-inc/node@10 requires (it dropped Node 20 in v9).

Why this never reproduced in example/

example/ consumes the SDK via a workspace:* symlink whose real path is outside node_modules, so Vite pre-bundles @workos/authkit-session with esbuild and fixes the CJS interop — masking the crash. A real install (npm/pnpm/bun) serves it raw and crashes. (The production build-based leak check can't catch this either — Rollup tree-shakes the prod bundle clean.)

Breaking change

  • Requires @workos-inc/node >= 10.4.0.
  • Requires Node >= 22.11.

Consumers on an older @workos-inc/node / Node 20 will get a peer/engine warning prompting the upgrade.

Test plan

  • pnpm build (typecheck + emit) — passes
  • pnpm test — 234 passing (incl. exports.spec.ts; error classes still exported from the main entry)
  • cd example && pnpm build — passes
  • pnpm run build:check — no server fingerprints in the client bundle
  • Reproduced eventemitter3 default export error still occurs in Vite dev with v0.9.1 #106 in a real Bun isolated install on @workos-inc/node < 10.4.0, and confirmed >= 10.4.0 removes eventemitter3 from the client module graph

…106)

@workos-inc/node 8.11.1-10.3.x bundles eventemitter3, whose CJS module breaks Vite's dev server when @workos-inc/node is served as raw ESM: the browser throws "does not provide an export named 'default'" (#106). @workos-inc/node@10.4.0 dropped eventemitter3 for an internal emitter.

Pin the transitive peer floor so consumers can't resolve a eventemitter3-carrying version. Intersects with authkit-session's `^8 || ^9 || ^10` peer to an effective `>=10.4.0 <11`. engines.node bumped to >=22.11 to match @workos-inc/node 10's requirement.

BREAKING CHANGE: requires @workos-inc/node >=10.4.0 and Node >=22.11.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Open in Devin Review

Comment thread package.json
@greptile-apps

greptile-apps Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

  • Raises the package runtime requirement to Node >=22.11.0.
  • Adds @workos-inc/node as a peer dependency at >=10.4.0 to avoid the Vite dev crash from older transitive WorkOS Node versions.
  • Updates pnpm-lock.yaml so the resolved dependency graph uses @workos-inc/node@10.4.0 and drops eventemitter3.

Confidence Score: 4/5

The dependency floor addresses the Vite dev crash, but the unbounded WorkOS peer range leaves installs open to unsupported future major versions.

The change is small and localized to package metadata and lockfile updates, and the dependency-range issue is specific and reproducible from declared package contracts.

package.json

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex ran the requested verification, but its local artifact references were not uploaded.
  • Two runs of the node check script were performed: the base run returned exit code 0 with peerDependencies.@workos-inc/node: <missing>, and the head run returned exit code 0 with peerDependencies.@workos-inc/node: >=10.4.0 and authkit-session resolved as 0.6.0(@workos-inc/node@10.4.0).
  • Two dependency-inspection steps were observed with pnpm: before, pnpm why eventemitter3 showed a chain to @workos-inc/node@8.13.0, and after the install there was no dependency chain and @workos-inc/node@10.4.0 was resolved, with eventemitter3 paths removed from node_modules and the lockfile reflecting the change.
  • Engine checks were run: the before state allowed Node >=20.0.0 for the install, while the after state required Node >=22.11.0 for @workos-inc/node@10.4.0, alignment was true, and a simulated Node 20.9.0 engine-strict error was reported.

View all artifacts

T-Rex Ran code and verified through T-Rex

Fix All in Devin Fix All in Claude Code

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
package.json:73
**Cap WorkOS major**

This package relies on `@workos/authkit-session@0.6.0`, whose peer contract only supports `@workos-inc/node` through major 10. The new `>=10.4.0` peer range also accepts future major versions, so a consumer can install a version that satisfies this package while violating the downstream session package's supported API range, causing peer conflicts or an unsupported dependency pair once v11 exists. Encoding the intended intersection keeps installs on the tested `>=10.4.0 <11` range.

Reviews (1): Last reviewed commit: "chore: pnpm-lock" | Re-trigger Greptile

Comment thread package.json
"peerDependencies": {
"@tanstack/react-router": ">=1.0.0",
"@tanstack/react-start": ">=1.168.25",
"@workos-inc/node": ">=10.4.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Cap WorkOS major

This package relies on @workos/authkit-session@0.6.0, whose peer contract only supports @workos-inc/node through major 10. The new >=10.4.0 peer range also accepts future major versions, so a consumer can install a version that satisfies this package while violating the downstream session package's supported API range, causing peer conflicts or an unsupported dependency pair once v11 exists. Encoding the intended intersection keeps installs on the tested >=10.4.0 <11 range.

T-Rex Ran code and verified through T-Rex

Prompt To Fix With AI
This is a comment left during a code review.
Path: package.json
Line: 73

Comment:
**Cap WorkOS major**

This package relies on `@workos/authkit-session@0.6.0`, whose peer contract only supports `@workos-inc/node` through major 10. The new `>=10.4.0` peer range also accepts future major versions, so a consumer can install a version that satisfies this package while violating the downstream session package's supported API range, causing peer conflicts or an unsupported dependency pair once v11 exists. Encoding the intended intersection keeps installs on the tested `>=10.4.0 <11` range.

How can I resolve this? If you propose a fix, please make it concise.

Fix in Devin Fix in Claude Code

@gjtorikian gjtorikian left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of fix!, we should double check if this will promote from 0.9 -> 0.10 or 0.9 -> 1.0, the latter of which is undesirable.

According to semver, breaking changes before a 1.0.0 release do not require a major version bump.

@nicknisi nicknisi merged commit 424a712 into main Jun 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

eventemitter3 default export error still occurs in Vite dev with v0.9.1

2 participants