Skip to content

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

Open
@nadavarmoni

Description

@nadavarmoni

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions