@cloudflare/next-on-pages@1.9.0
Minor Changes
-
5712c57: Add new
getRequestContext
utilityIntroduce a new
getRequestContext
utility that allows developer to get access not only
to their Cloudflareenv
but also to theircf
andctx
objectsThe utility can only be used in server-only code (meaning that it is incompatible with
Pages-router components).Usage example:
// app/api/hello/route.js import { getRequestContext } from '@cloudflare/next-on-pages'; export const runtime = 'edge'; export async function GET(request) { const { env, cf, ctx: { waitUntil }, } = getRequestContext(); // ... }
-
06de52e: add new
setupDevPlatform
while deprecatingsetupDevBindings
Previously developers would provide their bindings as inline options passed to
thesetupDevBindings
function (see: https://github.com/cloudflare/next-on-pages/tree/main/internal-packages/next-dev#how-to-use-the-module)Such function has been deprecated and the new
setupDevPlatform
has been added instead as its replacement, the latter does not
require users to use inline options but it reads and gathers the binding definitions from the user'swrangler.toml
file instead,
this is:- consistent with the newly introduced
getBindingsProxy
utility (which is actually being used here under the hood)
(https://developers.cloudflare.com/workers/wrangler/api/#getbindingsproxy) - more convenient for users, since
wrangler pages dev
is also going to read thewrangler.toml
file, making users
only need to declare the bindings at most once for local development instead of twice
- consistent with the newly introduced