Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [nextjs]

Questions related to Next.js in Sitecore context should be considered into this tag.

51 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2 votes
0 answers
30 views

How to split JS bundles by page

On our JSS/Next.js site, we are running into an issue issue with poor PageSpeed performance scores, which are mostly attributable to large JS bundles. They're so large because we have one large main....
Marcel Gruber's user avatar
2 votes
0 answers
46 views

How to figure out which rendering is causing "Error serializing .componentProps[] returned from getStaticProps, undefined cannot be serialized as JSON

I've got a prerendering error that's breaking my builds, and I can't figure out how to track down where in the code the issue is because the error message is so generic when this happens: Error: ...
Erica Stockwell-Alpert's user avatar
2 votes
0 answers
136 views

Modify the domain name for media items in XM Cloud

On our XM Cloud site built using Nextjs the URL for media items is structured as follows: https://edge.sitecorecloud.io/prod/media/project/videos/video1 and it currently works correctly. However, my ...
Aditya Gautam's user avatar
2 votes
1 answer
627 views

Rendering host container returns 500

Whenever I try to access my local Sitecore instance in the Pages editor, it shows an error: Connection to rendering host http://rendering:3000/api/editing/render failed with the following error: The ...
Lala2022's user avatar
2 votes
0 answers
335 views

Mock useSitecoreContext in Nextjs unit tests

I'm trying to write simple unit tests with Jest and mock useSitecoreContext. When I'm mocking the useSitecoreContext like this: useSitecoreContext: jest.fn() I'm getting an error "Cannot ...
Max's user avatar
  • 21
2 votes
1 answer
211 views

Cd url is going to 404

I have downloaded Sitecore Next JS containers setup and installed XP1 in our local instance. But the default CD url is going to 404. The CM Sitecore url including Experience Editor & Preview and ...
Shakti Patro's user avatar
2 votes
1 answer
1k views

NextJS - Cannot destructure property 'datasource' of 'props.fields.data' as it is undefined

Quiet new to NextJS JSS, I'm trying to create a NextJS component which uses integrated GraphQL. But I keep getting this error: import { Text, Link, withDatasourceCheck } from '@sitecore-jss/sitecore-...
Nil Pun's user avatar
  • 2,293
2 votes
1 answer
999 views

How do I create unique Sitecore JSS Dynamic Placeholders?

I have JSS Next.JS based component, I want to have 2 placeholders with the same key, but with a dynamic suffix. e.g. I need 2 equal columns. <div> <Placeholder name='jss-6' rendering={...
Anton's user avatar
  • 3,831
1 vote
1 answer
46 views

Using Next.js with the RestLayoutService

I've been doing some experiments with the XM-Cloud-Introduction GitHub repo. I followed all the Running the Repository steps for Full Local Development Mode. It's working and I also run the ...
Jeroen Breuer's user avatar
1 vote
0 answers
26 views

Fetch LayoutData from either Sitecore 10.3 instance or XM Cloud Instance based on a condition provided by a 3rd party SDK

Long time Front-end specific Sitecore developer, first time question asker on this particular stack exchange. Hopefully, the title explains what I'm after somewhat, but we currently have a Sitecore 10....
Michael D's user avatar
1 vote
0 answers
53 views

Deploying next js to production (on VM)

Is there any guidelines from Sitecore that shows how I can deploy my next app to a VM. The documentation website is talking about Vercel mainly, but what if I want to deploy it to a windows VM, assume ...
Jose's user avatar
  • 63
1 vote
1 answer
79 views

Deploying a JSS App Next JS to Scaled Sitecore environment (Production)

Hello Everybody I am working on a Next Js App over Sitecore it is working fine locally the app is created and working on Localhost but now I need deploy the App to production I have a Sitecore 10.3 ...
Andrew Hany's user avatar
1 vote
1 answer
252 views

Next.js Multisite Add-on not working in local containers because of CORS issues

Wondering, has anyone at all managed to make Next.js Multisite add-on work well? I spent lots of time trying to overcome a CORS issue, which I don't know how to solve. There is a troubleshooting guide,...
Martin Miles's user avatar
1 vote
1 answer
257 views

How to Handle 500 error Page in Sitecore Headless

I have created a custom 500.tsx page under the pages folder. But still, I am unable to get my 500 page working, instead, it shows the default error message. I have tried deleting my custom 500 pages ...
Manoj's user avatar
  • 363
1 vote
0 answers
96 views

Rendering container fails to start: system cannot find the file specified

I am adding a rendering service/container to my solution. I see this error from the rendering container when running docker compose up: Error response from daemon: container ...
Marcel Gruber's user avatar
1 vote
1 answer
226 views

graphql-let codegen giving JavaScript heap out of memory exception

We are working on Sitecore 10.3 with Next.js on Docker. In one of our components, we are trying to get the data from Sitecore. We added a graphql query by creating a file called NavigationIntegrated....
Sumit Bhatia's user avatar
  • 5,095
1 vote
0 answers
89 views

Separate Editing host for Sitecore Headless application in local docker setup

I am trying to create the separate Editing Host (Next.js) for container setup. Sitecore version: 10.3 without SXA Sitecore JSS Next.js SDK version: 21.2.4 without SXA Multi-site add-on For this I ...
Amit Kumar's user avatar
1 vote
1 answer
495 views

Getting error "Ensure that there is only one instance of "graphql" in the node_modules directory"

I am trying to create a Sitecore JSS app for Sitecore 10.3 with nextjs template. I keep getting the error below when I try Jss start command. I am trying to run this in disconnected mode with REST. My ...
Padmaja's user avatar
  • 11
1 vote
1 answer
171 views

Sitecore Forms with NextJs and Hybrid SSG + SSR rendering

I am new to Sitecore JSS and am trying to the implement Sitecore Forms using the hybrid rendering approach [SSR+SSG] in a Sitecore 10.2 with NextJs app. Some selected paths would be SSR rendered and ...
Debasis Mishra's user avatar
1 vote
1 answer
80 views

Error Rendering Sitecore.JavaScriptServices.ViewEngine.Presentation.JsLayoutRenderer: An item with the same key has already been added

I am using Sitecore 10.2. I am able to run my sample nextjs application in connected mode using the command in VS Code terminal jss start:connected. But I am not able to open my application in local ...
user13283's user avatar
1 vote
0 answers
256 views

XMCloud + NextJS 13 AppRouter implementation

We are implementing a headless solution with XMCloud and NextJS. We noticed that sitecore lab sxa-starter already had an example for next 13, but it does not implement AppRouter yet (App Router | Next....
depressed_cubic's user avatar
1 vote
0 answers
73 views

Headless SXA - Ensuring links are localized

We're developing a Language Switcher for our SXA NextJS app, I followed the documentation from NextJS on how to perform the switch and it works (switching from language A to language B) but what I ...
chrono.lala's user avatar
1 vote
1 answer
165 views

Headless/JSS 20 NextJS Prefetch mode

We're building a NextJS app using JSS 20. Next's prefetching behavior differs from local development: On production environments any links on a page are prefetched (for performance reasons), on local ...
Rob's user avatar
  • 111
1 vote
0 answers
129 views

JSS Sitecore Form Button Submission Failed With Anti-Forgery Cookie Issue

JSS NextJS Form Component import { Form } from '@sitecore-jss/sitecore-jss-react-forms'; import React from 'react'; import { NextRouter, withRouter } from 'next/router'; import { sitecoreApiKey } from ...
Krithvik TRS's user avatar
1 vote
1 answer
282 views

Deploy NextJS Headless SXA app into XM1 Container Instance

I am trying to deploy the NextJS Headless SXA app into the Sitecore XM1+ Headless SXA Docker container. For this, i have setup the instance for Sitecore XM1 with following details: SITECORE_VERSION=...
Amit Kumar's user avatar
1 vote
1 answer
323 views

Sitecore JavaScript Rendering SDK (JSS) for Next.js. TypeError: Cannot destructure property 'datasource' of 'props.fields.data' as it is undefined

Issue: TypeError: Cannot destructure property 'datasource' of 'props.fields.data' as it is undefined. Sitecore Experience Platform 10.2 (Sitecore Installation Framework (SIF) PowerShell module) ...
Steve's user avatar
  • 11
1 vote
1 answer
138 views

JSS app not finding the layout after Headless Tenant creation when I deserialize items first

I'm using JSS Next with XM running into Docker and I'm getting a layout not found error, but I don't know where I can validate this. My scenario is the following, I've some serialized items and I know ...
Régner Aguiar's user avatar
1 vote
1 answer
255 views

Sitecore Next.js Sitecore Forms Validation

I faced several issues getting the validation running with Sitecore Forms in combination with Next.js. Issue 1: backend validation is not executed Issue 2: backend validation was not showing up as ...
netbird's user avatar
  • 11
1 vote
0 answers
155 views

Next.js Sample Site Installation Failed

I am trying to install Next.js Helix Example site: Everything looks good until items are serialized: Successfully built ec6606563cd4 Successfully tagged basic-company-nextjs-rendering:latest Starting ...
Vlad Iobagiu's user avatar
  • 18.6k
1 vote
1 answer
162 views

Redirect middleware not working

I wanted to try out the redirects module from SXA though something is quite not right. I created the redirect maps on the Site and republished the Site item as I’ve read in an existing question here ...
Lala's user avatar
  • 396
0 votes
0 answers
24 views

Error Boundary not working in Sitecore JSS with Next.js Project

I am using Sitecore 10.3.1 with JSS-Next.js app version 21.5.3 and Node version 21.7.3. My requirement is to handle client and server errors at the component level. I am currently using the "?&...
Saiprasad's user avatar
0 votes
1 answer
49 views

Sitecore + next.js 301 redirects

Is there a way to handle (receive in the middleware for example) 301/302 status code from Sitecore server returned to next.js as a response for Layout service call? I used to use custom Node based ...
Lukasz123123's user avatar
0 votes
1 answer
71 views

How to handle client or server side errors that occurred in placeholder renderings

I am new to both Sitecore and next.js 13.5+ I created a scaffolded nextjs jsssitecore application using npx create-sitecore-jss nextjs I am trying to create centralized error boundary. When there are ...
SSC's user avatar
  • 1
0 votes
0 answers
49 views

Unable to access subpages in multisite NextJS+XM Cloud

So I have 2 sites under 1 project. My project was created by using https://github.com/sitecorelabs/xmcloud-foundation-head which already had multisite plugin installed and I'm able to setup the ...
rayray's user avatar
  • 81
0 votes
0 answers
46 views

hostname could not be parsed error when hitting custom MapHttpRoute

I am running Sitecore (10.2)/SXA backend in Docker. I am running NextJS directly on my host machine via npm run start:connected. On upstream environments, when I hit /export/doc?id=xxxxxxx, a file is ...
Marcel Gruber's user avatar
0 votes
1 answer
82 views

how to setup docker in local machine after setup sxa headless application

I have Sitecore SXA Headless with a Next.js application running on my local machine. Now, I want to set up Docker for this application. Could you please provide steps for this? Sitecore version: ...
PKH's user avatar
  • 485
0 votes
0 answers
363 views

Vercel Middleware does not run on home page when using config/matcher

I've got a multilingual JSS / Next.JS site. I am integrating Vercel Middleware and looking to exclude certain paths from the middleware without invoking middleware in the process of checking. As a ...
Marcel Gruber's user avatar
0 votes
0 answers
43 views

Chunks/Page<>.js not loading in a Sitecore 10.2 SSG + NextJS after NextJs upgrade

I am looking for some guidance around upgrading NextJs and ReactJs on the with Sitecore 10.2. Please find below the details for the implemetation: Sitecore 10.2 with "Sitecore Headless ver 20.0....
Debasis Mishra's user avatar
0 votes
0 answers
90 views

Sitecore 10.3 JSS 21.0.1 Next.js - Unable to register fields for nested props in manifest definition

I am new to the Sitecore. I have created the Next.js application in disconnected mode. I am trying to register below props in component definition file. fields: { NewsCards: { PreviewImage: ...
pvn sreedhar's user avatar
0 votes
1 answer
224 views

Sitecore XMC NextJS Wildcard Pages

Sitecore NextJS, XM Cloud I need to query an API and get a list of Authors. Let's assume there are 1000 authors. In Sitecore, I created a folder called Authors and an item of template AuthorDetails ...
Anthony Fernandes's user avatar
0 votes
0 answers
156 views

How to dynamically import a component in sitecore jss inside next js application?

I know the conventional way of dynamically importing a component : const Report = dynamic(() => import('PowerBIComponent'), { ssr: false, }); But since application uses [...path] to catch ...
Nishant's user avatar
0 votes
0 answers
177 views

Server Error TypeError: Cannot read properties of null (reading 'key') i18n/graphql-dictionary-service.js

I am running Sitecore 10 locally with Next.js The site works fine in Experience Editor but in normal mode i.e. http://localhost:3000/ I started getting this error below. Tried everything but in vain, ...
Zaheer Tariq's user avatar
0 votes
0 answers
34 views

Unable to access 'FileProperties' JSON of document uploaded to Content Hub DAM to retrieve file extension

Running Sitecore.NET 10.3.0 - November 01, 2022 .NET Framework 4.8 I'm trying to figure out how to retrieve the FileProperties (JSON values) that contains metadata information regarding files uploaded ...
Noel's user avatar
  • 1
0 votes
1 answer
246 views

XM Cloud External Editing Host Configuration

Problem Statement I'm attempting to configure an external editing host using Sitecore's documentation for XM Cloud. My editing host is in Vercel. Headless SXA seems to have moved JSS App configuration ...
Chet Cheeto's user avatar
0 votes
1 answer
276 views

Setting up 500 error page in XM Cloud Sitecore instance with static html pages

I am trying to have setup 500 error page in XM Cloud Sitecore instance. I have configured "Server error page link" in setting item but do not see "Error Handling" tab to generate ...
Akash Savalagi's user avatar
0 votes
1 answer
448 views

Implement Cookie and consent management in Sitecore Headless App

I implemented the Cookie and consent management functionality (Manage a contact's tracking consent choices (sitecore.com)) in the Sitecore 10.1 + Sitecore NextJS (18.0.0) using the Sitecore.Analytics....
Amit Kumar's user avatar
0 votes
0 answers
46 views

What are the Sitecore Next.jss security recommendations for PUT and DELETE HTTP Methods Accepted?

We recently received recommendation that one of the Next.jss sites can be accessed via the URL https://yoursiteurl/sitecore. As part of the Sitecore Next.jss setup, we keep the Sitecore folder at root ...
Jitendra soni's user avatar
0 votes
1 answer
173 views

Multilanguage not working for headless | Sitecore NextJs URLs throw 404 for non English locale

URLs throw 404 when trying with another language, it's only working for en. I can see the JSON response for it when accessing the API. I have added language in CMS, setup the page for it and also ...
Anonymous's user avatar
0 votes
1 answer
778 views

Error during build of sample Next.js app

After creating a JSS Next.js app, I'd like to build it with jss build command and deploy, but that gives me GraphQL related error: ./src/components/graphql/GraphQL-ConnectedDemo.dynamic.tsx:114:72 ...
grg's user avatar
  • 1,811
0 votes
0 answers
551 views

ERROR: Duplicate "graphql" modules cannot be used at the same time when starting code-first NextJS JSS application

I'm trying to create a new code-first NextJS demo using the JSS initializer for experimental purposes only: However, running jss start always gives me this error: I believe this error is caused by ...
Thai Tran's user avatar