Questions tagged [getstaticprops]
90 questions
0
votes
1 answer
SSGHelpers and GetStaticProps question regarding params
I am trying to use createProxySSGHelpers to prefetch data with trpc in a project I'm working on, and I'm having a hard time figuring out why I cannot get my id from url params is coming back undefined when I can see it in my url bar.
Here is my…

Mossy82
- 115
- 1
- 9
0
votes
1 answer
Nextjs getStaticPaths Error: getStaticPaths is required for dynamic SSG pages . NextJS
I have been trying to use getStatic props in my nextjs project, to pre-render the component for seo purpose. getStaticProps was used inside the pages and when i try to build the project it shows the following error.
"getStaticPaths is required for…

harshad
- 11
- 1
0
votes
0 answers
Webhook revalidation always returning `304` using Supabase
Here is this automatic webhook revalidation response:
image
And here is what I do:
image
As you can see, I send an API request every time I either insert of delete something from the database, but I get a 304 error. However, if I do it manually by…

Kul
- 3
- 3
0
votes
1 answer
getStaticProps return an empty array
hi i'm trying to do a twitch clone with Nextjs,
i'm trying to fetch the twith api with what NextJs offer: getStaticProps so i wrote a code like this but it doesn't work, it return me an empty array and i don't understand why
here is my code :
type…

Matt Freelance Web
- 65
- 1
- 4
0
votes
0 answers
Contentful request works from getStaticProps, but returns 404 from useEffect
I am refactoring an existing Next js project that fetches data from Contentful to render pages. At the moment it fetches the data for breadcrumbs from the getStaticProps function of every single page. I want to fetch it only from the breadcrumb…

intrepidmouse
- 21
- 2
0
votes
1 answer
Revalidation works only in the local mode
So, I have data which needs to be revalidated from a Firebase Realtime database. Everything works fine when I go for yarn run build and then yarn run start. But when I deploy the website to Vercel, the data does not get revalidated. How can I fix…

Kul
- 3
- 3
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
0 answers
Sending a revalidation request once a Firebase Realtime database has been changed
So, recently I have been dealing with making a blog website where the user can both read everything I want to tell them in the text and leave a comment so that I can know their opinion.
I use markdown files to make the blog like that:
export async…

Kul
- 3
- 3
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
2 answers
Cannot read properties of undefined (reading 'map') in nextjs while using getStaticProps
Here in Image you can see the error and the code i've tried.Server Error
TypeError: Cannot read properties of undefined (reading 'map')
This error happened while generating the page. Any console logs will be displayed in the terminal window.
here…

Chetan Menaria
- 1
- 2
0
votes
0 answers
Next js - some destructured props cause crash while others do not
I have a component receiving props from a parent page like so:
where "item" is one object on an array returned from getStaticProps.
Within the component, I am attempting to destructure various properties…

intrepidmouse
- 21
- 2
0
votes
1 answer
Unable to set up dynamic routing in NextJS for routes from Medium API
I seem to be having issues setting up dynamic routing in my Next app.I'm trying to display my Medium.com posts using the unofficial Medium API. I am able to display a list of cards on my homepage with the posts and I want each one to link to it's…

i-am-niall
- 152
- 1
- 12
0
votes
0 answers
getstaticprops returns data as undefined but in postman it's working?
// get data from server using getstatic props
export async function getStaticProps() {
const res = await axios.get("https://pharmaadmin.touchmediaads.com/api/dossier-formats")
console.log(res)
const data = res.data
…
0
votes
1 answer
Nextjs build successful on netlify but site css not accessible
My Nextjs site builds without error on netlify. But the site looks like this and does not pick up the css. The console shows a syntax error Uncaught SyntaxError: Unexpected token '<'. The routing also does not work.
This site works fine when…

RamlahAziz
- 47
- 10
0
votes
2 answers
NextJS Display API message on the page
I have a login form. The user types their username/password into the form and submits it. The form uses fetch() to send a request to the backend API and get a response back.
I'd like to display a message from the API on the page. It'll be…

Scottish Smile
- 455
- 7
- 22