From 32309fe2fa35a0cfc34b88474779406fbf37560c Mon Sep 17 00:00:00 2001 From: Nazar Kuzmenko Date: Wed, 6 May 2026 18:26:14 +0200 Subject: [PATCH 1/2] chore(deps)!: move @workos-inc/node to peerDependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @workos-inc/node's types (User, OauthTokens, AuthenticationResponse) are surfaced into authkit-nextjs's public-API interfaces in src/interfaces.ts (Session, UserInfo, HandleAuthSuccessData). When a consumer's resolved version of @workos-inc/node differs from the version satisfying authkit-nextjs's transitive ^9.0.0 range, package managers install a duplicate copy under node_modules/@workos-inc/authkit-nextjs/node_modules/@workos-inc/node/. TypeScript then emits TS2883 on consumer code that infers return types from withAuth() / refreshSession(), because the canonical path of the referenced User type crosses a nested node_modules. Declaring @workos-inc/node as a peer dependency forces a single resolved copy in the consumer tree by construction — the same pattern already used here for next, react, and react-dom. Added to devDependencies so the package's own build, typecheck, and tests continue to find it. BREAKING CHANGE: consumers must now have @workos-inc/node listed in their own dependencies. In practice most consumers already do, since authkit-nextjs only wraps a subset of the WorkOS server SDK and production code paths typically call WorkOS directly for organization and user management. --- package.json | 3 ++- pnpm-lock.yaml | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 3ebcf17..4c1d8fd 100644 --- a/package.json +++ b/package.json @@ -38,13 +38,13 @@ }, "dependencies": { "@sindresorhus/fnv1a": "^3.1.0", - "@workos-inc/node": "^9.0.0", "iron-session": "^8.0.4", "jose": "^5.10.0", "path-to-regexp": "^6.3.0", "valibot": "^1.2.0" }, "peerDependencies": { + "@workos-inc/node": "^9.0.0", "next": "^13.5.9 || ^14.2.26 || ^15.2.3 || ^16", "react": "^18.0 || ^19.0.0", "react-dom": "^18.0 || ^19.0.0" @@ -56,6 +56,7 @@ "@types/react": "18.2.67", "@types/react-dom": "18.2.22", "@vitest/coverage-v8": "^3.2.4", + "@workos-inc/node": "^9.0.0", "jsdom": "^26.1.0", "next": "^16.2.1", "oxfmt": "^0.42.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 112cef1..71313db 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,9 +14,6 @@ importers: '@sindresorhus/fnv1a': specifier: ^3.1.0 version: 3.1.0 - '@workos-inc/node': - specifier: ^9.0.0 - version: 9.1.0 iron-session: specifier: ^8.0.4 version: 8.0.4 @@ -54,6 +51,9 @@ importers: '@vitest/coverage-v8': specifier: ^3.2.4 version: 3.2.4(vitest@3.2.4(@types/node@20.19.37)(jsdom@26.1.0)(terser@5.46.0)) + '@workos-inc/node': + specifier: ^9.0.0 + version: 9.1.0 jsdom: specifier: ^26.1.0 version: 26.1.0 @@ -1946,6 +1946,7 @@ packages: '@ungap/structured-clone@1.3.0': resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==} + deprecated: Potential CWE-502 - Update to 1.3.1 or higher '@unpic/core@1.0.3': resolution: {integrity: sha512-aum9YNVUGso7MjGLD0Rp/08kywCGLqZ03/q6VQBFFakDBOXWEc8D4kPGcZ8v5wEnGRex3lE+++bOuucBp3KJ/w==} From 0fccbf27072f2fcacc6fd73f18e7e2849c2caa77 Mon Sep 17 00:00:00 2001 From: Nazar Kuzmenko Date: Wed, 6 May 2026 18:31:09 +0200 Subject: [PATCH 2/2] docs: list @workos-inc/node in install instructions @workos-inc/node is now a peer dependency, so consumers must install it explicitly alongside @workos-inc/authkit-nextjs. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 793373e..120a5cb 100644 --- a/README.md +++ b/README.md @@ -6,16 +6,16 @@ The AuthKit library for Next.js provides convenient helpers for authentication a ## Installation -Install the package with: +Install the package alongside the WorkOS Node SDK (a peer dependency): ``` -pnpm i @workos-inc/authkit-nextjs +pnpm i @workos-inc/authkit-nextjs @workos-inc/node ``` or ``` -yarn add @workos-inc/authkit-nextjs +yarn add @workos-inc/authkit-nextjs @workos-inc/node ``` ## Video tutorial