Why my Deployed Sites 404 Error

I have just created Cloudflare pages deployement and build was success.

But when i click the visit site link. It gives 404 error.

Here is the link https://goodprofile-landing-nextjs.pages.dev/

Does the build work locally? Does it produce an index.html file on the root?

Not on the root, but yes.

Have you changed the output directory to match that of your project?

2 Likes

yes, it is .next

And there is an index.html in the .next folder, I’d assume…

It is in another folder
like the document Deployment | Next.js

.next/server/pages

So, yeah. That won’t work. That will need to be deployed to somewhere which actually runs code if you are doing SSR. Pages supports only (unless you write Functions) static files.

To add onto this, as of May 2022 Next.JS Server Side Rendering (SSR) isn’t supported at all even on Cloudflare Functions yet. You’ll either need to build to static files or switch to another framework.

1 Like

Nor on Workers, I think. Hopefully one day, when Vercel moves to more standardised features.

yes it worked with static export.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.