Questions tagged [getserversideprops]
103 questions
0
votes
0 answers
Why do query parameters return wrong values in getServerSideProps method in Nextjs?
I have a nextjs project in which I use redux. Query values in getServerSideProps give wrong values in production environment.
export const getServerSideProps = wrapper.getServerSideProps(
(store) => async (context) => {
const { query, locale }…

Caner
- 504
- 3
- 17
0
votes
1 answer
how to correctly fetch data in getServerSideProps
Using Next.js I came across this problem:
As soon as I reach pages/users, I got this error
./node_modules/mongodb/lib/cmap/auth/gssapi.js:4:0
Module not found: Can't resolve 'dns'
Import trace for requested…

D.D.
- 99
- 10
0
votes
0 answers
I want to fetch my passport js url endpoint using getServerSideProps in next js
I can fetch and get logged in user data without using serverside props but I can't get the data using getServerSideProps in next js. I think the reason is. it is not sending cookies with get request.
frontend
import axios from "axios";
import React,…

Sajib Hossain
- 81
- 2
- 8
0
votes
3 answers
pass object from one page to another page NextJS
I want to pass nested object data from one page to the next page. I want to pass the object. We can not use localStorage or sessionStorage because we have to consume object values from getServerSideProps. We do not use here router query as it passes…

Rahul Shinde
- 168
- 3
- 12
0
votes
1 answer
getServerSideProps external api data fetching returns error
My http axios api data fetch attempt inside the getServerSideProps function always returns error. I am succcessfully recovering token and userId from cockies, and trying to pass them as parameters to make server api call.
export const…

Djony
- 151
- 1
- 2
- 14
0
votes
1 answer
how to change api calls when dropdown values changes nextjs
I am working on a nextjs project that is a calendar. when country and year changes calendar should change and I use a holidays API. API url contains country and year parameters(https://localhost:5001//holiday?&country=${country}&year=${year}). SO I…

hanu
- 53
- 1
- 10
0
votes
1 answer
NextJS, how to upload a server-side rendered application to my FTP account
I appreciate all of your help. I like how create-react-app allows you to run NPM RUN BUILD and then upload the "Build" folder to your FTP directory.
How is this possible with NextJS? I built my app and ran NPM RUN BUILD, but do not see a Build…

Bruce Chamoff
- 31
- 1
- 5
0
votes
2 answers
How Next.js fetch data when user route to another page which uses getServerSideProps?
I am from React background. React application servers entire website on first request and then uses useEffect() hook for data fetching. I heard that Next.js also do the same thing.
But my doubts are:
How and what files Next.js serves. Whether it…

Partheev
- 1
- 3
0
votes
0 answers
How to check whether user is authenticated or not in getServerSideProps [NodeJS - Backend]?
I'm using NextJS for my frontend and NodeJS(Express) for the back. I tried using the getServerSideProps to check and pre-render whether user is authenticated or not but it doesn't work. I tried adding credentials: 'include' but it didn't work…

Ronchi
- 1
- 1
0
votes
1 answer
how to show Loading indicator while fetching data uisng getserversideprops
I want to show a loading icon while fetching data from external API using getseversideprops.The loading indicator is working while changing the route but i want to show loading indicator while pre-rendering the page using getServerSideProps.

Paras Buda
- 51
- 1
- 6
0
votes
1 answer
How do I pass a prop from from component to getServerSideProps() in NextJS?
I want to pass a props from my component to getServerSideProps(). They are both on the same page. I the code below I want pass url from my component to getServerSideProps() so that I can use the same url to get the data from API.
export default…

Srijan Saha
- 1
- 1
0
votes
0 answers
Filter multiple value with getServerSideProps from query result
How to have filtered multiple results in a getServerSideProps. I send all my results the query parameter:
const filtersUsers = (changedValues, allValues) => {
router.push({
query : { ...allValues },
})
}
In my URL I get this result…

Cyril
- 1
- 3
0
votes
1 answer
Nextjs centralized authorization
I'm building an app where I need to authorize the users based on 'mode' queryParameter & apikey that comes from the consuming applications.
It will then send an api request to backend and confirm if the user has the authorization. Also want to…

Explorer
- 155
- 14
0
votes
1 answer
How to make next-auth User Session Data Globally accessible from _app.js server-side?
What is the best way to make next-auth user data in session globally accessible in all pages server-side?
or do I need to manually add getServerSideProps to every page to get the session user data?
…

yeln
- 462
- 2
- 10
- 23
0
votes
1 answer
Show div when there's not data available in getServerSideProps with NextJS?
Ok, this is my third post regarding NextJS.
I'm currently making a search page which needs to fetch data from 3 endpoints according to the keyword found in the URL; if no data found, show a message in the proper call.
The current behaviour throws an…

Kirasiris
- 523
- 10
- 37