Closed jaemil closed 1 month ago
A quick fix could be to try export const GET = handleAuth() as any;
@jaemil Are you able to check on the latest version of the SDK please? I don't see the issue now.
@DanielRivers this happened to us as well during production build on vercel.
Failed to compile.
src/app/api/auth/[kindeAuth]/route.ts
Type error: Route "src/app/api/auth/[kindeAuth]/route.ts" has an invalid export:
"Promise<(req: any, res: any) => any>" is not a valid GET return type:
Expected "void | Response | Promise<void | Response>", got "Promise<(req: any, res: any) => any>".
Expected "Promise<void | Response>", got "Promise<(req: any, res: any) => any>".
Expected "void | Response", got "(req: any, res: any) => any".
Error: Command "npm run build" exited with 1
Code:
import { handleAuth } from "@kinde-oss/kinde-auth-nextjs/server";
import { NextRequest } from "next/server";
export async function GET(request: NextRequest, { params }: any) {
const endpoint = params.kindeAuth;
return handleAuth(request, endpoint);
}
Version: 2.1.15 (latest) and also 2.0.10
@jaemil were you able to fix it or did any workaround help? Thanks!
@Ronak-59 What version of the SDK are you using?
@Ronak-59 What version of the SDK are you using?
@DanielRivers We tried with version: 2.1.15 (latest) and also 2.0.10 of kinde-auth-nextjs and version 14.0.1 of nextjs
Also tried deployment on Netlify and it gave same error there too.
Build process on Vercel/Netlify gives error as I shared above and build process locally gives the error that @jaemil mentioned in the beginning.
Let me know if you need any more information :)
Hey @DanielRivers were you able to reproduce the error or figure out the cause/workaround?
@Ronak-59 I have not succeeded yet. I will try more. If I can't are you willing to jump on a call to investigate?
@DanielRivers Thanks! Sure, happy to jump on a call.
Is this issue still open or someone solved it?
Solution to this issue is buried here (Migration Guide section): https://docs.kinde.com/developer-tools/sdks/backend/nextjs-sdk/#migration-guide
After following this migration guide, my issue got fixed.
If anyone still faces this issue, please try this. @pilladipesh33
@DanielRivers feel free to close this issue, thanks for the help!
Prerequisites
Describe the issue
Hi,
when i try to run
pnpm build
this type error occurs:.next/types/app/api/auth/[kindeAuth]/route.ts:59:7:
Node version: 19.3.0
My package.json:
Any idea how to fix this error? Thanks
Library URL
https://github.com/kinde-oss/kinde-auth-react
Library version
2.1.5
Operating system(s)
Windows
Operating system version(s)
Windows 11
Further environment details
No response
Reproducible test case URL
No response
Additional information
No response