strapi / starters-and-templates

Monorepo for all official Strapi v4 templates
MIT License
327 stars 117 forks source link

FetchAPI error when deploying Strapi Next.js blog #64

Closed ollycohen closed 1 year ago

ollycohen commented 1 year ago

Hello!

Everything runs smoothly in my development environment (when I run yarn dev). And I can even run yarn run build on my local computer with no problems. I successfully deployed Strapi to Heroku, and that works well. Now, my only problem occurs when deploying the next.js blog to Vercel.

I receive an error with fetchAPI, and I'm curious if anyone else has gotten the same error, attached here.

Screen Shot 2022-10-14 at 1 05 42 PM

From what I've seen on Stack Overflow, you're not supposed to fetch an API route directly from getStaticProps or getStaticPaths, but I don't think we're doing that... aren't we using a helper function fetchAPI in order to not do it directly?

If anyone has had this problem or solved it please let me know!

ollycohen commented 1 year ago

I believe the error has to do with making my deployed Strapi api publicly accessible. Closing this because I don't think there's any issue with the code. Thanks!