42,132 questions
0
votes
0
answers
5
views
Why does Next.js app render CSS on port 3000, but not port 80?
I am trying to deploy a Next.js app on my local machine as a "dress
rehearsal" for deploying on a server.
My Next.js app renders properly (i.e. the human eye will see shapes and
colors in ...
2
votes
1
answer
71
views
How do I resolve `state_mismatch` error with Google OAuth in a Next.js app using Better Auth?
I have a Next.js application with Better Auth setup. I can sign up and log in fine using email and password. I implemented OAuth sign in with Google, but that only worked once or twice. If I somehow ...
1
vote
2
answers
2k
views
How to custom identifiers/primary keys for my resources in react-admin
I have a nextJS project that use redux for state management and react admin for admin panel. I took my keys not as id instead _id. So I followed this custom identifiers.
My App.js
// in src/App.js
...
0
votes
1
answer
30
views
Build Error in ReactPress - error TS6053: File 'src/*.ts' not found
I'm encountering an error when trying to run pnpm run dev in my ReactPress project (version 1.6.0). The build process fails during the build:config step with a TypeScript error stating that files in ...
7
votes
5
answers
20k
views
Can you create a default route in Next.js
Is it were possible to have default routes in Next.js so all routes or a whitelist of routes will all go to a specific page.
For my project the idea is to use Next.js to build the marketing website, ...
0
votes
2
answers
352
views
Sanity studio cannot see env variables
The problem:
I'm using NextJS and Sanity headless CMS.
I want to protect variables such as the project ID.
In my .env file I have the following
SANITY_STUDIO_DATASET=production
...
0
votes
0
answers
19
views
MUI X-date-pickers output and none visible redundant characters
I'm using "@mui/x-date-pickers": "^8.19.0" and @mui/material": "^7.3.4" in a "next": "15.5.6" application with "react-dom": "19.2....
-2
votes
0
answers
116
views
npm run div gives error in my nextjs project
osama@DESKTOP-02L572R MINGW64 /c/laragon/www/tojjar/frontend (osama-newTask)
$ npm run dev
[email protected] dev
next dev
npm ERR! Cannot read properties of undefined (reading 'stdin')
npm ERR! A ...
0
votes
0
answers
26
views
Next.js + AWS Amplify Middleware not redirecting after first login until refresh
I am working on a project using Next.js (App Router) and AWS Amplify Auth. I have implemented middleware to restrict access and redirect users based on a custom Cognito attribute (custom:...
0
votes
1
answer
64
views
Laravel + Next.js show method
I know it's an unconventional pairing, but I am using Next.js and the Laravel stack for my app.
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\...
6
votes
5
answers
5k
views
Error: "PrismaConfigEnvError: Missing required environment variable: DATABASE_URL"
I’m working on a Next.js + TypeScript project with a MySQL database using Prisma.
I set up my configuration in prisma.config.ts like this:
import { defineConfig, env } from "prisma/config";
...
0
votes
2
answers
303
views
How to authenticate a user with Supabase using only userId or email?
I need to create a permanent link that a user can use to authenticate in a Nextjs14 app at any time and as many times as they want.
I tried using generateLink, but this link expires after 24 hours or ...
14
votes
3
answers
22k
views
How to use custom color themes in TailwindCSS v4
My tailwind.config.js in v3 looks like this, but I can't find a way to use it in v4:
theme: {
extend: {
colors: {
lightHover: '#fcf4ff',
darkHover: '#2a004a',
darktheme: '#...
-6
votes
0
answers
30
views
How to view pdf,xlsx,docx,ppt in nextjs from s3 getobject url [closed]
My s3 url is getobject url - .pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=&X-Amz-Date=&X-Amz-Expires=&X-Amz-Signature=&X-Amz-...
0
votes
0
answers
20
views
Next.js artifact built in CodeBuild fails on EC2: MODULE_NOT_FOUND / 'next' not recognized (node_modules missing)
Correctly Deploying Next.js App to EC2 Using CodeBuild + CodeDeploy (Missing next at Runtime)
What I think is happening
CodeBuild successfully runs npm install and npm run build.
The generated ...
0
votes
1
answer
1k
views
NextJS cant resolve 'dns'
I have a problem with NextJS. I get an error 'can`t resolve DNS' when I use getStaticProps and working with MongoDb. Why does this happen? Error occurs only when I have MongoDB code. Also code works ...
2
votes
3
answers
92
views
Running `npm run wp-dev` fails with "Invalid Argument" error
I'm working through the faust.js documentation to create a headless WordPress site with Next.js. I can't get past step two: https://faustjs.org/docs/tutorial/learn-faust/#2-set-up-headless-wordpress-...
-1
votes
2
answers
145
views
ScrollTrigger not working after route navigation (works on localhost, breaks in production)
I'm stuck with a weird ScrollTrigger issue in my Next.js app and could really use some help.
What's happening
I have a section on my homepage that uses GSAP ScrollTrigger to pin and animate when you ...
Best practices
0
votes
2
replies
88
views
Best way to initialize data in next js app router with zustand
I’m building an e-commerce type website in Next.js where there are multiple sections of stores. Each store card has a heart icon to mark it as a favourite.
The same store can appear in:
multiple ...
-5
votes
0
answers
39
views
next js package.json devdependance Question [closed]
in package.json in next js:
"devDependencies": {
"@tailwindcss/postcss": "^4",
"@types/node": "^20",
"@types/react": "^19&...
164
votes
4
answers
112k
views
What is the difference between Next.js and Create React App? [closed]
I'm trying to figure out the difference between Next.js and Create React App (CRA). I know both are there to make our life easier while developing our front-end applications using React.
After ...
-4
votes
0
answers
30
views
Next.js: Hydration failed por “Unexpected attribute cz-shortcut-listen" — como resolver? [closed]
Pergunta
Estou recebendo o seguinte erro ao iniciar meu projeto Next.js:
Hydration failed because the initial UI does not match what was rendered on the server.
Unexpected attribute: cz-shortcut-...
-2
votes
1
answer
88
views
Opening keyboard freezes modal
experiencing this problem on mobile safari where when the modal opens and I choose from any input field that triggers a keyboard, upon keyboard close the whole modal freezes whereby nothing is ...
Tooling
0
votes
2
replies
47
views
How to write tests which analyze HTTP requests made on NextJS server side?
I work on a NextJS project with Pages Router. We are using Jest for unit tests and Playwright for E2E.
The application we are making is a funnel with several steps. Each step is a form with several ...
0
votes
1
answer
25
views
How do I enable streaming in a NextJS app that is self hosted?
We are self-hosting the NextJS app with an Nginx proxy. The streaming functionality allows for the suspense states to show up while the page is loading. I am aware this is available by default if the ...
Best practices
1
vote
3
replies
111
views
What is the best practice for sharing types between a NestJS API with Prisma ORM and client applications?
We currently have a NestJS API using Prisma ORM. The API is used by multiple Next.js applications in different repos. To help with type safety across the various repos, we have a common "types&...
1
vote
2
answers
2k
views
ELIFECYCLE Command failed with exit code 1
When I run pnpm run build, the build fails and ends with the error: ' ELIFECYCLE Command failed with exit code 1.'
"info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/...
0
votes
1
answer
55
views
App Freezing when I submit a form using Actions in Next app?
I'm currently working on my first NextJS app after a long hiatus. The first thing I'm working on is a small app that's powered by Firebase.
After reading some documentation on Context and then ...
-1
votes
1
answer
29
views
How to manage multi-region branding (colors + UI variations) in a single Next.js repo without increasing code complexity? [closed]
I’m working on a telco project that will be deployed across eight different regions.
Each region will have:
Different color branding
Possibly some UI component variations
However, all API ...
0
votes
3
answers
248
views
How to get fresh data in Next.js when using ISR
i am using next.js 15 , Now i am facing an issue suppose when i build my project there was 10 blogs , now i have added one blog more when i visit the site only last 10 blogs are there or even if make ...
-1
votes
0
answers
37
views
Usage of multiple created npm modules in one project via npm workspaces
I have created a Next.js (TypeScript) application, called "vkdgen".
Afterwards, I've created and published a small component library for my project called "vkdFramework4NextJS". ...
-1
votes
0
answers
30
views
Next js 16 Turbopack build error."TypeError: Cannot read properties of null (reading 'constructor')"
After upgrading to next js 16, i'm getting the following error when i run pnpm build. But it is working find when using webpack.
The error:
> pnpm build
▲ Next.js 16.0.3 (Turbopack)
- ...
0
votes
1
answer
99
views
How to ensure full HTML content is rendered on initial load in Next.js for SEO?
I have a Next.js website where I am using client-side features like context providers. However, I am not getting the full HTML content on the initial HTML response. Instead, the content is loaded ...
-1
votes
0
answers
50
views
Is there a way to call the tRPC client with tRPC and @tanstack/react-query setup? [closed]
I have set up my tRPC backend as per the docs which I'll paste in below. My issue is using it with @tanstack/react-query works perfect for 90% of my use cases but I can't physically call my backend ...
4
votes
1
answer
456
views
Next js generate static params breaks intercepting routes
Does anyone else encounter the same issue with intercepting routes, (modal), and `generate static params`? everything works fine when running `npm run dev`, but after building and running `npm run ...
0
votes
1
answer
45
views
Next.js <Image> fails with Directus: "url" parameter is not allowed"
I’m using Next.js 16.0.1 and loading images from a Directus /assets/<id> endpoint.
The Directus asset URL works fine in the browser: https://<directus-domain>/assets/<id>
But when ...
1
vote
0
answers
42
views
Getting a prerender error that a file is consuming server side logic but its client side
I'm using the entry file at the root of my app as a data layer, for redirects depending on session, which I'm retrieving using getServerSession. If at a point no session exists, user should be ...
28
votes
14
answers
58k
views
Error: Vercel - Git author must have access to the project on Vercel to create deployments
I am developing a project with next.js. The project is kept in a secret repository in the company's github account and my github account is authorized in this repository as colabrator. The project's ...
-1
votes
2
answers
2k
views
Warning: Encountered two children with the same key, `` [closed]
I am using ReactJS, NextJS 14, Tailwind CSS and Framer Motion.
I have to put unique keys for each repeated child in React, so I do have to in NextJS. That is also why I put the index value to the ...
0
votes
2
answers
55
views
Tailwind dark mode classes not working even though .dark class is applied [duplicate]
I'm trying to implement dark mode in my Next.js app using TailwindCSS. However, TailwindCSS's dark: classes are not being applied, even when the .dark class is present on the <html> tag.
global....
111
votes
22
answers
180k
views
next.js environment variables are undefined (Next.js 10.0.5)
I am coding a website with Next.js and I tried to add google Tag Manager.
I followed the tutorial on the Next.js Github example but for some reasons I can't access to my environment variables.
It ...
14
votes
7
answers
30k
views
NextJS redirects not redirecting urls after define in next.config.js file
I tried to define redirects in my NextJS app.
but it is not working.
This is how I tried to do it in my next.config.js file:
const withImages = require('next-images')
const withPlugins = require("...
0
votes
1
answer
388
views
create an new app with the latest version of nextjs
I recently wanted to create a new nextjs project, so I used:
npx create-next-app@latest my-app.
I cd'd into the my-app folder and hit yarn to install dependencies, and starting the project produced an ...
0
votes
2
answers
2k
views
How to read .env/.env.local file in Next.js (App Router)
I cannot read the API values in .env / .env.local file in next.js with latest App Router.
As far as I understand, the .env should be enabled under the hood in react.
I have tried many methods from ...
3
votes
2
answers
408
views
"TypeError: Cannot read properties of undefined (reading 'traits')" When using Zod to validate incoming data [closed]
I'm currently trying to validate a JSON object coming from a database into my web app, and I keep getting the error message: TypeError: Cannot read properties of undefined (reading 'traits'). There ...
1
vote
1
answer
140
views
Getting the length of MySQL2 array in TS
I have a query that gets executed. It grabs the records that are currently being logged in. Depending on how many devices, i'd like it to do certain things. However when I try to use
.length it throws ...
Advice
1
vote
1
replies
50
views
How do I make an authenticated request from my Next.js API on Supabase with RLS enabled?
In my case, I only want authenticated users to perform a SELECT query on my database, so I set up my RLS Policy for this scenario. This is where I am hitting an issue. With RLS enabled, I need to let ...
8
votes
2
answers
1k
views
Next.js App Build Fails on AWS Amplify with Missing deploy-manifest.json Error
I'm trying to deploy a Next.js application on AWS Amplify, and it builds fine locally. However, when I push my changes to Amplify, the build fails with an error stating that deploy-manifest.json ...
-1
votes
0
answers
38
views
Work with npm local packages in NextJS project
I need to work with a local package with my next.JS project. To avoid publishing on npm every time :
- On the next.js project: npm i ../test-sample-api. I can now see on my package.json the line : &...
Best practices
0
votes
3
replies
39
views
Nuxt.js pre-render data in the server for the seo purpose
We have a nuxt.js project which is an ecommerce site. We load the products page with first 100 products as SSR. after that we load other products as we needed from the client side using an API call. ...