question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

yarn build loading wrong urls for JSONs generated by `getStaticProps`

See original GitHub issue

I’m getting 404 for all of json files. here is an example url that is being loaded: https://site.com/_next/data/m51z0HYNsWKDS2Wgohw7V/post/about-us.json, But there is no such directory data in .next dir. I searched the directory and found that the json file is in .next/server/static/BUILD_ID/pages/posts/about-us.json

To Reproduce

Use getStaticProps and getStaticPaths Run yarn build && yarn start

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
pooriamocommented, Mar 27, 2020

@Timer I’m not proxy passing .next directory. I have create an assets.site.com with a location of location /_next which has an alias to /project/.next;. So nginx is serving next.js files directly. Do you recommend to proxy them too?

1reaction
timneutkenscommented, Mar 27, 2020

/_next/data is mapped to build output, which is expected as per: https://github.com/zeit/next.js/blob/canary/packages/next/next-server/server/next-server.ts#L406-L446

We have tests ensuring getStaticProps works fine with next start

Read more comments on GitHub >

github_iconTop Results From Across the Web

yarn build loading wrong urls for JSONs generated ... - GitHub
I'm getting 404 for all of json files. here is an example url that is being loaded: https://site.com/_next/data/m51z0HYNsWKDS2Wgohw7V/post/about ...
Read more >
NextJS | getStaticProps fails on build - Stack Overflow
I have a problem with getStaticProps and Apollo GraphQL . Part of website is supposed ... I loaded slugs from wrong url i...
Read more >
Data Fetching: getStaticProps - Next.js
When using Incremental Static Generation, getStaticProps will be executed in the background to generate the JSON needed for client-side navigation.
Read more >
Nextjs app deployment failed, but nothing in logs - Render
Hello, since yesterday my builds always failing, but logs seems like everything is ok and also up is up and running in logs,...
Read more >
Duplicate content and no default Next JS redirect from trailing ...
I have deployed next.js 11.1.0 test site and noticed that the redirect from trailing slash is not functional. Both URLs load creating duplicate...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found