24 questions
0
votes
2
answers
275
views
Issue with Next.js 15.13 with promises and params
Writing a dynamic api route for page that accepts [slug] params.
export async function GET(request: NextRequest, { params }: { params: Promise<{ slug: string}> }) {
const {slug} = await ...
0
votes
0
answers
62
views
How to create API with multiple text and file Fields in Next JS 14 with multer?
I am working on an API in Next.js 14+ where I need to upload files. Here are the fields I am using:
name: string
description: string
profile_picture: single image
documents: multiple files
images: ...
0
votes
0
answers
100
views
Getting 404 (Not Found) error when posting to /api/message in Next.js
I'm encountering an issue with a Next.js API route. I'm making a POST request to the /api/message endpoint, but it returns a 404 Not Found error. Here’s the context:
File Structure:
The API route is ...
1
vote
1
answer
2k
views
Accessing User-Agent from Next.js Route Handler?
I'm trying to access a request's User-Agent header from a route handler I have on my next.js project.
Here is an example:
import { userAgent } from "next/server";
export const dynamic = &...
0
votes
0
answers
120
views
I am able to receive the error from an Api call in my backend but it fails to show when i read it from the frontend in Next JS
My backend with NextJS
export async function DELETE(
req: Request,
{ params }: { params: { productId: string } }
) {
try {
const storeId = '665a238f72ab3f9616e1a1d8';
const product = ...
1
vote
1
answer
4k
views
How to properly send a blob or file as api response in next 13
I am trying to send a blob (will be a file from another API in future) as the response for a api call in next13 api routes. My handler goes like:
export default async function handler(req, res) {
...
0
votes
2
answers
474
views
NextResponse not returning data to the frontend?
This API calculates the BMI and sends it to the frontend. I have tried console logging the response, but it does not have the BMI in it. I assume this is because of some unsynchronous behaviour.
This ...
1
vote
1
answer
2k
views
NextResponse returning 200 while the response from the endpoint is 400
I was using Route Handler for fetching from external endpoint. The external endpoint is returning status 400 or any error, but when I locally hit API from the client component (e.g /api/route.ts) I ...
0
votes
1
answer
845
views
Even Simple Next.js API timeout on Vercel
Every API in the NextJS project is giving a 504 bad gateway time out error only in vercel production deployment, everything works fine in local, so I added a hello GET API with the sample code.
export ...
1
vote
5
answers
11k
views
Integrating Socket.io with Next.js 14 /api Routes
I'm currently working on a project using Next.js 14 and I'm facing challenges integrating Socket.io with the /api routes. I've explored various resources but haven't found a clear and concise guide on ...
0
votes
0
answers
134
views
Vercel production environment post handle function cause get handle function response error data in nextjs13
The GET and POST handle functions are written in the api/nav/route.ts file at the same time. The development environment is normal. However, after deployment through vercel, the GET request returns an ...
0
votes
1
answer
3k
views
Next Js Response Header redirection
Objective:
What I am trying to achieve: With a button click from a page the req will reach the controller. The controller will set some cookie, when the response will redirect the page to another ...