nextjs - ✅(Solved) Fix Type check during build hangs on 'Linting and checking validity of requests' when build cache exists [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#83774Fetched 2026-04-08 02:21:34
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Timeline (top)
subscribed ×3commented ×1cross-referenced ×1issue_type_added ×1

Root Cause

The bug (in this case) is caused by the @kilpi/[email protected] package (https://github.com/Jussinevavuori/kilpi/issues/54). I am the author of the Kilpi library in question.

Fix Action

Fix / Workaround

A workaround (replacing the problematic function parameter type with any) was introduced in @kilpi/[email protected] in this PR. Ensure the correct version (0.3.15) is installed (pinned in the minimal reproducible demo).

PR fix notes

PR #55: Fix/54

Description (problem / solution / changelog)

Attempting to solve #54 :

When building a project using Next.js, when the .next cache directory exists, the build hangs in stage Linting and checking validity of types ....

Issue has been isolated to:

  • ReactClientComponentPlugin() call
    • create_useIsAuthorized() call
      • useIsAuthorized function's ...inputs: InferPolicyInputs<GetPolicyByAction<T["policies"], TAction>> parameter.

Replacing that parameter with any[] fixes the issue. May be used as a temporary workaround until a solution is found.

Attempts so far:

  • Improved efficiency of the PolicysetActions<T>, PolicysetActionsWithObjects<T> and PolicysetActionsWithoutObjects<T> types. Did not solve issue, however.

This might be a Next.js bug?

Changed files

  • .changeset/spicy-kings-win.md (added, +8/-0)
  • .gitignore (modified, +3/-0)
  • apps/docs/docs/concepts/hooks.mdx (modified, +1/-1)
  • examples/next-client-demo/src/app/article/[articleId]/page.tsx (modified, +4/-2)
  • packages/client/src/KilpiClient.ts (modified, +2/-4)
  • packages/core/src/KilpiHooks.ts (modified, +1/-1)
  • packages/core/src/index.ts (modified, +1/-1)
  • packages/core/src/policy.ts (modified, +34/-26)
  • packages/core/src/utils/types.ts (modified, +0/-13)
  • packages/react-client/src/components/ClientAccess.tsx (modified, +15/-14)
  • packages/react-client/src/hooks/useIsAuthorized.ts (modified, +14/-12)
  • packages/react-client/src/hooks/useSubject.ts (modified, +1/-1)
  • packages/react-client/src/plugins/ReactClientComponentPlugin.ts (modified, +12/-8)
  • packages/react-server/src/components/Access.tsx (modified, +6/-7)
  • packages/react-server/src/plugins/ReactServerComponentPlugin.ts (modified, +4/-4)
  • pnpm-lock.yaml (modified, +312/-679)
  • pnpm-workspace.yaml (modified, +1/-0)

Code Example

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:29 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 10
Binaries:
  Node: 24.1.0
  npm: 11.3.0
  Yarn: 1.22.22
  pnpm: 9.9.0
Relevant Packages:
  next: 15.5.3 // Latest available version is detected (15.5.3).
  eslint-config-next: 15.2.4
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.8.2
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/Jussinevavuori/nextjs-ts-cache-issue-with-kilpi-minimal-reproduction

To Reproduce

  1. pnpm install
  2. pnpm run build for a clean build without the cache
  3. pmpm run build for a failing (hanging) build with the cache

Current vs. Expected behavior

Current behavior

When building with an existing build cache in .next folder (or on Verce), build hangs in Linting and checking validity of types stage indefinitely. Without cache, build succeeds normally.

Expected behavior

Build succeeds with or without existing build caches.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:29 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 10
Binaries:
  Node: 24.1.0
  npm: 11.3.0
  Yarn: 1.22.22
  pnpm: 9.9.0
Relevant Packages:
  next: 15.5.3 // Latest available version is detected (15.5.3).
  eslint-config-next: 15.2.4
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.8.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

TypeScript

Which stage(s) are affected? (Select all that apply)

next build (local), Vercel (Deployed)

Additional context

The bug (in this case) is caused by the @kilpi/[email protected] package (https://github.com/Jussinevavuori/kilpi/issues/54). I am the author of the Kilpi library in question.

Typescript (e.g. tsc --noEmit) successfully builds the project. It only fails when the .next cache directory exists while running next build.

Setting typescript.ignoreBuildErrors: true in Next.js' config solves the issue as the type checking is skipped. Setting eslint.ignoreDuringBuilds: true did not affect the issue.

A workaround (replacing the problematic function parameter type with any) was introduced in @kilpi/[email protected] in this PR. Ensure the correct version (0.3.15) is installed (pinned in the minimal reproducible demo).

extent analysis

TL;DR

  • Upgrade the @kilpi/react-client package to version 0.3.16 or later to fix the build issue caused by the problematic function parameter type.

Guidance

  • Verify that the issue is resolved by upgrading the @kilpi/react-client package to version 0.3.16 or later.
  • If upgrading is not feasible, consider setting typescript.ignoreBuildErrors: true in Next.js' config as a temporary workaround, although this will skip type checking.
  • Ensure that the correct version of the package is installed by checking the package.json file and running pnpm install to ensure dependencies are up-to-date.
  • Test the build process with and without the cache to confirm that the issue is resolved.

Example

No code snippet is necessary in this case, as the solution involves upgrading a package or modifying the Next.js config.

Notes

  • The issue is specific to the @kilpi/react-client package version 0.3.15 and is resolved in version 0.3.16.
  • The workaround of setting typescript.ignoreBuildErrors: true may not be desirable in all cases, as it skips type checking.

Recommendation

  • Upgrade to fixed version: Upgrade the @kilpi/react-client package to version 0.3.16 or later, as this resolves the build issue caused by the problematic function parameter type.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Build succeeds with or without existing build caches.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING