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
sh1roOP
So this is my code in TypeScript in .txt file, can you guys check it out?
In the line
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 syntax5 Replies
@sh1ro 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.
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 syntaxAnswer
@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
sh1roOP
Oh, syntax error? My bad. But is there any problem with the API key type or anything too?
no problems with those
@joulev no problems with those
sh1roOP
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