nextjs - 💡(How to fix) Fix Next.js 15.5.4 Build Fails: context.params Type Mismatch on Vercel [6 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#84190Fetched 2026-04-08 02:20:20
View on GitHub
Comments
6
Participants
2
Timeline
7
Reactions
0
Timeline (top)
commented ×6issue_type_added ×1

Error Message

2025-09-24T15:52:43.818Z npm warn deprecated [email protected]: You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other. 2025-09-24T15:52:43.819Z npm warn deprecated 2025-09-24T15:52:43.820Z npm warn deprecated (For a CapTP with native promises, see @endo/eventual-send and @endo/captp) 2025-09-24T15:53:27.539Z Type error: Type 'typeof import("/vercel/path0/src/app/api/profile-data/[id]/route")' does not satisfy the constraint 'RouteHandlerConfig<"/api/profile-data/[id]">'. 2025-09-24T15:53:27.540Z Type '(request: NextRequest, context: { params: { id: string; }; }) => Promise<NextResponse<{ error: string; }> | NextResponse<{ posts: ({ likes: { id: string; createdAt: Date; userId: string; postId: string; }[]; comments: { ...; }[]; } & { ...; })[]; followers: number; following: number; }>>' is not assignable to type '(request: NextRequest, context: { params: Promise<{ id: string; }>; }) => void | Response | Promise<void | Response>'. 2025-09-24T15:53:27.585Z Error: Command "npm run build" exited with 1 2025-09-24T15:56:17.954Z npm warn deprecated [email protected]: You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other. 2025-09-24T15:56:17.955Z npm warn deprecated 2025-09-24T15:56:17.955Z npm warn deprecated (For a CapTP with native promises, see @endo/eventual-send and @endo/captp) 2025-09-24T15:56:57.208Z Type error: Type 'typeof import("/vercel/path0/src/app/api/user-posts/[id]/route")' does not satisfy the constraint 'RouteHandlerConfig<"/api/user-posts/[id]">'. 2025-09-24T15:56:57.209Z Type '(request: Request, { params }: { params: { id: string; }; }) => Promise<NextResponse<{ error: string; }> | NextResponse<({ likes: { id: string; createdAt: Date; userId: string; postId: string; }[]; comments: { ...; }[]; } & { ...; })[]>>' is not assignable to type '(request: NextRequest, context: { params: Promise<{ id: string; }>; }) => void | Response | Promise<void | Response>'. 2025-09-24T15:56:57.251Z Error: Command "npm run build" exited with 1 The build process fails with a type error during compilation. The error message indicates that the context.params object in the GET route handler is not a Promise as expected by my code. This prevents the application from compiling and deploying. Reproducibility: The build fails both on my local machine (macOS) and on the Vercel platform. I have attached the full error logs from both environments. The error appears to be a type mismatch where my code correctly uses await context.params (as expected in Next.js 15+), but the build process throws an error saying params is not a Promise. This suggests a potential inconsistency in the internal type definitions of the Next.js beta version. I have provided a link to a minimal repository that reproduces this exact issue.

Code Example

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

Link to the code that reproduces this issue

https://github.com/unknownentity00-tech/TravelBlog.git

To Reproduce

1.deploy this project using next.js in vercel 2. Preview: https://blogtravel-f6e13jae4-mandaldebangshu7-7178s-projects.vercel.app [5s] 2025-09-24T15:52:37.256Z Running build in Washington, D.C., USA (East) – iad1 2025-09-24T15:52:37.256Z Build machine configuration: 2 cores, 8 GB 2025-09-24T15:52:37.272Z Retrieving list of deployment files... 2025-09-24T15:52:37.275Z Skipping build cache, deployment was triggered without cache. 2025-09-24T15:52:37.761Z Downloading 74 deployment files... 2025-09-24T15:52:38.401Z Running "vercel build" 2025-09-24T15:52:38.889Z Vercel CLI 48.1.1 2025-09-24T15:52:39.292Z Installing dependencies... 2025-09-24T15:52:43.818Z npm warn deprecated [email protected]: You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other. 2025-09-24T15:52:43.819Z npm warn deprecated 2025-09-24T15:52:43.820Z npm warn deprecated (For a CapTP with native promises, see @endo/eventual-send and @endo/captp) 2025-09-24T15:53:02.903Z
2025-09-24T15:53:02.904Z added 514 packages in 23s 2025-09-24T15:53:02.905Z
2025-09-24T15:53:02.905Z 151 packages are looking for funding 2025-09-24T15:53:02.906Z run npm fund for details 2025-09-24T15:53:02.945Z Detected Next.js version: 15.5.4 2025-09-24T15:53:02.951Z Running "npm run build" 2025-09-24T15:53:03.057Z
2025-09-24T15:53:03.057Z > [email protected] build 2025-09-24T15:53:03.057Z > next build --turbopack 2025-09-24T15:53:03.057Z
2025-09-24T15:53:03.813Z ⚠ Invalid next.config.ts options detected: 2025-09-24T15:53:03.813Z ⚠ Unrecognized key(s) in object: 'serverComponentsExternalPackages' at "experimental" 2025-09-24T15:53:03.813Z ⚠ See more info here: https://nextjs.org/docs/messages/invalid-next-config 2025-09-24T15:53:03.815Z ⚠ experimental.serverComponentsExternalPackages has been moved to serverExternalPackages. Please update your next.config.ts file accordingly. 2025-09-24T15:53:03.822Z Attention: Next.js now collects completely anonymous telemetry regarding usage. 2025-09-24T15:53:03.822Z This information is used to shape Next.js' roadmap and prioritize features. 2025-09-24T15:53:03.823Z You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL: 2025-09-24T15:53:03.823Z https://nextjs.org/telemetry 2025-09-24T15:53:03.823Z
2025-09-24T15:53:03.874Z ▲ Next.js 15.5.4 (Turbopack) 2025-09-24T15:53:03.875Z - Environments: .env 2025-09-24T15:53:03.875Z - Experiments (use with caution): 2025-09-24T15:53:03.875Z · serverComponentsExternalPackages 2025-09-24T15:53:03.875Z
2025-09-24T15:53:03.970Z Creating an optimized production build ... 2025-09-24T15:53:18.954Z ✓ Finished writing to disk in 35ms 2025-09-24T15:53:18.980Z ✓ Compiled successfully in 14.3s 2025-09-24T15:53:18.992Z Linting and checking validity of types ... 2025-09-24T15:53:24.423Z
2025-09-24T15:53:24.424Z ./src/types/next.d.ts 2025-09-24T15:53:24.424Z 1:15 Warning: 'NextRequest' is defined but never used. @typescript-eslint/no-unused-vars 2025-09-24T15:53:24.424Z
2025-09-24T15:53:24.424Z info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/app/api-reference/config/eslint#disabling-rules 2025-09-24T15:53:27.538Z Failed to compile. 2025-09-24T15:53:27.539Z
2025-09-24T15:53:27.539Z Type error: Type 'typeof import("/vercel/path0/src/app/api/profile-data/[id]/route")' does not satisfy the constraint 'RouteHandlerConfig<"/api/profile-data/[id]">'. 2025-09-24T15:53:27.540Z Types of property 'GET' are incompatible. 2025-09-24T15:53:27.540Z Type '(request: NextRequest, context: { params: { id: string; }; }) => Promise<NextResponse<{ error: string; }> | NextResponse<{ posts: ({ likes: { id: string; createdAt: Date; userId: string; postId: string; }[]; comments: { ...; }[]; } & { ...; })[]; followers: number; following: number; }>>' is not assignable to type '(request: NextRequest, context: { params: Promise<{ id: string; }>; }) => void | Response | Promise<void | Response>'. 2025-09-24T15:53:27.541Z Types of parameters 'context' and 'context' are incompatible. 2025-09-24T15:53:27.542Z Type '{ params: Promise<{ id: string; }>; }' is not assignable to type '{ params: { id: string; }; }'. 2025-09-24T15:53:27.542Z Types of property 'params' are incompatible. 2025-09-24T15:53:27.542Z Property 'id' is missing in type 'Promise<{ id: string; }>' but required in type '{ id: string; }'. 2025-09-24T15:53:27.543Z
2025-09-24T15:53:27.562Z Next.js build worker exited with code: 1 and signal: null 2025-09-24T15:53:27.585Z Error: Command "npm run build" exited with 1 debangshumandal@DEBANGSHUs-MacBook-Air blogtravel % vercel --force Vercel CLI 48.1.4 🔍 Inspect: https://vercel.com/mandaldebangshu7-7178s-projects/blogtravel/BibtTdx4335Nb5tjg4zChbRPFbaY [5s] ✅ Preview: https://blogtravel-qljdjtayg-mandaldebangshu7-7178s-projects.vercel.app [5s] 2025-09-24T15:56:13.064Z Running build in Washington, D.C., USA (East) – iad1 2025-09-24T15:56:13.064Z Build machine configuration: 2 cores, 8 GB 2025-09-24T15:56:13.081Z Retrieving list of deployment files... 2025-09-24T15:56:13.085Z Skipping build cache, deployment was triggered without cache. 2025-09-24T15:56:13.600Z Downloading 74 deployment files... 2025-09-24T15:56:14.251Z Running "vercel build" 2025-09-24T15:56:14.624Z Vercel CLI 48.1.1 2025-09-24T15:56:14.930Z Installing dependencies... 2025-09-24T15:56:17.954Z npm warn deprecated [email protected]: You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other. 2025-09-24T15:56:17.955Z npm warn deprecated 2025-09-24T15:56:17.955Z npm warn deprecated (For a CapTP with native promises, see @endo/eventual-send and @endo/captp) 2025-09-24T15:56:35.303Z
2025-09-24T15:56:35.303Z added 514 packages in 20s 2025-09-24T15:56:35.304Z
2025-09-24T15:56:35.307Z 151 packages are looking for funding 2025-09-24T15:56:35.307Z run npm fund for details 2025-09-24T15:56:35.374Z Detected Next.js version: 15.5.4 2025-09-24T15:56:35.380Z Running "npm run build" 2025-09-24T15:56:35.493Z
2025-09-24T15:56:35.493Z > [email protected] build 2025-09-24T15:56:35.494Z > next build --turbopack 2025-09-24T15:56:35.494Z
2025-09-24T15:56:36.288Z ⚠ Invalid next.config.ts options detected: 2025-09-24T15:56:36.289Z ⚠ Unrecognized key(s) in object: 'serverComponentsExternalPackages' at "experimental" 2025-09-24T15:56:36.289Z ⚠ See more info here: https://nextjs.org/docs/messages/invalid-next-config 2025-09-24T15:56:36.290Z ⚠ experimental.serverComponentsExternalPackages has been moved to serverExternalPackages. Please update your next.config.ts file accordingly. 2025-09-24T15:56:36.297Z Attention: Next.js now collects completely anonymous telemetry regarding usage. 2025-09-24T15:56:36.297Z This information is used to shape Next.js' roadmap and prioritize features. 2025-09-24T15:56:36.297Z You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL: 2025-09-24T15:56:36.298Z https://nextjs.org/telemetry 2025-09-24T15:56:36.298Z
2025-09-24T15:56:36.347Z ▲ Next.js 15.5.4 (Turbopack) 2025-09-24T15:56:36.348Z - Environments: .env 2025-09-24T15:56:36.348Z - Experiments (use with caution): 2025-09-24T15:56:36.349Z · serverComponentsExternalPackages 2025-09-24T15:56:36.349Z
2025-09-24T15:56:36.434Z Creating an optimized production build ... 2025-09-24T15:56:49.503Z ✓ Finished writing to disk in 30ms 2025-09-24T15:56:49.537Z ✓ Compiled successfully in 12.5s 2025-09-24T15:56:49.542Z Linting and checking validity of types ... 2025-09-24T15:56:54.334Z
2025-09-24T15:56:54.334Z ./src/types/next.d.ts 2025-09-24T15:56:54.335Z 1:15 Warning: 'NextRequest' is defined but never used. @typescript-eslint/no-unused-vars 2025-09-24T15:56:54.335Z
2025-09-24T15:56:54.335Z info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/app/api-reference/config/eslint#disabling-rules 2025-09-24T15:56:57.207Z Failed to compile. 2025-09-24T15:56:57.207Z
2025-09-24T15:56:57.208Z Type error: Type 'typeof import("/vercel/path0/src/app/api/user-posts/[id]/route")' does not satisfy the constraint 'RouteHandlerConfig<"/api/user-posts/[id]">'. 2025-09-24T15:56:57.209Z Types of property 'GET' are incompatible. 2025-09-24T15:56:57.209Z Type '(request: Request, { params }: { params: { id: string; }; }) => Promise<NextResponse<{ error: string; }> | NextResponse<({ likes: { id: string; createdAt: Date; userId: string; postId: string; }[]; comments: { ...; }[]; } & { ...; })[]>>' is not assignable to type '(request: NextRequest, context: { params: Promise<{ id: string; }>; }) => void | Response | Promise<void | Response>'. 2025-09-24T15:56:57.209Z Types of parameters '__1' and 'context' are incompatible. 2025-09-24T15:56:57.209Z Type '{ params: Promise<{ id: string; }>; }' is not assignable to type '{ params: { id: string; }; }'. 2025-09-24T15:56:57.210Z Types of property 'params' are incompatible. 2025-09-24T15:56:57.210Z Property 'id' is missing in type 'Promise<{ id: string; }>' but required in type '{ id: string; }'. 2025-09-24T15:56:57.210Z
2025-09-24T15:56:57.230Z Next.js build worker exited with code: 1 and signal: null 2025-09-24T15:56:57.251Z Error: Command "npm run build" exited with 1

this will be shown

Current vs. Expected behavior

Current Behavior The build process fails with a type error during compilation. The error message indicates that the context.params object in the GET route handler is not a Promise as expected by my code. This prevents the application from compiling and deploying.

Expected Behavior The build should succeed without any type errors. My code correctly handles the new asynchronous behavior of context.params in Next.js 15+ by using await. The framework's build process should recognize and accept the Promise type for context.params, allowing the application to compile and function as intended.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:51 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T8112
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 24.3.0
  npm: 11.5.2
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 15.5.4 // Latest available version is detected (15.5.4).
  eslint-config-next: 15.5.3
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.5.4
Next.js Config:
  output: N/A

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

Not sure

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

next build (local)

Additional context

Platform: I am deploying the application on Vercel.

Reproducibility: The build fails both on my local machine (macOS) and on the Vercel platform. I have attached the full error logs from both environments.

Technical Details:

Next.js Version: 15.5.4

Node.js Version: (Your Node version, e.g., 20.10.0)

Build Tool: Turbopack (--turbopack)

The error appears to be a type mismatch where my code correctly uses await context.params (as expected in Next.js 15+), but the build process throws an error saying params is not a Promise. This suggests a potential inconsistency in the internal type definitions of the Next.js beta version. I have provided a link to a minimal repository that reproduces this exact issue.

extent analysis

TL;DR

Update the next.config.ts file to replace experimental.serverComponentsExternalPackages with serverExternalPackages and ensure correct type definitions for context.params in route handlers.

Guidance

  • Update next.config.ts to fix the invalid configuration option: replace experimental.serverComponentsExternalPackages with serverExternalPackages as suggested in the error message.
  • Verify that the type definitions for context.params in route handlers match the expected types, considering the asynchronous behavior introduced in Next.js 15+.
  • Review the type error messages to identify and correct any type mismatches, focusing on the GET route handler and the context.params object.
  • Ensure that the await keyword is correctly used when accessing context.params to handle the Promise type.

Example

// In next.config.ts
module.exports = {
  // Replace this line
  // experimental: { serverComponentsExternalPackages: [...] },
  serverExternalPackages: [...],
}

Notes

The issue seems to be related to a combination of an invalid configuration option in next.config.ts and potential type definition inconsistencies in the code. Ensuring the configuration is updated and types are correctly defined should resolve the build error.

Recommendation

Apply the workaround by updating next.config.ts and reviewing type definitions for context.params to ensure compatibility with Next.js 15+. This should allow the build process to succeed without type errors.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING