Continued Trials: Build Errors on Cloudflare Pages

August 10, 2025 開発ノート Cloudflare build error

Development Image

ONGOING TRIALS: BUILD ERRORS ON CLOUDFLARE PAGES

Although the Git push succeeded, deployment on Cloudflare Pages failed. I faced a series of errors one after another.

  1. SYNTAX ERRORS

Solution: Wrap strings in double quotes, add missing closing tags, and fix basic syntax issues.

  1. TYPESCRIPT TYPE ERRORS

Solution: Strengthen null checks, explicitly set the type like useState<Entry[]>([]), remove console.log, and use String() for type conversion.

  1. CLOUDFLARE PAGES EDGE RUNTIME ERROR

Solution: Add export const runtime = 'edge'; at the top of the page.tsx file.

Since blog/[lang]/tags/[tag]/page.tsx did not exist, a placeholder file was created with runtime = 'edge' added.

  1. CLOUDFLARE PAGES NODE.JS COMPATIBILITY ERROR

Solution: In the Cloudflare Pages dashboard, go to [Settings] → [Functions] → [Compatibility Flags], add nodejs_compat, and enable it.

LESSONS LEARNED

After overcoming this long battle, the joy of finally seeing the site display correctly was truly special. I hope this article will help someone else struggling with the same errors.

← Previous Entry: Real-world Debugging Struggle with Next.js and Cloudflare Pages: From Git LFS to CSP ErrorsNext Entry: Blog start.
← Back to Blog List