Skip to main content
Filter by
Sorted by
Tagged with
0 votes
2 answers
290 views

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 ...
VsiON4ALL's user avatar
1 vote
1 answer
369 views

I am trying to set a cookie via a route handler in Next.js (15) but while the login function I have in said handler works, the set cookie function is not doing anything. This is the code I have: app/...
ahols's user avatar
  • 155
0 votes
0 answers
62 views

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: ...
Kaustubh Trivedi's user avatar
4 votes
3 answers
1k views

I am working on a Next.js project with TypeScript and Prisma. When running npm run build, the build fails with the following error: Type error: Type '{ __tag__: "GET"; __param_position__: &...
K khan's user avatar
  • 65
0 votes
0 answers
100 views

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 ...
MadMax's user avatar
  • 1
0 votes
0 answers
187 views

I want to create an API for speech-to-text transcription using AWS SDK v3's AWS Transcribe with Next.js API Routes. I tried to create the following API and hooks based on this reference code, but the ...
user28830650's user avatar
1 vote
1 answer
2k views

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 = &...
tallphin's user avatar
0 votes
1 answer
781 views

I'm new to NestJS and I'm trying to create a JWT-based authentication system. I want to generate a JWT token and manage it on the server side. I'm using Next.js on the frontend, so I was wondering if ...
notVansh's user avatar
  • 219
0 votes
0 answers
120 views

My backend with NextJS export async function DELETE( req: Request, { params }: { params: { productId: string } } ) { try { const storeId = '665a238f72ab3f9616e1a1d8'; const product = ...
Being47's user avatar
  • 101
0 votes
1 answer
864 views

I use fetch() api routes to populate my dashboard page with data. During development I adopted a plan to use try {} catch {} blocks to handle and catch errors, and then pass the error message to a ...
chrisroode's user avatar
1 vote
1 answer
4k views

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) { ...
Anandu Babu's user avatar
0 votes
0 answers
115 views

Node Backend import { NextResponse } from "next/server"; import User from "../../models/post"; const POST = async (req, res) => { try { const body = req.json(); ...
Harsh Singh's user avatar
0 votes
2 answers
477 views

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 ...
Harsh Singh's user avatar
0 votes
1 answer
88 views

I am trying to implement an email address verification feature when someone registers my NextJS website with a WordPress installation as a headless CMS. To do this I want to do the following: Setting ...
Christos Gkoutzis's user avatar
1 vote
1 answer
2k views

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 ...
Muhammad Tohir Rafly's user avatar
3 votes
0 answers
285 views

My (Nextjs) project has a dependency on a external package which exports mostly browser compatible code but also exports some utility function that depend on some nodejs specific modules (for e.g. &...
P.Pras's user avatar
  • 51
0 votes
1 answer
849 views

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 ...
Aflah Najeeb's user avatar
0 votes
0 answers
300 views

I cloned this https://github.com/naufaldi/next-landing-vpn/tree/main repo and trying to add backend to it. So this is my folder structure. There was no app directory. so I added it and made a route. ...
Anita's user avatar
  • 504
1 vote
5 answers
12k views

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 ...
homi420's user avatar
  • 11
0 votes
0 answers
53 views

I have a nextjs project that I call a fake api like jsonplaceholder. everything is ok when I run dev and start it's build. If i change the the api address to the wrong one in purpose, I get error and ...
Mahdi Roshan's user avatar
0 votes
0 answers
134 views

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 ...
linzhe141's user avatar
1 vote
1 answer
3k views

I've successfully connected my app to a postgres database - using prisma (I've set up a seed.ts file, pushed it and the data is sent to the database). The problem I'm having is creating the api ...
user avatar
0 votes
1 answer
3k views

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 ...
Kishore Kumer's user avatar
0 votes
1 answer
341 views

In short NextJS api router failed to call openai api endpoint createChatCompletion() while pure Node.js code can succeed. Detail I use NextJS 's api router as coded here to call "openai api" ...
Nam G VU's user avatar
  • 35.8k