© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developers•2w ago•
4 replies
Sourob

Next.js API /health throwing 500 on Cloudflare Pages with @cloudflare/next-on-pages

REST API❓Other (read rules)✅Solved
We have an existing Next.js application deployed on Cloudflare Pages using the package @Cloudflare/next-on-pages.

Recently, we added a simple API endpoint /health as part of plans to make the app fullstack. After deploying to Cloudflare Pages:

The frontend works fine

The API endpoint /health returns Internal Server Error (500)

Some additional context:

We are using Next.js 14.2.21

The package @Cloudflare/next-on-pages is deprecated

The API works locally, only fails in the deployed environment

Has anyone encountered this issue? What is the recommended way to serve Next.js API routes on Cloudflare Pages now that @Cloudflare/next-on-pages is deprecated?

Thanks in advance!
Cloudflare Developers banner
Cloudflare DevelopersJoin
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
85,042Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Next.js on Cloudflare pages
Cloudflare DevelopersCDCloudflare Developers / general-help
11mo ago
Git Integration Next JS Cloudflare pages
Cloudflare DevelopersCDCloudflare Developers / general-help
2y ago
Cloudflare Pages internal error 500
Cloudflare DevelopersCDCloudflare Developers / general-help
3y ago
Query Regarding Cloudflare Health Check API
Cloudflare DevelopersCDCloudflare Developers / general-help
2y ago