© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developers•2y ago•
1 reply
axel

Pages - Worker binding failing

Any guidance on how to use a make a fetch request to a Cloudflare Worker which is service bound to a Cloudflare Pages next-on-page project?

The relevant service binding is always empty (
{ WORKER: constructor {  } }
{ WORKER: constructor {  } }
)for me when I try to read it from the worker. Very grateful for guidance as this is holding up prod

**Wrangler.toml**

 [[services]]
 binding = "WORKER"
 service = "WORKER-ID"

**get the env in the nextjs app**
const { env, cf, ctx } = getRequestContext();

**Make the fetch request in the nextjs app**

 const response = await env.WORKER.fetch({
        method: 'POST',
        body: formdata,
      });
**Wrangler.toml**

 [[services]]
 binding = "WORKER"
 service = "WORKER-ID"

**get the env in the nextjs app**
const { env, cf, ctx } = getRequestContext();

**Make the fetch request in the nextjs app**

 const response = await env.WORKER.fetch({
        method: 'POST',
        body: formdata,
      });
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
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

pages functions service binding to worker
Cloudflare DevelopersCDCloudflare Developers / pages-help
2y ago
KV & Pages not binding
Cloudflare DevelopersCDCloudflare Developers / pages-help
2y ago
Worker + Assets vs Pages + Worker?
Cloudflare DevelopersCDCloudflare Developers / pages-help
10mo ago
Image transform binding for Pages
Cloudflare DevelopersCDCloudflare Developers / pages-help
11mo ago