Questions tagged [next.js]

Next.js stands as a sleek and streamlined framework, dedicated to crafting server-rendered React applications alongside the ability to export React apps in static format.

Toggle the presence of a string in an array with a checkbox

Currently, I am working on a user creation form for my Next.js front end project using TypeScript. The main goal is to allow an administrator to create new users by filling out a simple form which will generate a basic user object. Here is the structure of ...

Learn the process of importing two components in Nextjs

I have successfully created two components, a header and a footer. I have been able to call the header component directly in the index.js file and it is working fine. You can see the header section displayed below: enter image description here Now, my iss ...

Playfully imitating cross-fetch

I am currently running tests on a Next/React project using Jest with Node. I have also implemented cross-fetch in my project. However, I encountered an issue when trying to mock cross-fetch for a specific component: import crossFetch from 'cross-fetch' je ...

What could be causing an error when using a straightforward pagination tag in Material UI?

I'm attempting to implement pagination using Joy/Material UI, but I'm running into an issue where even adding a simple <Pagination /> tag is resulting in an error. I am working with Next.js. Below is the code snippet that I have: import Layout from ...

Issue with updating state in child component preventing addition to state

Recently, I made the switch to TypeScript in my NextJS project using Create T3 App. One of the components in my app involves updating the state after a Prisma mutation is performed. I attempted to pass the setItems (which was initialized with useState) to ...

The issue with NextJs middleware is that it is unable to access the cookie immediately after setting it. A page reload is

Once the cookie is set, I am unable to retrieve it in the middleware without having to refresh the page first. Why does this occur? The cookie is being set as shown below: import { getCookies, setCookie, deleteCookie, hasCookie } from 'cookies-next&a ...

Conduct a JMeter stress test on a Next.js application to push the limits of available ports

I am completely new to stress testing, just letting you know. A bit of background information about the project, not the question itself: I have a web app built in nextjs14. A client has requested that it be able to support 400-500 simultaneous users conn ...

"I'm perplexed as to why the console.log function is not being triggered when the button is clicked in

I'm facing an issue with a simple task - I want to log something to the console when a button is clicked, but it's not working as expected. I am utilizing the Next.js web app template by Startup Agency and can't figure out why it's not logging to the conso ...

Managing Cache Misses and 'no-cache' Rules in Amazon CloudFront

As I delve into my latest Next.js project, I've encountered an issue with certain pages that have cache headers configured as cache-control: no-cache, max-age=120, must-revalidate. Surprisingly, despite these settings, CloudFront seems to be consistently ...

Having trouble with text decoration not working for a link in Material-UI. Any ideas for a solution?

Currently, I am working on a React/Next.js project and incorporating MUI for the design elements. <Link href="/products"> <ListItem disablePadding> <ListItemButton> <ListItemIcon> ...

AWS Amplify is failing to display i18n translations on dynamic pages within Next.js (directory structure)

Currently experimenting with the next-i18next package within a Nextjs project. Encountering an issue specifically on dynamic pages like: /blogs/[id], where i18n seems to struggle to translate the content properly, displaying keys rather than actual transla ...

Prevent Dropdown from Triggering Unexpected Jumps

I've incorporated the TextField and MenuItem components from Material-UI into my next.js project. By setting the "select" prop in the TextField, it utilizes the Select component internally. However, I'm facing an issue where the dropdown jumps on the scr ...

Generate a list of items in typescript, and then import them into a react component dynamically

I have a variable that stores key/value pairs of names and components in a TypeScript file. // icons.tsx import { BirdIcon, CatIcon } from 'components/Icons'; interface IconMap { [key: string]: string | undefined; } export const Icons: IconMap = { b ...

Issue Confirming Signature - New Version of Next.JS with Stripe Integration

Having trouble verifying the request signature in my Stripe webhook endpoint. I keep encountering this error: No signatures found matching the expected signature for payload. Have you passed the raw request body received from Stripe? I've experimente ...

How to customize the page background color in Next JS

I am currently working on a project using Next Js and have encountered an issue. I have a global.css file set up in the project, but I need to change the background color of a specific page without affecting the rest of the project. Although I have tried u ...

``Are you experiencing trouble with form fields not being marked as dirty when submitting? This issue can be solved with React-H

Hey there, team! Our usual practice is to validate the input when a user touches it and display an error message. However, when the user clicks submit, all fields should be marked as dirty and any error messages should be visible. Unfortunately, this isn&a ...

How can we successfully route to page/index.tsx in Next.js when the root route "/" is already claimed by app/page.tsx?

I just started using Next.js and decided to try out an example. Here is the project structure: src --app -- page.tsx --components Currently, routing localhost:3000 directs to app/page.tsx. Now I want to add a new page folder with an index ...

What could be the reason for receiving the error "client.getVersion is not a function" while using Braintree (Braintree-Web)?

When attempting to render the hostedFields from Braintree, I encounter an issue. After creating a key and obtaining my token, I pass it to my function to create the hostedFields. However, I am faced with an error message stating client.getVersion is not ...

Troubleshooting Error in Converting a JSX File with Tailwind CSS and Typescript

I found a code example on the Tailwind website. However, when I changed the file extension to .tsx, I encountered an error related to the className attribute. Do I need to specify a type for the className variable? What steps should I take to resolve thi ...

Having trouble with AES decryption on my nodeJS/ExpressJS server backend

Looking to decipher data post retrieval from mongoDb. The retrieved data comprises encrypted and unencrypted sections. app.get("/receive", async (req, res) => { try { const data = await UploadData.find(); const decryptedData = data. ...

Stopping event propagation does not function properly when using the Ant Design Dropdown Menu

Within my card component, I have included a Next.js Link that contains the body and footer of the card. The cardFooter section consists of an Ant Design DropDown menu with two items - Share and Report. Despite implementing preventDefault and stopPropagatio ...

What could be causing my middleware to fail in safeguarding routes?

I am currently working with next.js and attempting to implement middleware. My goal is to restrict access to certain pages, such as the profile page, if the user does not have a valid token stored in their cookies. However, I seem to be encountering an iss ...

Issue: tanstack_react_query's useQuery function is not recognized

Error: (0 , tanstack_react_query__WEBPACK_IMPORTED_MODULE_3_.useQuery) is not a function While implementing data fetching in my Next.js project using @tanstack/react-query, I encountered the above error message. Below is the code snippet where the issue ...

Is it possible to extract individual values from the outcome of an SWR query using destructuring?

I'm encountering a simple issue with calling an external API: const fetcher = (...args) => fetch(...args).then(x=>x.json()) const {data:{results}, error} = useSWR("https://xxxxxxxxxxxxxxxx",fetcher) Every time I attempt to destructure th ...

What is the process for testing OTP login functionality using Cypress?

Is there a way to conduct end-to-end testing for OTP login? I have implemented OTP login functionality and now want to create a Cypress test that simulates a user entering the OTP received via email. How can I write a test for this when the OTP changes ev ...

"Exploring the world of custom middleware in NextJs on a localhost

Question regarding nextjs page middleware: the documentation states that the request object should include geo, IP, ua, cookies, and nexturl properties. Visit the link for more information. I am attempting to retrieve the user's location using page middle ...

Executing functions from main component in tanstack table operations

One of the reusable React components I have is: "use client"; import { useState } from "react"; import { ColumnDef, flexRender, ColumnFiltersState, getFilteredRowModel, getCoreRowModel, getPaginationRowModel, ...

The Next.js developer encounters an issue where the build fails due to a ReferenceError on a client component, stating that "window

Just starting out with nextjs, I'm sticking to using only the basic features without diving into any advanced functionalities. During the next build process, I encountered an issue where 6 paths failed because of a ReferenceError: window is not defin ...

Deployment failed: Unable to deploy due to the absence of the 'out' directory

Encountering an error when deploying a Next.js app to Netlify can lead to deployment failure. The specific error message "Deploy directory 'out' does not exist" is a common issue that users face. ──────────────────── ...

Next.js API route is showing an error stating that the body exceeds the 1mb limit

I'm having trouble using FormData on Next.js to upload an image to the server as I keep getting this error. I've tried various solutions but haven't been able to resolve it yet. This is my code: const changeValue = (e) => { if (e.target ...

What is the best way to implement OTP expiration time in Next.js using Firebase?

Could anyone please help me with setting the OTP expire time in Next.js using Firebase? I have searched through the Firebase documentation but haven't been able to find a solution to my issue. Below is the code I am using to send the OTP: const appVerifi ...

SSR alerts pop up when attempting to load specific sections of the primary app interface that are dependent on the ongoing session

I have created an administrative dashboard using Next.Js. My goal is to implement the following functionality: When a user logs in through the /login route Show a loading screen while processing the login In the / route, if the user exists, the app will l ...

What could be the reason for encountering a Typescript ts(2345) error while trying to pass a mocked constant to .mockResolvedValue()?

Within my test.tsx file, I have the following code snippet: test('Photos will load', async () => { const mockCuratedPhotos = jest.spyOn(endpoints, 'getCuratedPhotos'); mockCuratedPhotos.mockResolvedValue(mockPhotos); await render(<Home / ...

Exploring the power of Next.js, Styled-components, and leveraging Yandex Metrica Session Replay

I'm currently involved in a project that utilizes Next.js and styled-components. In my [slug].tsx file: export default function ProductDetails({ product }: IProductDetailsProps) { const router = useRouter(); if (router.isFallback) { return ( ...

Ways to conditionally display a component in Next.js without the issue of caching CSS styles

I'm a newcomer to Next.js and I'm still trying to wrap my head around how the caching works. Let's take a look at this simplified example: An index page that displays either Test1 or Test2 components, based on whether the current minute is ...

Leveraging environment variables in a 'use client' module within a Next.js application

I am facing the issue of not being able to access my .env variables such as GraphQL URL and access token in a 'use client' Apollo context wrapper component that is rendered client-side. Is there any solution for this in Next.js v13? Here is the code snipp ...

Error encounter when loading the chunk for FusionCharts's overlappedbar2d.js in React.js: fusioncharts.overlapped

Currently, I am working on a web application that utilizes next.js and FusionCharts. Within the app, various FusionChart types have already been set up. My task now is to integrate the Overlapping Bars chart as outlined in the following documentation: How ...

What is the best way to retrieve a query in Next.js?

I am facing an issue with two components in Next.js. Let's call them <Navbar /> and <SearchResult />. The <Navbar /> includes a search bar where users can search for items, and a Search button. When the user clicks on the Search button, ...

Error encountered: "Missing fs module in Expo and NextJS build"

After setting up a monorepo for a NextJS + Expo React Native cross-platform application using Solito (), I successfully deployed both web and iOS apps. However, I encountered a build error in the Expo iOS app after accidentally wiping my local repository a ...

The parent logic is still processing while the component is already rendering props.children

Struggling with implementing auth logic in my next.js project as I try to teach myself the framework. I have a specific page, protected/profile, that should only be accessible to logged-in users. To achieve this, I am fetching user data in getServerSidePr ...

Next.js Project Encountering AWS Amplify Authentication Error: "UserPool not configured"

I am currently developing a project using NextJS and integrating AWS Amplify for authentication with Amazon Cognito. However, I am facing an issue where an error message saying "Auth UserPool not configured" pops up when attempting to log in or sign up. I ...

I can't seem to figure out why I keep encountering a runtime error whenever I attempt to create a basic route in the latest version of nextjs, version 13.5

Encountering an error while attempting to create a basic route in app/dashboard/page.tsx. The error message suggests that the contents are not a valid react component, even though they conform to valid react component syntax. Unhandled Runtime Error Erro ...

Contrasting bracket notation property access with Pick utility in TypeScript

I have a layout similar to this export type CameraProps = Omit<React.HTMLProps<HTMLVideoElement>, "ref"> & { audio?: boolean; audioConstraints?: MediaStreamConstraints["audio"]; mirrored?: boolean; screenshotFormat?: "i ...

When navigating to the next page, MUIDataTable displays a "no matching records exist" message for server-side pagination, despite the data being successfully returned in the network tab

In my next js app, I am utilizing MUIDatatable with server-side pagination. The issue I am facing is that even though the data is correctly returned by the API for each page change, it only displays on the first page. When I try to navigate to the next pag ...

The routing in NextJS takes into account both the forward slash (/) and the encoded forward slash (%

I have a URL that looks like this: manage/text_U2FsdGVkX1/7AucFzVPX7OpRHb8Dlk/ApiJsTvYroROv4Ds4oshwC+cg3a7Mz/aO This URL needs to be processed by the route/directory /pages/manage/[id] The ID is test_someEncryptedString However, because of the forward s ...

The hexagons configuration for tsParticles is experiencing technical difficulties

I'm struggling to implement the tsParticles library (specifically using react-tsparticles) in combination with the latest version of Next.js. However, when I try to use the particle.json file and bind it to the <Particles/> component, the partic ...

A New Approach to Fetching Data in Next.js 13.2 using Sanity

Simply put, the main issue revolves around my usage of Sanity as I delve into learning it. While referencing their documentation at , they make use of getStaticProps. Unfortunately, with my utilization of Next.js 13.2 experimental app directory, this speci ...

"Configuring next-images using an existing next.config.js file: A step-by-step guide

I am looking to integrate the npm package next-images into my nextjs application. Upon reviewing the documentation for next-images, it advises creating a next.config.js file with the following code snippet: const withImages = require('next-images&apo ...

styled components are having issues with background gradients and opacity not functioning properly

Hello, I am currently working with styled components and have the following global style code: const GlobalStyle = createGlobalStyle` html{ font-family: roboto; background: linear-gradient(45deg,rgba(137,255,255,0.5),rgba(161,252,143, 0 ...

Troubles with rendering unordered list in the latest Next.js update (version 13)

I am currently using NextJS 13 and facing an issue with printing an unordered list in Next.js. <div className="w-7/12"> <div className="tracking-wide"> <p className=&apo ...

The information stored in the useRef hook experiences a delay when accessed through the useImperativeHandle function

After implementing useImperativeHandle from the Input Component to transfer ref data to the Login Component, I encountered an issue where the emailInputRef data was delayed compared to the inputRef data. const Login = () => { const router = useRouter( ...

Setting up an empty array as a field in Prisma initially will not function as intended

In my current project using React Typescript Next and prisma, I encountered an issue while trying to create a user with an initially empty array for the playlists field. Even though there were no errors shown, upon refreshing the database (mongodb), the pl ...

Render function in Next.js did not yield anything

Recently, I came across the next.js technology and encountered an error. Can anyone help me solve this issue? What could be causing it?View image here import React from 'react' import Button from "../components/button" function HomePa ...

Having trouble showing images from block content using PortableText?

It's been quite a while now that I've been stuck on this issue. Despite being in a learning phase, I find myself unable to progress due to this specific problem. While links and text elements are functioning properly, I have encountered difficul ...

Looking to create a website that renders the page after successfully retrieving the data in Next.js

As a newcomer to Next.js with some knowledge in JavaScript, I am trying to fetch data from an API using the code snippet below. The goal is to display this data on the /blogs webpage: import React from 'react' const blogs = () => { var element (async ...

Utilize a monorepo structure with multiple versioning files for your yarn projects, troubleshoot any issues with yarn version

My NextJS monorepo app is in the following state: The monorepo contains multiple private packages managed through yarn workspaces develop serves as the default branch and testing environment with several commits ahead of main main branch has fewer commits ...

Error messages are displayed by the VS Code MDX Extension when encountering issues with footnotes and default exports

My current project involves using Next.js with Tailwind CSS and MDX for certain pages. Within an MDX file, I have the following export line: export default ({children}) => <div className='prose'>{children}</div> This particular li ...

Utilizing Foundation and jQuery in a Next.js web development project

I've been attempting to incorporate Zurb Foundation's scripts into my next js application, but I keep encountering an error message when trying to include the Foundation core. The error I'm seeing is: /Users/alasdair_macrae/Sites/merlin/spa_ ...

Tips for sending a function with arguments in a React application using TypeScript

Is there a way to streamline passing a handleClick function to the son component so that it does not need to be repeated? The code in question is as follows: Mother Component: const Mother = () => { const [selectedOption, setSelectedOption] = useSt ...

Ways to verify a correct email address using ReactJS

I'm currently working on a project using React.js and Next.js. I'm encountering an issue with handling the Axios response in Next.js as it's displaying "[object Object]" instead of the actual response data. How can I properly handle the resp ...

Having difficulty animating the height transition of the NextJS Image component

On my webpage, I have a headerbar that changes size (from 120px to 70px) when the user scrolls down. I successfully implemented this transition using Tailwind classes and a height transition. Now, I am trying to make the site logo resize along with the hea ...

Is it more suitable for a library used by getStaticProps to be classified as a normal dependency or a dev

When working with NextJS's getStaticProps, I am implementing a library that is only utilized during build time. Should this library be categorized as a regular or development dependency in my package.json? ...

Exploring the power of SCSS modules within Next.js

In my next.js project, I am using next-int to set up languages. Typically, I have components with a module.scss file each. However, I want to avoid duplicating my scss files for styling the Arabic version of my site. The main differences come down to align ...

How can Next.js 14 implement sending fingerprint data from the client to the server with every request?

I am capturing a user's fingerprint in the browser using the following code: "use client" import FingerprintJS from "@fingerprintjs/fingerprintjs" import { useCookies } from "next-client-cookies" import React from "react ...

Storing Data in next-js Cache

Has anyone else encountered issues with data caching in Next.js 14? I have a page (/lib/fetchData.js) where I'm attempting to implement caching, but it seems like the data is always being fetched from the source instead of the cache. Any ideas on what co ...

When I try to deploy to Vercel, I often encounter errors in Next.js that I didn't come across while developing. How can I address these issues pro

Recently, as I began deploying to Vercel, an issue arose where I needed to constantly check for errors during the build process. Strict TypeScript errors and messages like "Can't use <img> tag, please use next/image" kept cropping up after each ...

Next.js is constantly encountering an issue where it throws an error stating "params

I've managed to establish a successful connection between my custom server using Node.js and Express.js with Next.js. The issue I'm facing is when trying to fetch a specific car by its id upon clicking it among other cars, as I keep encountering an error i ...

Can you explain the process of accessing data from [[PromiseValue]] while utilizing React hooks?

My current challenge involves fetching data from an API and utilizing it in various components through the Context API. The issue arises when I receive a response, but it's wrapped under a Promise.[[PromiseValue]]. How can I properly fetch this data to ma ...

Using next.js with SSG can lead to numerous fetch requests resulting in 404 errors for JSON files

Currently, I am utilizing SSG with Next.js and executing "next export" to generate static files in the /out folder. However, upon deployment of the application, I notice an influx of HTTP GET requests from router.js. https://i.stack.imgur.com/Gr6dU.png Th ...

What steps should I take to resolve the NextRouter "not mounted" error when deploying my Next JS 13 app on Vercel

I am encountering an issue while deploying my Next.js 13 app. The error message states: Module not found: Can't resolve 'encoding' in '/vercel/path0/node_modules/node-fetch/lib' Additionally, I am facing a "Next Router not mounted" error. Error: NextRout ...

Having an issue with updating my state using `useState` in Next.js

On my hero section, I have implemented some animations using framer.motion that I only want to display on the initial load. To achieve this, I attempted to use useState and useEffect along with local storage to keep track of whether or not the animations ...

I'm having trouble getting Tailwind CSS colors to work with my Next.js components. Any tips on how to apply background colors

https://i.stack.imgur.com/8RGS3.png https://i.stack.imgur.com/FRTOn.png Hey there! I'm currently experimenting with using Tailwind background colors in my Next.js project. However, I'm facing an issue where the background color is not being applied to com ...

The Drop Down Menu feature in Bootstrap is malfunctioning within the context of a NextJS project

I've built a NEXT.JS application using VS Code. The issue I'm facing is with the drop down menu in the navigation bar - it's not sliding down to display the menu when clicked. Here is the code I'm working with: const loggedRouter = () ...

Why aren't the child elements in my React / Framer Motion animation staggered as expected?

In my finance application, I am creating a balance overview feature. To display the content, I pass props into a single <BalanceEntry> component and then map all entries onto the page. With Framer Motion, my goal is to animate each rendered <Bala ...

Production builds of NextJS do not have access to environment variables

I am facing an issue with my NextJS application that connects to a database through the API. During development, I store my environment variables in a .env file which contains the host, port, username, password, and database details. When I run npm run dev ...