What is `data` used for in Pages Functions?

I notice there is a data field in the type definition for Event for Cloudflare function:

type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
  request: Request;
  functionPath: string;
  waitUntil: (promise: Promise<any>) => void;
  next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
  env: Env & { ASSETS: { fetch: typeof fetch } };
  params: Params<P>;
  data: Data;
  pluginArgs: PluginArgs;
};

What does that data field do? To get the request body, I will be using the request field. I cannot find any description of that field in the doc.

data, // arbitrary space for passing data between middlewares

https://developers.cloudflare.com/pages/platform/functions/

2 Likes

Thanks I have totally missed that

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.