diff --git a/README.md b/README.md index 27fa73e..63fa337 100644 --- a/README.md +++ b/README.md @@ -157,12 +157,13 @@ router return NextResponse.json({ user }); }); +// Make sure to cast the handler return to `Promise` to prevent type error with next.js 14 app router in production/preview deployments. export async function GET(request: NextRequest, ctx: RequestContext) { - return router.run(request, ctx); + return router.run(request, ctx) as Promise; } export async function PUT(request: NextRequest, ctx: RequestContext) { - return router.run(request, ctx); + return router.run(request, ctx) as Promise; } ```