-
SummaryI’m building a production Next.js app (with auth, Prisma, API routes, and dynamic [id] segments) and I’m hitting a persistent build error inside .next/types that won’t go away — despite following every documented and recommended fix. I’m building a privacy-first, ad-free social platform for families and children. This isn’t experimental — I need to pass a clean build before sharing with users. This ghost-type bug has blocked me for 6+ days and ~70 hours of cleanup work across layout scoping, route retyping, and design rewrites. I truly appreciate the work the Next.js team is doing, but I need clear direction on how to resolve this properly — and avoid this pain again on the next route. Thank you 🙏 Additional information.next/types/app/api/cliqs/[id]/member-actions/route.ts:166:7
Type error: Type '{ __tag__: "POST"; __param_position__: "second"; __param_type__: { params: { id: string; }; }; }' does not satisfy the constraint 'ParamCheck<RouteContext>'.
The types of '__param_type__.params' are incompatible between these types.
Type '{ id: string; }' is missing the following properties from type 'Promise<any>': then, catch, finally, [Symbol.toStringTag] Exampleimport { defineRoute } from '@/lib/utils/defineRoute'; import { getCurrentUser } from '@/lib/auth/getCurrentUser'; import { prisma } from '@/lib/prisma'; import { NextResponse } from 'next/server'; import { z } from 'zod'; export const POST = defineRoute<{ id: string }>(async (req, { params }) => { const { id } = params; // logic omitted return NextResponse.json({ success: true }); }); |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 3 replies
-
Hi, I feel like, to be 100% sure, I need to look at your implementation for defineRoute, but I'd imagine it is something like this import { defineRoute } from '@/lib/utils/defineRoute';
import { getCurrentUser } from '@/lib/auth/getCurrentUser';
import { prisma } from '@/lib/prisma';
import { NextResponse } from 'next/server';
import { z } from 'zod';
export const POST = defineRoute<Promise<{ id: string }>>(
async (req, { params }) => {
const { id } = await params;
return NextResponse.json({ success: true });
},
); Since Next 15, the params are accessed through a Promise. This is part of breaking changes documented here: https://nextjs.org/blog/next-15#async-request-apis-breaking-change |
Beta Was this translation helpful? Give feedback.
-
Thank you so much Joseph! I will check this out. I so appreciate your help!!! |
Beta Was this translation helpful? Give feedback.
-
Well your solution was the ghost killer! THANKS SO MUCH! Sadly, we have some other build errors to address. I am hoping we can get a clean repo tomorrow and deploy or more testing. I don't know how many more days of battling, reconstructing routes, pages I could tolerate. You ROCK! |
Beta Was this translation helpful? Give feedback.
-
Thank you once again. I am far from done, but I deployed again thanks to you! People like you, helping others - it's amazing. I am so grateful. |
Beta Was this translation helpful? Give feedback.
-
Thanks - I didn't notice the mark as answered button! You are very thoughtful. I appreciate it. |
Beta Was this translation helpful? Give feedback.
Awesome, please don't forget to mark an answered - it helps out others with similar errors.