Next.js Discord

Discord Forum

output: 'export' does not create _next/data folders but static site still looks for data json files

Unanswered
Keyhole wasp posted this in #help-forum
Open in Discord
Keyhole waspOP
Hosting on S3 + Cloudfront, the build package doesn't contain _next/data but the site still looks for those json files and gets a 404.

53 Replies

Keyhole waspOP
my CI does that automatically on new deploys. The package itself doesn't have those files. Even when I locally, same thing happens.
Keyhole waspOP
yep
@Keyhole wasp yep
could you show the error
and could you share the url?
Keyhole waspOP
see 404 and no data folder in the build
where do you use official-rules.json in your code
Keyhole waspOP
i dont use it, its the prefetch data for the page.
it helps a little if i turn the links to prefetch={false}
at least no extra pointless requests
you may want to create an issue on github.
a txt file will be generated for prefetching with the route in app folder but not in page folder
Keyhole waspOP
14.0.4
im not using app routes
@Keyhole wasp im not using app routes
yes so it look like a bug for page router
Keyhole waspOP
ugh i have to make a minimum repro
no txt for pages-router.html
Keyhole waspOP
lol i made a min repro repo and it doesn't do it there for some reason
Keyhole waspOP
yeah...
next.js 14.1
i update mine to 14.1
why lol
Keyhole waspOP
nd it still did it!
wtf
I tried with canary too
it doesn't generate txt for pages router
@Keyhole wasp yeah...
oh wait, it only try to fetch the txt on the page on app folder
Keyhole waspOP
why txt
for me its json
@Keyhole wasp for me its json
_next/data should be something for getServerSideProps and getStaticProps
Keyhole waspOP
i dont have those defined
@Keyhole wasp i dont have those defined
could you share the repo?
Keyhole waspOP
i cant
its classified
do you have issue with new project?
Keyhole waspOP
i figured it out
it may be a bug with next
i have a middleware.ts file
that causes it
hmm but middleware doesn't suppose to work with static export?
Keyhole waspOP
right it doesn't
but i think the runtime thinks it should
or does something because of its existence at build time
now i can reproduce
what do you do it the middleware?
let me try it
I got it too
Keyhole waspOP
middleware is so i cna have baseicauth in vercel without paying for enterprise 🙄