Next.js Discord

Discord Forum

console.log in API not visible, App Dir

Answered
Cinnamon posted this in #help-forum
Open in Discord
Avatar
CinnamonOP
Hey, I created a new api route and I have a console.log in there which does not show in the terminal.

The API route works as I get the data if I request the API, but the console.log in the API route does not print to the console.

export async function GET(request: Request, { params }: { params: { id: string } }) {
    const searchParams = new URL(request.url).searchParams;
    
    console.log('get submission by id')
    const obj = buildIncludeObjFromQuery(searchParams.get('include'));

    const submission = await prisma.formSubmission.findUnique({
        where: {
            id: params.id
        },
        include: {
            form: true,
        }
    })

    return NextResponse.json({
        result: submission
    })
}
Answered by Cinnamon
Apparently it was some weird bug, after computer restart it works
View full answer

2 Replies

Avatar
Asian black bear
Are you sure you're checking the terminal console and not the browser console?
Avatar
@Asian black bear Are you sure you're checking the terminal console and not the browser console?
Avatar
CinnamonOP
Apparently it was some weird bug, after computer restart it works
Answer