Service Bindings on NextJS

Hey everyone, I'm trying to get a NextJS setup on workers. My NextJS app needs to make a call out to another worker, which is setup as a service binding. I've gone through the steps of using
wrangler types
to generate types, have the latest versions of everything. But whenever I make a call to
getRequestContext()
I get an error saying that the Cloudflare Request Context can't be loaded.

The other challenge I've got, is that when I set
export const runtime = edge
I get another error saying

OpenNext requires edge runtime function to be defined in a separate function.
See the docs for more information on how to bundle edge runtime functions.


Does anyone know exactly which docs that is referring to?

Thanks in advance
Was this page helpful?