Skip to content

fix(deps): pin next via overrides to dedupe duplicate install#937

Merged
willwashburn merged 1 commit into
mainfrom
fix/deploy-next-version-skew
May 21, 2026
Merged

fix(deps): pin next via overrides to dedupe duplicate install#937
willwashburn merged 1 commit into
mainfrom
fix/deploy-next-version-skew

Conversation

@willwashburn

@willwashburn willwashburn commented May 21, 2026

Copy link
Copy Markdown
Member

Summary

  • Deploy Web (SST) has failed on every push to main since 2026-05-19, and Preview Web (SST) fails on every PR, both with the same TypeScript error in web/middleware.ts:
    Argument of type 'import(".../web/node_modules/next/.../NextRequest")' is not assignable to parameter of type 'import(".../node_modules/next/.../NextRequest")'.
    
  • Root cause: Dependabot PR aa8f59c bumped web's next to 15.5.18, but @posthog/next (hoisted to root) declares next: >=13.0.0 as a peer dep. npm auto-installed a second copy of next@15.5.14 at the root to satisfy that peer, so the workspace ended up with two distinct NextRequest types — middleware imports next/server from web/node_modules/next and passes it to postHogMiddleware which expects root-next/node_modules's type.
  • Fix: add a scoped override "@posthog/next": { "next": "15.5.18" }. This pins the next that npm auto-installs for @posthog/next's peer dep to match web's version, so the duplicate collapses. Local npm ci && cd web && npx next build succeeds.

Why a scoped override and not a top-level one

A flat "next": "15.5.18" works today with @posthog/next@0.1.0, but starts leaking a duplicate next again once @posthog/next is bumped to its 0.4.x line (#TBD). The scoped form targets the actual source of the duplicate — @posthog/next's peer auto-install — and remains correct after the upgrade.

Test plan

  • npm ci produces a single next@15.5.18 (find ... node_modules/next/package.json)
  • cd web && npx next build succeeds (75 static pages generated, typecheck passes)
  • CI: Deploy Web (SST) succeeds on merge
  • CI: Preview Web (SST) succeeds on this PR

Followup (not in this PR)

  • Preview deploys also recently hit an AWS TooManyCachePolicies limit — looks like the "Remove stale preview environments" workflow isn't keeping up. Worth a separate look once this lands.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 291a5cb5-37ad-441b-985b-8b0593a9d9b1

📥 Commits

Reviewing files that changed from the base of the PR and between f9b4839 and 9601c64.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • package.json

📝 Walkthrough

Walkthrough

The package.json overrides configuration is updated to explicitly pin react-dom to ^18.3.1 and add a nested override within @posthog/next that constrains next to version 15.5.18.

Changes

Dependency Override Configuration

Layer / File(s) Summary
Dependency overrides
package.json
The overrides section explicitly pins react-dom to ^18.3.1 and introduces a nested @posthog/next override that pins next to 15.5.18.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A hop, skip, and npm update!
React and Next get pinned just right,
Dependencies squared away tight,
PostHog's next version takes flight,
The overrides shine ever so bright! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately captures the main change: pinning next via npm overrides to resolve a duplicate installation issue.
Description check ✅ Passed The description is comprehensive, covering root cause, fix rationale, testing, and follow-ups. It exceeds template requirements with detailed context.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/deploy-next-version-skew

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread packages/sdk/src/examples/ralph-loop.ts Fixed

@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: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 6 additional findings.

Open in Devin Review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2fe765b4a4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/sdk/src/relay.ts
Comment on lines +470 to +473
addListener<K extends keyof AgentRelayEvents>(
event: K,
handler: (...args: AgentRelayEvents[K]) => void | Promise<void>
): () => void {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Permit SpawnPatch returns for beforeAgentSpawn listeners

addListener currently types every handler as returning void | Promise<void>, which makes the documented beforeAgentSpawn patch pattern fail type-checking (e.g. relay.addListener('beforeAgentSpawn', () => ({ args: [...] })) produces TS2322). This effectively breaks the new hook for TypeScript consumers unless they cast around the API, and async patch handlers (Promise<SpawnPatch>) are blocked for the same reason. Please type beforeAgentSpawn as BeforeAgentSpawnHandler (or add event-specific overloads) so patch-returning handlers compile as intended.

Useful? React with 👍 / 👎.

@posthog/next declares next as a peer dep with range >=13.0.0. After
Dependabot bumped web's next to 15.5.18, npm auto-installed a second
copy of next@15.5.14 at the root to satisfy that peer, creating two
distinct NextRequest types and breaking Deploy Web (SST) and Preview
Web (SST) on every PR with a TypeScript mismatch in web/middleware.ts.

Add a root override pinning next to 15.5.18 so there's a single hoisted
install everywhere.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@willwashburn willwashburn force-pushed the fix/deploy-next-version-skew branch from 2fe765b to 9601c64 Compare May 21, 2026 19:37
@willwashburn willwashburn merged commit a0bfc70 into main May 21, 2026
39 of 40 checks passed
@willwashburn willwashburn deleted the fix/deploy-next-version-skew branch May 21, 2026 20:30
willwashburn added a commit that referenced this pull request May 21, 2026
Six months stale (0.1.0 from 2026-03-06, 0.4.61 from 2026-05-21).
Public API surface used by web (`PostHogProvider`, `postHogMiddleware`,
`PostHogPageView`) is unchanged. The scoped override added in #937
holds, so `next` remains pinned to 15.5.18 across the workspace.

Verified locally: `npm ci` produces a single `next@15.5.18`, and
`cd web && npx next build` succeeds (75 static pages, typecheck clean).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
willwashburn added a commit that referenced this pull request May 21, 2026
Six months stale (0.1.0 from 2026-03-06, 0.4.61 from 2026-05-21).
Public API surface used by web (`PostHogProvider`, `postHogMiddleware`,
`PostHogPageView`) is unchanged. The scoped override added in #937
holds, so `next` remains pinned to 15.5.18 across the workspace.

Also rebuild the lockfile from a known-good pre-#937 base to restore
Linux platform binaries (`@tailwindcss/oxide-linux-*`, `@img/sharp-linux-*`)
that got stripped when #937's lockfile regen ran on darwin-arm64 — npm
bug #4828. Without these entries, `npm ci` on CI's Linux runners fails
to install the native bindings and `next build` errors with
"Cannot find native binding" from @tailwindcss/oxide.

Verified locally: `npm ci` produces a single `next@15.5.18` plus all
platform binaries for darwin/linux/win32, and `cd web && npx next build`
succeeds (75 static pages, typecheck clean).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants