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 { } } )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,
      });
Was this page helpful?