Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error getiing Dynamic Segmment in the api part ( building with next.js 15.1.17 ) #45

Open
nadavarmoni opened this issue Feb 25, 2025 · 0 comments

Comments

@nadavarmoni
Copy link

When i try to build the project using this "npm run build" command using Next.js version 15.1.7 i get 3 bugs:

Type error: Route "app/api/assistants/threads/[threadId]/actions/route.ts" has an invalid "POST" export:
Type "{ params: { threadId: any; }; }" is not a valid type for the function's second argument.

Type error: Route "app/api/assistants/threads/[threadId]/messages/route.ts" has an invalid "POST" export:
Type "{ params: { threadId: any; }; }" is not a valid type for the function's second argument.

Type error: Route "app/api/files/[filedId]/route.ts" has an invalid "GET" export:
Type "{ params: { threadId: any; }; }" is not a valid type for the function's second argument.

I have solved this problem like this in "threads" part:

export async function POST(request, { params }: { params : Promise<{ threadId }> }) {
const threadId = (await params).threadId;

And in the "files" part:

export async function GET(_request, { params }: { params : Promise<{ fileId }> }) {
const fileId = (await params).fileId;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant