Failed: an internal error occurred

I am trying to setup my nextjs application for the first time. I am keep getting “Failed: an internal error occurred”.

Since i am new to the Cloudflare, can someone help me to identify the issue.

Command i executed next build & next start. I was under the assumption the issue could be due to the wrong out out folder and still the issue exists.

Can you please help me to fix the same.

Is this for Cloudflare Pages? Pages needs a static export of your site, so you’re probably looking to run next export or similar.

Can you share a screenshot of the build, and a full build output? Your repo would also be great to help us debug this.

1 Like

Yes. It’s for Cloudflare pages. That’s the another issue, I am not able to see the full logs. I retried again just to see how it’s behaving.

I don’t think i can run next export because of below error.
Error: Image Optimization using Next.js’ default loader is not compatible with next export.

Error: Image Optimization using Next.js’ default loader is not compatible with next export.

Logs are stuck here and not rolling further. After some time i will get internal server error

It looks like you’re trying to start a server via start which definitely will not work, and after some time the build will time out, as you’ve seen.

As for the image error on export, check out this GitHub issue:

There are a few suggested solutions there such as using a different component for images.

Thanks for the quick updates.

I think i cannot use Cloudflare pages if i understand correctly because I have dynamic pages as well as part of my application.

Do you have any suggestions to deploy a next js which enabled some pages as fallback as true as well.

Unfortunately if you want to do this Pages, I don’t have a good suggestion since you can’t run next.js directly on Pages yet, but it is coming!

RFC: Switchable Next.js Runtime · Discussion #34179 · vercel/next.js · GitHub is a good discussion to follow, and I believe they’re super close to things running on Pages. For now, only the static export is supported as documented here:

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