Questions tagged [getserversideprops]
103 questions
0
votes
0 answers
NextJS App Routing How to send, recieve and use form data from a POST request?
Handling forms and form data with NextJS App Routing.
I have a page that has a simple form with two fields. I use the action and method attributes of the form element.
Let's call the first page page1 and the other page page2.
I load page1 in the…

Chris J.
- 1
- 1
0
votes
1 answer
Next.js getServerSideProps getDocs with Firebase Firestore rules
if i am using this rules at firestore
match /{document=**} {
allow read, write: if true;
}
getServerSideProps can get my data from firestore but if start using
match /{document=**} {
allow read, write: if request.auth != null;
}
i get
[Error…
0
votes
0 answers
problem with passing props to page with getServerSideProps()
I'm trying to build a nextJS app with firebase (building a twitter-clone for training) and now I want to fetch() the tweets in my DB to render them on my page using getServerSideProps() function here is my code ->
Home.jsx components
import {…

fares.dev
- 1
- 1
0
votes
0 answers
Next js get server side props returns 502 when using promise.all ( only 7 promises or more )
here is my nextJS page
import AuditForm from 'containers/AuditForm';
import { useEffect } from 'react';
import { useStore } from 'store';
import { fetcher, fetchMany } from 'utils/fetcher';
const EditId = ({
editId,
auditors,
contractors,
…

shahriyardm
- 1
- 2
0
votes
0 answers
Passing Set-Cookie from external server in getServerSideProps to browser
I am trying to fetch some data via Apollo Client during SSR in the NextJS getServerSideProps method from an external graphql server.
The server response has a Set-Cookie header with a session id.
Later on, however, I also want to send queries from…

S. Somorjai
- 1
- 1
0
votes
0 answers
Next.js fallback rewrites return no props from getServerSideProps, when accessed via next/link on Vercel
I have rewrites defined under afterFiles: and fallback: in next.config.js
In my local dev environment, both sets of rewrites work perfectly.
When running on Vercel, the fallback rewrites do not work properly with my getServerSideProps functions…

user5801710
- 301
- 1
- 9
0
votes
0 answers
next-pwa + next-auth: redirect is not working when offline
In my Next app I'm using next-pwa for offline support as well as next-auth for authentication. next-pwa is configured like this:
const customCache = [
{
urlPattern: /^https:\/\/use\.(?:typekit)\.net\/.*/i,
handler: 'CacheFirst',
…

user2921009
- 711
- 1
- 10
- 21
0
votes
0 answers
NextJs not returning the serversiderenderingprops for "/" url
I've started working with Nextjs with the purpose of server-side-rendering so that I can feed dynamic values to metatags for each URL. [ reactjs doesn't work easily here ].
Now In Nextjs, I'm trying to load all the data from Firebase and show a few…

Harsh Sharma
- 3
- 3
0
votes
0 answers
How to get express session in getServerSideProps() - Express, Nextjs
I want to set up a checkout page while preventing users that aren't connected and do not have any current cart to access this page.
I'm trying to implement this verification on getServerSideProps() function.
Cart information is stored in…

Thano
- 13
- 1
- 3
0
votes
1 answer
MongoDB NextJS connection error "attempted to check out a connection from closed connection pool"
I'm trying to make a connection to my MongoDB database in order to retrieve sone data.
When I'm setting up the connection without fetching anything, no issues.
But when I'm trying to grab some data, the console throws me this:
attempted to check out…

Horkos
- 227
- 2
- 5
- 12
0
votes
1 answer
Next.js redirect with query params does not work
I am writing a page that uses the id and token to make a request to the backend and based on the result the user is redirected to either the register page or the login page with some query params
The redirect works as…

toster
- 1
- 2
0
votes
1 answer
Trying to set cookie in getServerSideProps using next.js
I am trying to set the cookie in the getServerSideProps, i am able to read it using `req.headers.cookie but when trying to set it, it doesnt work i tried also using other libraries like cookies-next but it did not persist:
here is the middleware…

Camille Basbous
- 299
- 5
- 11
- 34
0
votes
0 answers
NextJS getServerSideProps with MongoDB is so slow it makes Vercel timeout
Using getServerSideProps within my NextJS + MongoDB app makes it timeout when deployed.
Loading times and server responses are incredibly slow as well.
I'm using them like this:
const clientPromise = await getClient()
const posts = await…

Horkos
- 227
- 2
- 5
- 12
0
votes
0 answers
A Better way of using Next.js getServerSideProps
I have a simple application that displays some informaiton and lets users update the informaitn using Forms. To increase security, I want all my POST and GET requests to be initiated from the server and not from the client browser. How can one do…

user1872371
- 321
- 2
- 12
0
votes
0 answers
Why does my Nextjs route parameter sometimes resolve to "null" when it is explicity defined
I noticed that when I go to the route "/stream/[provider]/[streamerId]" in my browser the page loads successfully, but I can also see the page also prints to console a 404 stating that the url is "/stream/YouTube/null", even though I passed in the…