Questions tagged [getserversideprops]
103 questions
0
votes
0 answers
How to make multiple API requests to fetch page data with NextJS - getServerSideProps?
I'm seeing an issue with fetching page data which comprises of 12+ components, each having a separate API endpoint to fetch the data from.
I was using this approach earlier but page performance seems to be taking a hit when making 12 requests like…

Mic Scofield
- 11
- 3
0
votes
1 answer
Nextjs | TypeScript getInitialProps undefined when pass to layout component
hi i am newbie to nextjs
i want to pass dynamic properties to the header, for this i am using getInitialProps in nextjs. getInitialProps working okay, but when i pass to layout component its showing UNDEFINED. Below i have shared my all necessary…

shazim ali
- 360
- 4
- 18
0
votes
0 answers
All the pages with getServerSideProps on my website uploaded to vercel.com return 504
I am developing a website with nextjs, and I am uploading it to vercel. But, when I try to go to the login page it returns 504.
Testing I discovered that it is because of using "getServerSideProps".
If I take it off it works fine. On this page I…
0
votes
0 answers
Getserversideprops providing component with undefined rather than data
I have a Navbar component that I am trying to pull into every "page". I'd like to get the data for it from WPGraphql. I think I can sort that out myself once I have figured out why I'm currently getting:
{ data: undefined }
rather than:
{ data:…

Robin Banks
- 95
- 6
0
votes
1 answer
Updating data from Realtime database using getStaticProps
I have an application with markdown posts and comments taken from a Realtime Firebase database using getStaticProps.
At first, I get all of the paths:
export async function getStaticPaths() {
const files = readdirSync('posts')
const paths =…

Kul
- 3
- 3
0
votes
0 answers
Problemwith Key in Next.js SSG and SSR
I have some problem probably with the key key from SWR.
_app.js
const public = async (query) => {
try {
const client = new GraphQLClient(
`${process.env.NEXT_PUBLIC_API_ENDPOINT}`,
);
const response = await…

portableunit
- 45
- 3
0
votes
0 answers
getServerSideProps on NextJS converting the localhost to ::1
I have a NextJS project which has an index page:
pages/index.jsx
const Home = NextPage = (props) => {
...
...
...
}
export default async function getServerSideProps() {
posts = await('http://localhost:8000/posts/')
…

Mirat Can Bayrak
- 631
- 7
- 18
0
votes
1 answer
How to use resolvedUrl with getServerSideProps in NextJS 13
I need to get the pathname without using client-side rendering but I haven't found how to use the getServerSideProps function.
I first tried using usePathname but it turns the component into client-side. I need to keep it server-side
0
votes
1 answer
In Next.js: How to pass the async data fetched by getServerSideProps... to a component?
Thanks for hopping on the question! I'm still learning and might need you to explain it to me like I'm 5.
What's working well:
On my Homepage, I'm getting data from getServerSideProps and mapping it. The data is being fetched from a data.json within…

fullstackaubrey
- 1
- 2
0
votes
0 answers
How to recall getServerSideProps value without reload the page when the value changed
I want to change languageId value without the page reloading. When the languageId value changes the title of products is changed.
export const getServerSideProps = async ({ req, res, query }) => {
try {
const languageId =…

Eda Avcuoğlu
- 1
- 1
0
votes
0 answers
Data fetching without SWR
When it comes to fetching data i usually use SWR because it's easy-to-use package, but this time i wanted to fetch data using getServerSideProps or getStaticProps, And of course i tried to use SWR inside them.
But as you know, you can't use it…

joehsn
- 21
- 2
0
votes
0 answers
NEXT.JS , fetching single product from mongo db,
I have data in mogno db, all data are fetched , when I click to individual item, I want to display details of item.
On url I can see how _id is changed, I am getting different _id, but console.log(product) show me still same product detail.
It is…

Peret
- 79
- 8
0
votes
0 answers
Next.js not showing data on page/component after getting props from getServerSideProps
I'm getting data from the server with getServerSideProps:
export async function getServerSideProps(context) {
const packageIdentifier = context.params.packageIdentifier;
const data = await getReviewsData(packageIdentifier);
return {
…

ytpm
- 4,962
- 6
- 56
- 113
0
votes
0 answers
AxiosError: connect ECONNREFUSED 127.0.0.1:3000
First question I'm asking, hoping for a "miracle", safe to say I'm a Jr Developer:
I have a NextJs project and I am using Prisma & Supabase. I made it very simple, I only have one item in the database, one index.js page with a getserversideprops…

TheRealMakariuz
- 1
- 1
0
votes
0 answers
Next.js: undefined props in URLs set in the rewrites of next.config.js
Hello very good morning,
I'm building an App with Next.js and I'm facing the following problem.
I want to get the data rendered from the client on a page and I have the following:
// pages/news.jsx
export default function News ({ title }) {
…

Dobo
- 1
- 1