Dynamic Pages that use getStaticPaths failing at build time #13687
Unanswered
danboyle8637
asked this question in
Help
Replies: 1 comment 1 reply
-
@danboyle8637 Hard to help you troubleshoot without code examples/repro. My first guess is that you should log your variables, especially those you're trying to destructure. (and you could use something like Take a look at the demo/code below, it'll show you how we do it using NRN: https://github.com/UnlyEd/next-right-now Demo: https://nrn-v2-mst-aptd-gcms-lcz-sty-c1.now.sh It also uses the recent |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am using both getStaticPaths and getStaticProps to query and pull in data from my Sanity backend.
In development, everything works great.
But when I build my site, my props are all undefined for my dynamic pages only... so clearly the query is not being run.
I think this has to do with my environment variables not being read correctly. In development, I have a .env.development file and I have a similar .env.production to build.
In Vercel, I have my git repo hooked up and I have entered my keys and secrets and endpoints in the environment variables section under the production tab.
I am not using a next.config.js file.
I've looked through the Sanity example and while I do a few things different in regards to getting the data... my getStaticPaths and getStaticProps methods are essentially the same.
All of my errors are a TypeError saying I can't destructure "variable" from undefined.
Anybody run into this... if not I will create a sharable example because I feel like I've tried everything I can think of.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions