Next.js Discord

Discord Forum

Trying to write an Google Gemini API with NextJS, but there is an error and I don't know how to fix.

Answered
sh1ro posted this in #help-forum
Open in Discord
So this is my code in TypeScript in .txt file, can you guys check it out?
In the line return new NextResponse.json(result.response.text());, I have encountered an error message: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type., how can I fix it? And is there any problem in my code do I have to fix beside that? Sorry for my broken English, and thank you for helping me in the first place.
Answered by joulev
it's either new NextResponse(text) or NextResponse.json(object), not new NextResponse.json(...). check if result.response.text() is an object or a string and choose the right syntax
View full answer

5 Replies

Answer
no problems with those
@joulev no problems with those
Thank you and sorry for bothering you for a weird syntax error. It's fixed now. How can I close the question post?
now to remove it from the channel list simply unfollow the post