[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-netlify-netlify-functions":3,"mdc--9sbcwf-key":33,"related-repo-netlify-netlify-functions":4045,"related-org-netlify-netlify-functions":4153},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":23,"repoUrl":24,"updatedAt":25,"license":26,"forks":27,"topics":28,"repo":29,"sourceUrl":31,"mdContent":32},"netlify-functions","write Netlify serverless functions","Guide for writing Netlify serverless functions. Use when creating API endpoints, background processing, scheduled tasks, or any server-side logic using Netlify Functions. Covers modern syntax (default export + Config), TypeScript, path routing, background functions, scheduled functions, streaming, and method routing.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"netlify","Netlify","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fnetlify.png",[12,16,17,20],{"name":13,"slug":14,"type":15},"Backend","backend","tag",{"name":9,"slug":8,"type":15},{"name":18,"slug":19,"type":15},"API Development","api-development",{"name":21,"slug":22,"type":15},"Serverless","serverless",24,"https:\u002F\u002Fgithub.com\u002Fnetlify\u002Fcontext-and-tools","2026-07-14T05:40:31.648184",null,5,[],{"repoUrl":24,"stars":23,"forks":27,"topics":30,"description":26},[],"https:\u002F\u002Fgithub.com\u002Fnetlify\u002Fcontext-and-tools\u002Ftree\u002FHEAD\u002Fskills\u002Fnetlify-functions","---\nname: netlify-functions\ndescription: Guide for writing Netlify serverless functions. Use when creating API endpoints, background processing, scheduled tasks, or any server-side logic using Netlify Functions. Covers modern syntax (default export + Config), TypeScript, path routing, background functions, scheduled functions, streaming, and method routing.\n---\n\n# Netlify Functions\n\n## Modern Syntax\n\nAlways use the modern default export + Config pattern. Never use the legacy `exports.handler` or named `handler` export.\n\n```typescript\nimport type { Context, Config } from \"@netlify\u002Ffunctions\";\n\nexport default async (req: Request, context: Context) => {\n  return new Response(\"Hello, world!\");\n};\n\nexport const config: Config = {\n  path: \"\u002Fapi\u002Fhello\",\n};\n```\n\nThe handler receives a standard Web API `Request` and returns a `Response`. The second argument is a Netlify `Context` object.\n\nThe bare default export shown above is the recommended form. The default export can also be an object with a `fetch` method — prefer this form only if (1) other functions in the project already use it, or (2) the function also subscribes to platform events (see [Event Handlers](#event-handlers) below), since events are exposed as named handlers on the same object:\n\n```typescript\nexport default {\n  fetch(req: Request, context: Context) {\n    return new Response(\"Hello, world!\");\n  },\n};\n```\n\n## File Structure\n\nPlace functions in `netlify\u002Ffunctions\u002F`:\n\n```\nnetlify\u002Ffunctions\u002F\n  _shared\u002F           # Non-function shared code (underscore prefix)\n    auth.ts\n    db.ts\n  items.ts           # -> \u002F.netlify\u002Ffunctions\u002Fitems (or custom path via config)\n  users\u002Findex.ts     # -> \u002F.netlify\u002Ffunctions\u002Fusers\n```\n\nUse `.ts` or `.mts` extensions. If both `.ts` and `.js` exist with the same name, the `.js` file takes precedence.\n\n## Path Routing\n\nDefine custom paths via the `config` export:\n\n```typescript\nexport const config: Config = {\n  path: \"\u002Fapi\u002Fitems\",                    \u002F\u002F Static path\n  \u002F\u002F path: \"\u002Fapi\u002Fitems\u002F:id\",            \u002F\u002F Path parameter\n  \u002F\u002F path: [\"\u002Fapi\u002Fitems\", \"\u002Fapi\u002Fitems\u002F:id\"], \u002F\u002F Multiple paths\n  \u002F\u002F excludedPath: \"\u002Fapi\u002Fitems\u002Fspecial\", \u002F\u002F Excluded paths\n  \u002F\u002F preferStatic: true,                \u002F\u002F Don't override static files\n};\n```\n\nWithout a `path` config, functions are available at `\u002F.netlify\u002Ffunctions\u002F{name}`. Setting a `path` makes the function available **only** at that path.\n\nAccess path parameters via `context.params`:\n\n```typescript\n\u002F\u002F config: { path: \"\u002Fapi\u002Fitems\u002F:id\" }\nexport default async (req: Request, context: Context) => {\n  const { id } = context.params;\n  \u002F\u002F ...\n};\n```\n\n## Method Routing\n\n```typescript\nexport default async (req: Request, context: Context) => {\n  switch (req.method) {\n    case \"GET\":    return handleGet(context.params.id);\n    case \"POST\":   return handlePost(await req.json());\n    case \"DELETE\": return handleDelete(context.params.id);\n    default:       return new Response(\"Method not allowed\", { status: 405 });\n  }\n};\n\nexport const config: Config = {\n  path: \"\u002Fapi\u002Fitems\u002F:id\",\n  method: [\"GET\", \"POST\", \"DELETE\"],\n};\n```\n\n## Background Functions\n\nFor long-running tasks (up to 15 minutes). The client receives an immediate `202` response; return values are ignored.\n\nEnable background mode by setting `background: true` in config:\n\n```typescript\nexport default async (req: Request) => {\n  await someLongRunningTask();\n};\n\nexport const config: Config = {\n  path: \"\u002Fprocess\",\n  background: true,\n};\n```\n\nStore results externally (Netlify Blobs, database) for later retrieval.\n\nThe legacy filename convention (`process-background.ts`) is still supported, but new functions should use `config.background`.\n\n## Region\n\nFunctions deploy to `cmh` (Ohio) by default for new sites. This is a deliberate choice: US East is centrally located for an international audience, has a broad provider ecosystem, and gives most projects the lowest overall latency without any configuration. Sites created before October 4, 2023 may have a different default region — check Project configuration > Build & deploy > Continuous deployment > Functions region to confirm.\n\nDo NOT override `config.region` unless the user has stated a specific reason — for example, a database or backend service in another region with measurable roundtrip savings, a data-residency requirement, or an audience concentrated in one region whose compute dependencies (database, backend services) also live in that region.\n\nTwo constraints to be aware of before adding `config.region`:\n\n- A function runs in exactly one region. Don't try to deploy the same function to multiple regions — if the user wants geo-routing, route between distinct functions with an edge function instead.\n- For framework adapter–generated functions (Next.js, Astro, Nuxt, etc.) the region must be set site-wide in the Netlify UI, not via `config.region` in code. The generated files can't carry per-function config.\n\nRegion values are IATA airport codes — for example `cmh` (Columbus\u002FOhio, the default), `dub` (Dublin), and `fra` (Frankfurt). See [Region](https:\u002F\u002Fdocs.netlify.com\u002Fbuild\u002Ffunctions\u002Fconfiguration#region) for the full list of supported regions and details.\n\n## Memory or vCPU\n\nFunctions run with 1024 MB of memory and a proportional amount of compute by default. The default fits most workloads, and raising it has a direct cost impact: function billing scales linearly with the configured size.\n\nDo NOT set `config.memory` or `config.vcpu` speculatively. Only reach for them when:\n\n- The workload is known to be memory- or compute-intensive (AI inference, image\u002FPDF manipulation, large payload processing, CPU-bound work).\n- The function is hitting out-of-memory errors or timeouts caused by the function's own work, rather than by waiting on an external service or database.\n\n`memory` and `vcpu` configure the same underlying resource and are mutually exclusive — set one, not both. Set `memory` as a number of megabytes (e.g. `memory: 2048`) or as a string with a unit (e.g. `'2gb'` or `'2048mb'`, case-insensitive), within the 1024–4096 MB range. Adjusting them is available only on Credit-based Pro and Enterprise plans; on other plans these settings have no effect. See [Memory or vCPU](https:\u002F\u002Fdocs.netlify.com\u002Fbuild\u002Ffunctions\u002Fconfiguration#memory-or-vcpu) for accepted values and the exact mapping.\n\n## Scheduled Functions\n\nRun on a cron schedule (UTC timezone):\n\n```typescript\nexport default async (req: Request) => {\n  const { next_run } = await req.json();\n  console.log(\"Next invocation at:\", next_run);\n};\n\nexport const config: Config = {\n  schedule: \"@hourly\", \u002F\u002F or cron: \"0 * * * *\"\n};\n```\n\nShortcuts: `@yearly`, `@monthly`, `@weekly`, `@daily`, `@hourly`. Scheduled functions have a **30-second timeout** and only run on published deploys.\n\n**Testing and triggering.** A scheduled function does **not** fire on its cron schedule under `netlify dev` — the local dev server never runs the schedule, so waiting for the clock will appear to do nothing. Test it by invoking it directly: `netlify functions:invoke \u003Cname>` calls the function once, on demand. In production a scheduled function also has **no public HTTP URL** — it is not reachable at `\u002F.netlify\u002Ffunctions\u002F{name}` and cannot be triggered by an external HTTP request; it runs only on its schedule. If you also need to trigger the same work over HTTP (a manual \"run now\" or a webhook), expose that logic through a separate ordinary HTTP function and share the implementation rather than trying to POST to the scheduled function.\n\n## Streaming Responses\n\nReturn a `ReadableStream` body for streamed responses (up to 20 MB):\n\n```typescript\nexport default async (req: Request) => {\n  const stream = new ReadableStream({ \u002F* ... *\u002F });\n  return new Response(stream, {\n    headers: { \"Content-Type\": \"text\u002Fevent-stream\" },\n  });\n};\n```\n\n## Event Handlers\n\nA function can subscribe to platform events by exporting an object instead of a function as its default. Each event has a named handler property:\n\n```typescript\nimport type { DeploySucceededEvent, UserSignupEvent } from \"@netlify\u002Ffunctions\";\n\nexport default {\n  deploySucceeded(event: DeploySucceededEvent) {\n    console.log(`Deploy ${event.deploy.id} succeeded`);\n  },\n\n  userSignup(event: UserSignupEvent) {\n    return {\n      user: {\n        ...event.user,\n        appMetadata: { ...event.user.appMetadata, roles: [\"member\"] },\n      },\n    };\n  },\n};\n```\n\nA single function can declare multiple handlers; multiple functions can also subscribe to the same event.\n\n**Available handlers:**\n\n| Handler | Trigger |\n|---|---|\n| `fetch` | HTTP request (equivalent to a bare function default export) |\n| `deployBuilding` \u002F `deploySucceeded` \u002F `deployFailed` \u002F `deployDeleted` \u002F `deployLocked` \u002F `deployUnlocked` | Deploy lifecycle |\n| `userSignup` \u002F `userLogin` \u002F `userValidate` \u002F `userModified` \u002F `userDeleted` | Identity lifecycle |\n| `formSubmitted` | Form submission verified |\n\n### Identity handlers: deny an action\n\n`userSignup`, `userLogin`, `userValidate`, and `userModified` can reject the action by calling `event.deny()`. The end user receives a 401; no observability error is produced (unlike throwing).\n\n```typescript\nexport default {\n  userLogin(event: UserLoginEvent) {\n    if (!event.user.email?.endsWith(\"@example.com\")) {\n      return event.deny();\n    }\n  },\n};\n```\n\nIf multiple functions subscribe to the same event, the first to call `event.deny()` aborts the chain.\n\n## Context Object\n\n| Property | Description |\n|---|---|\n| `context.params` | Path parameters from config |\n| `context.geo` | `{ city, country: {code, name}, latitude, longitude, subdivision, timezone, postalCode }` |\n| `context.ip` | Client IP address |\n| `context.cookies` | `.get()`, `.set()`, `.delete()` |\n| `context.deploy` | `{ context, id, published }` |\n| `context.site` | `{ id, name, url }` |\n| `context.account.id` | Team account ID |\n| `context.requestId` | Unique request ID |\n| `context.waitUntil(promise)` | Extend execution after response is sent |\n\n**`context.geo` and `context.ip` are mocked under `netlify dev`.** Locally these return placeholder values, not your real location or client IP, so a value that looks \"stuck\" on a default country does not mean your geo code is broken — real geolocation is populated only for deployed functions. To exercise geo branching locally, start dev with the geo flags: `netlify dev --geo=mock --country=DE` forces mock data (`--geo=mock`) and sets the mock country (`--country`). Don't conclude `context.geo` is broken because local values never change.\n\n## Environment Variables\n\nPrefer `Netlify.env.get` inside functions:\n\n```typescript\nconst apiKey = Netlify.env.get(\"API_KEY\");\n```\n\n`process.env` is also valid inside Functions and reads the same variables — prefer `Netlify.env.get` for cross-runtime and edge portability (a function you later move to an Edge Function keeps working, since Edge Functions expose **only** `Netlify.env.get`, not `process.env`).\n\n**Environment variables have a small total size budget.** Functions run on AWS Lambda, which caps the *combined* size of all environment variables at roughly 4 KB. A single large value — a service-account JSON credential, a PEM private key, a big config blob — can blow past that on its own and break the deploy or the function at runtime. Do not store large payloads in environment variables; keep only small secrets and config (API keys, connection strings) there and move anything large into a bundled file, Netlify Blobs, or a fetch at runtime. There is no Netlify setting that raises this cap.\n\n## Reading Files at Runtime\n\nOnly a function's own code and the modules it `import`s are bundled and deployed. A file the function opens from disk at runtime — `fs.readFile`\u002F`readFileSync` on a template, a JSON data file, a WASM binary, a fixture — is **not** part of the bundle unless you declare it. This is a classic \"works locally, ENOENT in production\" trap: under `netlify dev` the function reads the file straight from your working tree, but the deployed function only contains what was bundled.\n\nDeclare runtime-read files with `included_files` in `netlify.toml` so they ship with the function:\n\n```toml\n[functions]\n  included_files = [\"netlify\u002Ffunctions\u002Ftemplates\u002F**\"]\n\n# or scope it to one function:\n[functions.\"render-email\"]\n  included_files = [\"netlify\u002Ffunctions\u002Ftemplates\u002Fwelcome.html\"]\n```\n\nWhen the data is static, prefer importing it as a module (`import data from \".\u002Fdata.json\"`) so bundling is automatic; reach for `included_files` for files you must read from the filesystem at runtime.\n\n## Resource Limits\n\n| Resource | Limit |\n|---|---|\n| Synchronous timeout | 60 seconds |\n| Background timeout | 15 minutes |\n| Scheduled timeout | 30 seconds |\n| Memory | 1024 MB default; configurable 1024–4096 MB (see [Memory or vCPU](#memory-or-vcpu)) |\n| Buffered payload | 6 MB |\n| Streamed payload | 20 MB |\n\n## Framework Considerations\n\nFrameworks with server-side capabilities (Astro, Next.js, Nuxt, SvelteKit, TanStack Start) typically generate their own serverless functions via adapters. You usually do not write raw Netlify Functions in these projects — the framework adapter handles server-side rendering and API routes. Write Netlify Functions directly when:\n\n- Using a client-side-only framework (Vite + React SPA, vanilla JS)\n- Adding background or scheduled tasks to any project\n- Building standalone API endpoints outside the framework's routing\n\nSee the **netlify-frameworks** skill for adapter setup.\n",{"data":34,"body":35},{"name":4,"description":6},{"type":36,"children":37},"root",[38,46,53,76,378,407,429,554,560,572,582,625,631,644,775,811,823,955,961,1501,1507,1520,1533,1707,1712,1732,1738,1751,1764,1775,1797,1834,1840,1845,1865,1878,1934,1940,1945,2180,2228,2275,2281,2294,2501,2506,2511,2917,2922,2930,3089,3096,3133,3314,3326,3332,3536,3594,3600,3613,3686,3724,3742,3748,3789,3810,3866,3886,3892,3998,4004,4009,4027,4039],{"type":39,"tag":40,"props":41,"children":42},"element","h1",{"id":4},[43],{"type":44,"value":45},"text","Netlify Functions",{"type":39,"tag":47,"props":48,"children":50},"h2",{"id":49},"modern-syntax",[51],{"type":44,"value":52},"Modern Syntax",{"type":39,"tag":54,"props":55,"children":56},"p",{},[57,59,66,68,74],{"type":44,"value":58},"Always use the modern default export + Config pattern. Never use the legacy ",{"type":39,"tag":60,"props":61,"children":63},"code",{"className":62},[],[64],{"type":44,"value":65},"exports.handler",{"type":44,"value":67}," or named ",{"type":39,"tag":60,"props":69,"children":71},{"className":70},[],[72],{"type":44,"value":73},"handler",{"type":44,"value":75}," export.",{"type":39,"tag":77,"props":78,"children":83},"pre",{"className":79,"code":80,"language":81,"meta":82,"style":82},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import type { Context, Config } from \"@netlify\u002Ffunctions\";\n\nexport default async (req: Request, context: Context) => {\n  return new Response(\"Hello, world!\");\n};\n\nexport const config: Config = {\n  path: \"\u002Fapi\u002Fhello\",\n};\n","typescript","",[84],{"type":39,"tag":60,"props":85,"children":86},{"__ignoreMap":82},[87,157,167,241,288,296,304,339,370],{"type":39,"tag":88,"props":89,"children":92},"span",{"class":90,"line":91},"line",1,[93,99,104,110,116,121,126,131,136,141,147,152],{"type":39,"tag":88,"props":94,"children":96},{"style":95},"--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic",[97],{"type":44,"value":98},"import",{"type":39,"tag":88,"props":100,"children":101},{"style":95},[102],{"type":44,"value":103}," type",{"type":39,"tag":88,"props":105,"children":107},{"style":106},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[108],{"type":44,"value":109}," {",{"type":39,"tag":88,"props":111,"children":113},{"style":112},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[114],{"type":44,"value":115}," Context",{"type":39,"tag":88,"props":117,"children":118},{"style":106},[119],{"type":44,"value":120},",",{"type":39,"tag":88,"props":122,"children":123},{"style":112},[124],{"type":44,"value":125}," Config",{"type":39,"tag":88,"props":127,"children":128},{"style":106},[129],{"type":44,"value":130}," }",{"type":39,"tag":88,"props":132,"children":133},{"style":95},[134],{"type":44,"value":135}," from",{"type":39,"tag":88,"props":137,"children":138},{"style":106},[139],{"type":44,"value":140}," \"",{"type":39,"tag":88,"props":142,"children":144},{"style":143},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[145],{"type":44,"value":146},"@netlify\u002Ffunctions",{"type":39,"tag":88,"props":148,"children":149},{"style":106},[150],{"type":44,"value":151},"\"",{"type":39,"tag":88,"props":153,"children":154},{"style":106},[155],{"type":44,"value":156},";\n",{"type":39,"tag":88,"props":158,"children":160},{"class":90,"line":159},2,[161],{"type":39,"tag":88,"props":162,"children":164},{"emptyLinePlaceholder":163},true,[165],{"type":44,"value":166},"\n",{"type":39,"tag":88,"props":168,"children":170},{"class":90,"line":169},3,[171,176,181,187,192,198,203,209,213,218,222,226,231,236],{"type":39,"tag":88,"props":172,"children":173},{"style":95},[174],{"type":44,"value":175},"export",{"type":39,"tag":88,"props":177,"children":178},{"style":95},[179],{"type":44,"value":180}," default",{"type":39,"tag":88,"props":182,"children":184},{"style":183},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[185],{"type":44,"value":186}," async",{"type":39,"tag":88,"props":188,"children":189},{"style":106},[190],{"type":44,"value":191}," (",{"type":39,"tag":88,"props":193,"children":195},{"style":194},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic",[196],{"type":44,"value":197},"req",{"type":39,"tag":88,"props":199,"children":200},{"style":106},[201],{"type":44,"value":202},":",{"type":39,"tag":88,"props":204,"children":206},{"style":205},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[207],{"type":44,"value":208}," Request",{"type":39,"tag":88,"props":210,"children":211},{"style":106},[212],{"type":44,"value":120},{"type":39,"tag":88,"props":214,"children":215},{"style":194},[216],{"type":44,"value":217}," context",{"type":39,"tag":88,"props":219,"children":220},{"style":106},[221],{"type":44,"value":202},{"type":39,"tag":88,"props":223,"children":224},{"style":205},[225],{"type":44,"value":115},{"type":39,"tag":88,"props":227,"children":228},{"style":106},[229],{"type":44,"value":230},")",{"type":39,"tag":88,"props":232,"children":233},{"style":183},[234],{"type":44,"value":235}," =>",{"type":39,"tag":88,"props":237,"children":238},{"style":106},[239],{"type":44,"value":240}," {\n",{"type":39,"tag":88,"props":242,"children":244},{"class":90,"line":243},4,[245,250,255,261,267,271,276,280,284],{"type":39,"tag":88,"props":246,"children":247},{"style":95},[248],{"type":44,"value":249},"  return",{"type":39,"tag":88,"props":251,"children":252},{"style":106},[253],{"type":44,"value":254}," new",{"type":39,"tag":88,"props":256,"children":258},{"style":257},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[259],{"type":44,"value":260}," Response",{"type":39,"tag":88,"props":262,"children":264},{"style":263},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[265],{"type":44,"value":266},"(",{"type":39,"tag":88,"props":268,"children":269},{"style":106},[270],{"type":44,"value":151},{"type":39,"tag":88,"props":272,"children":273},{"style":143},[274],{"type":44,"value":275},"Hello, world!",{"type":39,"tag":88,"props":277,"children":278},{"style":106},[279],{"type":44,"value":151},{"type":39,"tag":88,"props":281,"children":282},{"style":263},[283],{"type":44,"value":230},{"type":39,"tag":88,"props":285,"children":286},{"style":106},[287],{"type":44,"value":156},{"type":39,"tag":88,"props":289,"children":290},{"class":90,"line":27},[291],{"type":39,"tag":88,"props":292,"children":293},{"style":106},[294],{"type":44,"value":295},"};\n",{"type":39,"tag":88,"props":297,"children":299},{"class":90,"line":298},6,[300],{"type":39,"tag":88,"props":301,"children":302},{"emptyLinePlaceholder":163},[303],{"type":44,"value":166},{"type":39,"tag":88,"props":305,"children":307},{"class":90,"line":306},7,[308,312,317,322,326,330,335],{"type":39,"tag":88,"props":309,"children":310},{"style":95},[311],{"type":44,"value":175},{"type":39,"tag":88,"props":313,"children":314},{"style":183},[315],{"type":44,"value":316}," const",{"type":39,"tag":88,"props":318,"children":319},{"style":112},[320],{"type":44,"value":321}," config",{"type":39,"tag":88,"props":323,"children":324},{"style":106},[325],{"type":44,"value":202},{"type":39,"tag":88,"props":327,"children":328},{"style":205},[329],{"type":44,"value":125},{"type":39,"tag":88,"props":331,"children":332},{"style":106},[333],{"type":44,"value":334}," =",{"type":39,"tag":88,"props":336,"children":337},{"style":106},[338],{"type":44,"value":240},{"type":39,"tag":88,"props":340,"children":342},{"class":90,"line":341},8,[343,348,352,356,361,365],{"type":39,"tag":88,"props":344,"children":345},{"style":263},[346],{"type":44,"value":347},"  path",{"type":39,"tag":88,"props":349,"children":350},{"style":106},[351],{"type":44,"value":202},{"type":39,"tag":88,"props":353,"children":354},{"style":106},[355],{"type":44,"value":140},{"type":39,"tag":88,"props":357,"children":358},{"style":143},[359],{"type":44,"value":360},"\u002Fapi\u002Fhello",{"type":39,"tag":88,"props":362,"children":363},{"style":106},[364],{"type":44,"value":151},{"type":39,"tag":88,"props":366,"children":367},{"style":106},[368],{"type":44,"value":369},",\n",{"type":39,"tag":88,"props":371,"children":373},{"class":90,"line":372},9,[374],{"type":39,"tag":88,"props":375,"children":376},{"style":106},[377],{"type":44,"value":295},{"type":39,"tag":54,"props":379,"children":380},{},[381,383,389,391,397,399,405],{"type":44,"value":382},"The handler receives a standard Web API ",{"type":39,"tag":60,"props":384,"children":386},{"className":385},[],[387],{"type":44,"value":388},"Request",{"type":44,"value":390}," and returns a ",{"type":39,"tag":60,"props":392,"children":394},{"className":393},[],[395],{"type":44,"value":396},"Response",{"type":44,"value":398},". The second argument is a Netlify ",{"type":39,"tag":60,"props":400,"children":402},{"className":401},[],[403],{"type":44,"value":404},"Context",{"type":44,"value":406}," object.",{"type":39,"tag":54,"props":408,"children":409},{},[410,412,418,420,427],{"type":44,"value":411},"The bare default export shown above is the recommended form. The default export can also be an object with a ",{"type":39,"tag":60,"props":413,"children":415},{"className":414},[],[416],{"type":44,"value":417},"fetch",{"type":44,"value":419}," method — prefer this form only if (1) other functions in the project already use it, or (2) the function also subscribes to platform events (see ",{"type":39,"tag":421,"props":422,"children":424},"a",{"href":423},"#event-handlers",[425],{"type":44,"value":426},"Event Handlers",{"type":44,"value":428}," below), since events are exposed as named handlers on the same object:",{"type":39,"tag":77,"props":430,"children":432},{"className":79,"code":431,"language":81,"meta":82,"style":82},"export default {\n  fetch(req: Request, context: Context) {\n    return new Response(\"Hello, world!\");\n  },\n};\n",[433],{"type":39,"tag":60,"props":434,"children":435},{"__ignoreMap":82},[436,451,499,539,547],{"type":39,"tag":88,"props":437,"children":438},{"class":90,"line":91},[439,443,447],{"type":39,"tag":88,"props":440,"children":441},{"style":95},[442],{"type":44,"value":175},{"type":39,"tag":88,"props":444,"children":445},{"style":95},[446],{"type":44,"value":180},{"type":39,"tag":88,"props":448,"children":449},{"style":106},[450],{"type":44,"value":240},{"type":39,"tag":88,"props":452,"children":453},{"class":90,"line":159},[454,459,463,467,471,475,479,483,487,491,495],{"type":39,"tag":88,"props":455,"children":456},{"style":263},[457],{"type":44,"value":458},"  fetch",{"type":39,"tag":88,"props":460,"children":461},{"style":106},[462],{"type":44,"value":266},{"type":39,"tag":88,"props":464,"children":465},{"style":194},[466],{"type":44,"value":197},{"type":39,"tag":88,"props":468,"children":469},{"style":106},[470],{"type":44,"value":202},{"type":39,"tag":88,"props":472,"children":473},{"style":205},[474],{"type":44,"value":208},{"type":39,"tag":88,"props":476,"children":477},{"style":106},[478],{"type":44,"value":120},{"type":39,"tag":88,"props":480,"children":481},{"style":194},[482],{"type":44,"value":217},{"type":39,"tag":88,"props":484,"children":485},{"style":106},[486],{"type":44,"value":202},{"type":39,"tag":88,"props":488,"children":489},{"style":205},[490],{"type":44,"value":115},{"type":39,"tag":88,"props":492,"children":493},{"style":106},[494],{"type":44,"value":230},{"type":39,"tag":88,"props":496,"children":497},{"style":106},[498],{"type":44,"value":240},{"type":39,"tag":88,"props":500,"children":501},{"class":90,"line":169},[502,507,511,515,519,523,527,531,535],{"type":39,"tag":88,"props":503,"children":504},{"style":95},[505],{"type":44,"value":506},"    return",{"type":39,"tag":88,"props":508,"children":509},{"style":106},[510],{"type":44,"value":254},{"type":39,"tag":88,"props":512,"children":513},{"style":257},[514],{"type":44,"value":260},{"type":39,"tag":88,"props":516,"children":517},{"style":263},[518],{"type":44,"value":266},{"type":39,"tag":88,"props":520,"children":521},{"style":106},[522],{"type":44,"value":151},{"type":39,"tag":88,"props":524,"children":525},{"style":143},[526],{"type":44,"value":275},{"type":39,"tag":88,"props":528,"children":529},{"style":106},[530],{"type":44,"value":151},{"type":39,"tag":88,"props":532,"children":533},{"style":263},[534],{"type":44,"value":230},{"type":39,"tag":88,"props":536,"children":537},{"style":106},[538],{"type":44,"value":156},{"type":39,"tag":88,"props":540,"children":541},{"class":90,"line":243},[542],{"type":39,"tag":88,"props":543,"children":544},{"style":106},[545],{"type":44,"value":546},"  },\n",{"type":39,"tag":88,"props":548,"children":549},{"class":90,"line":27},[550],{"type":39,"tag":88,"props":551,"children":552},{"style":106},[553],{"type":44,"value":295},{"type":39,"tag":47,"props":555,"children":557},{"id":556},"file-structure",[558],{"type":44,"value":559},"File Structure",{"type":39,"tag":54,"props":561,"children":562},{},[563,565,571],{"type":44,"value":564},"Place functions in ",{"type":39,"tag":60,"props":566,"children":568},{"className":567},[],[569],{"type":44,"value":570},"netlify\u002Ffunctions\u002F",{"type":44,"value":202},{"type":39,"tag":77,"props":573,"children":577},{"className":574,"code":576,"language":44},[575],"language-text","netlify\u002Ffunctions\u002F\n  _shared\u002F           # Non-function shared code (underscore prefix)\n    auth.ts\n    db.ts\n  items.ts           # -> \u002F.netlify\u002Ffunctions\u002Fitems (or custom path via config)\n  users\u002Findex.ts     # -> \u002F.netlify\u002Ffunctions\u002Fusers\n",[578],{"type":39,"tag":60,"props":579,"children":580},{"__ignoreMap":82},[581],{"type":44,"value":576},{"type":39,"tag":54,"props":583,"children":584},{},[585,587,593,595,601,603,608,610,616,618,623],{"type":44,"value":586},"Use ",{"type":39,"tag":60,"props":588,"children":590},{"className":589},[],[591],{"type":44,"value":592},".ts",{"type":44,"value":594}," or ",{"type":39,"tag":60,"props":596,"children":598},{"className":597},[],[599],{"type":44,"value":600},".mts",{"type":44,"value":602}," extensions. If both ",{"type":39,"tag":60,"props":604,"children":606},{"className":605},[],[607],{"type":44,"value":592},{"type":44,"value":609}," and ",{"type":39,"tag":60,"props":611,"children":613},{"className":612},[],[614],{"type":44,"value":615},".js",{"type":44,"value":617}," exist with the same name, the ",{"type":39,"tag":60,"props":619,"children":621},{"className":620},[],[622],{"type":44,"value":615},{"type":44,"value":624}," file takes precedence.",{"type":39,"tag":47,"props":626,"children":628},{"id":627},"path-routing",[629],{"type":44,"value":630},"Path Routing",{"type":39,"tag":54,"props":632,"children":633},{},[634,636,642],{"type":44,"value":635},"Define custom paths via the ",{"type":39,"tag":60,"props":637,"children":639},{"className":638},[],[640],{"type":44,"value":641},"config",{"type":44,"value":643}," export:",{"type":39,"tag":77,"props":645,"children":647},{"className":79,"code":646,"language":81,"meta":82,"style":82},"export const config: Config = {\n  path: \"\u002Fapi\u002Fitems\",                    \u002F\u002F Static path\n  \u002F\u002F path: \"\u002Fapi\u002Fitems\u002F:id\",            \u002F\u002F Path parameter\n  \u002F\u002F path: [\"\u002Fapi\u002Fitems\", \"\u002Fapi\u002Fitems\u002F:id\"], \u002F\u002F Multiple paths\n  \u002F\u002F excludedPath: \"\u002Fapi\u002Fitems\u002Fspecial\", \u002F\u002F Excluded paths\n  \u002F\u002F preferStatic: true,                \u002F\u002F Don't override static files\n};\n",[648],{"type":39,"tag":60,"props":649,"children":650},{"__ignoreMap":82},[651,682,716,729,742,755,768],{"type":39,"tag":88,"props":652,"children":653},{"class":90,"line":91},[654,658,662,666,670,674,678],{"type":39,"tag":88,"props":655,"children":656},{"style":95},[657],{"type":44,"value":175},{"type":39,"tag":88,"props":659,"children":660},{"style":183},[661],{"type":44,"value":316},{"type":39,"tag":88,"props":663,"children":664},{"style":112},[665],{"type":44,"value":321},{"type":39,"tag":88,"props":667,"children":668},{"style":106},[669],{"type":44,"value":202},{"type":39,"tag":88,"props":671,"children":672},{"style":205},[673],{"type":44,"value":125},{"type":39,"tag":88,"props":675,"children":676},{"style":106},[677],{"type":44,"value":334},{"type":39,"tag":88,"props":679,"children":680},{"style":106},[681],{"type":44,"value":240},{"type":39,"tag":88,"props":683,"children":684},{"class":90,"line":159},[685,689,693,697,702,706,710],{"type":39,"tag":88,"props":686,"children":687},{"style":263},[688],{"type":44,"value":347},{"type":39,"tag":88,"props":690,"children":691},{"style":106},[692],{"type":44,"value":202},{"type":39,"tag":88,"props":694,"children":695},{"style":106},[696],{"type":44,"value":140},{"type":39,"tag":88,"props":698,"children":699},{"style":143},[700],{"type":44,"value":701},"\u002Fapi\u002Fitems",{"type":39,"tag":88,"props":703,"children":704},{"style":106},[705],{"type":44,"value":151},{"type":39,"tag":88,"props":707,"children":708},{"style":106},[709],{"type":44,"value":120},{"type":39,"tag":88,"props":711,"children":713},{"style":712},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[714],{"type":44,"value":715},"                    \u002F\u002F Static path\n",{"type":39,"tag":88,"props":717,"children":718},{"class":90,"line":169},[719,724],{"type":39,"tag":88,"props":720,"children":721},{"style":712},[722],{"type":44,"value":723},"  \u002F\u002F path: \"\u002Fapi\u002Fitems\u002F:id\",",{"type":39,"tag":88,"props":725,"children":726},{"style":712},[727],{"type":44,"value":728},"            \u002F\u002F Path parameter\n",{"type":39,"tag":88,"props":730,"children":731},{"class":90,"line":243},[732,737],{"type":39,"tag":88,"props":733,"children":734},{"style":712},[735],{"type":44,"value":736},"  \u002F\u002F path: [\"\u002Fapi\u002Fitems\", \"\u002Fapi\u002Fitems\u002F:id\"],",{"type":39,"tag":88,"props":738,"children":739},{"style":712},[740],{"type":44,"value":741}," \u002F\u002F Multiple paths\n",{"type":39,"tag":88,"props":743,"children":744},{"class":90,"line":27},[745,750],{"type":39,"tag":88,"props":746,"children":747},{"style":712},[748],{"type":44,"value":749},"  \u002F\u002F excludedPath: \"\u002Fapi\u002Fitems\u002Fspecial\",",{"type":39,"tag":88,"props":751,"children":752},{"style":712},[753],{"type":44,"value":754}," \u002F\u002F Excluded paths\n",{"type":39,"tag":88,"props":756,"children":757},{"class":90,"line":298},[758,763],{"type":39,"tag":88,"props":759,"children":760},{"style":712},[761],{"type":44,"value":762},"  \u002F\u002F preferStatic: true,",{"type":39,"tag":88,"props":764,"children":765},{"style":712},[766],{"type":44,"value":767},"                \u002F\u002F Don't override static files\n",{"type":39,"tag":88,"props":769,"children":770},{"class":90,"line":306},[771],{"type":39,"tag":88,"props":772,"children":773},{"style":106},[774],{"type":44,"value":295},{"type":39,"tag":54,"props":776,"children":777},{},[778,780,786,788,794,796,801,803,809],{"type":44,"value":779},"Without a ",{"type":39,"tag":60,"props":781,"children":783},{"className":782},[],[784],{"type":44,"value":785},"path",{"type":44,"value":787}," config, functions are available at ",{"type":39,"tag":60,"props":789,"children":791},{"className":790},[],[792],{"type":44,"value":793},"\u002F.netlify\u002Ffunctions\u002F{name}",{"type":44,"value":795},". Setting a ",{"type":39,"tag":60,"props":797,"children":799},{"className":798},[],[800],{"type":44,"value":785},{"type":44,"value":802}," makes the function available ",{"type":39,"tag":804,"props":805,"children":806},"strong",{},[807],{"type":44,"value":808},"only",{"type":44,"value":810}," at that path.",{"type":39,"tag":54,"props":812,"children":813},{},[814,816,822],{"type":44,"value":815},"Access path parameters via ",{"type":39,"tag":60,"props":817,"children":819},{"className":818},[],[820],{"type":44,"value":821},"context.params",{"type":44,"value":202},{"type":39,"tag":77,"props":824,"children":826},{"className":79,"code":825,"language":81,"meta":82,"style":82},"\u002F\u002F config: { path: \"\u002Fapi\u002Fitems\u002F:id\" }\nexport default async (req: Request, context: Context) => {\n  const { id } = context.params;\n  \u002F\u002F ...\n};\n",[827],{"type":39,"tag":60,"props":828,"children":829},{"__ignoreMap":82},[830,838,897,940,948],{"type":39,"tag":88,"props":831,"children":832},{"class":90,"line":91},[833],{"type":39,"tag":88,"props":834,"children":835},{"style":712},[836],{"type":44,"value":837},"\u002F\u002F config: { path: \"\u002Fapi\u002Fitems\u002F:id\" }\n",{"type":39,"tag":88,"props":839,"children":840},{"class":90,"line":159},[841,845,849,853,857,861,865,869,873,877,881,885,889,893],{"type":39,"tag":88,"props":842,"children":843},{"style":95},[844],{"type":44,"value":175},{"type":39,"tag":88,"props":846,"children":847},{"style":95},[848],{"type":44,"value":180},{"type":39,"tag":88,"props":850,"children":851},{"style":183},[852],{"type":44,"value":186},{"type":39,"tag":88,"props":854,"children":855},{"style":106},[856],{"type":44,"value":191},{"type":39,"tag":88,"props":858,"children":859},{"style":194},[860],{"type":44,"value":197},{"type":39,"tag":88,"props":862,"children":863},{"style":106},[864],{"type":44,"value":202},{"type":39,"tag":88,"props":866,"children":867},{"style":205},[868],{"type":44,"value":208},{"type":39,"tag":88,"props":870,"children":871},{"style":106},[872],{"type":44,"value":120},{"type":39,"tag":88,"props":874,"children":875},{"style":194},[876],{"type":44,"value":217},{"type":39,"tag":88,"props":878,"children":879},{"style":106},[880],{"type":44,"value":202},{"type":39,"tag":88,"props":882,"children":883},{"style":205},[884],{"type":44,"value":115},{"type":39,"tag":88,"props":886,"children":887},{"style":106},[888],{"type":44,"value":230},{"type":39,"tag":88,"props":890,"children":891},{"style":183},[892],{"type":44,"value":235},{"type":39,"tag":88,"props":894,"children":895},{"style":106},[896],{"type":44,"value":240},{"type":39,"tag":88,"props":898,"children":899},{"class":90,"line":169},[900,905,909,914,918,922,926,931,936],{"type":39,"tag":88,"props":901,"children":902},{"style":183},[903],{"type":44,"value":904},"  const",{"type":39,"tag":88,"props":906,"children":907},{"style":106},[908],{"type":44,"value":109},{"type":39,"tag":88,"props":910,"children":911},{"style":112},[912],{"type":44,"value":913}," id",{"type":39,"tag":88,"props":915,"children":916},{"style":106},[917],{"type":44,"value":130},{"type":39,"tag":88,"props":919,"children":920},{"style":106},[921],{"type":44,"value":334},{"type":39,"tag":88,"props":923,"children":924},{"style":112},[925],{"type":44,"value":217},{"type":39,"tag":88,"props":927,"children":928},{"style":106},[929],{"type":44,"value":930},".",{"type":39,"tag":88,"props":932,"children":933},{"style":112},[934],{"type":44,"value":935},"params",{"type":39,"tag":88,"props":937,"children":938},{"style":106},[939],{"type":44,"value":156},{"type":39,"tag":88,"props":941,"children":942},{"class":90,"line":243},[943],{"type":39,"tag":88,"props":944,"children":945},{"style":712},[946],{"type":44,"value":947},"  \u002F\u002F ...\n",{"type":39,"tag":88,"props":949,"children":950},{"class":90,"line":27},[951],{"type":39,"tag":88,"props":952,"children":953},{"style":106},[954],{"type":44,"value":295},{"type":39,"tag":47,"props":956,"children":958},{"id":957},"method-routing",[959],{"type":44,"value":960},"Method Routing",{"type":39,"tag":77,"props":962,"children":964},{"className":79,"code":963,"language":81,"meta":82,"style":82},"export default async (req: Request, context: Context) => {\n  switch (req.method) {\n    case \"GET\":    return handleGet(context.params.id);\n    case \"POST\":   return handlePost(await req.json());\n    case \"DELETE\": return handleDelete(context.params.id);\n    default:       return new Response(\"Method not allowed\", { status: 405 });\n  }\n};\n\nexport const config: Config = {\n  path: \"\u002Fapi\u002Fitems\u002F:id\",\n  method: [\"GET\", \"POST\", \"DELETE\"],\n};\n",[965],{"type":39,"tag":60,"props":966,"children":967},{"__ignoreMap":82},[968,1027,1062,1130,1196,1262,1339,1347,1354,1361,1393,1422,1493],{"type":39,"tag":88,"props":969,"children":970},{"class":90,"line":91},[971,975,979,983,987,991,995,999,1003,1007,1011,1015,1019,1023],{"type":39,"tag":88,"props":972,"children":973},{"style":95},[974],{"type":44,"value":175},{"type":39,"tag":88,"props":976,"children":977},{"style":95},[978],{"type":44,"value":180},{"type":39,"tag":88,"props":980,"children":981},{"style":183},[982],{"type":44,"value":186},{"type":39,"tag":88,"props":984,"children":985},{"style":106},[986],{"type":44,"value":191},{"type":39,"tag":88,"props":988,"children":989},{"style":194},[990],{"type":44,"value":197},{"type":39,"tag":88,"props":992,"children":993},{"style":106},[994],{"type":44,"value":202},{"type":39,"tag":88,"props":996,"children":997},{"style":205},[998],{"type":44,"value":208},{"type":39,"tag":88,"props":1000,"children":1001},{"style":106},[1002],{"type":44,"value":120},{"type":39,"tag":88,"props":1004,"children":1005},{"style":194},[1006],{"type":44,"value":217},{"type":39,"tag":88,"props":1008,"children":1009},{"style":106},[1010],{"type":44,"value":202},{"type":39,"tag":88,"props":1012,"children":1013},{"style":205},[1014],{"type":44,"value":115},{"type":39,"tag":88,"props":1016,"children":1017},{"style":106},[1018],{"type":44,"value":230},{"type":39,"tag":88,"props":1020,"children":1021},{"style":183},[1022],{"type":44,"value":235},{"type":39,"tag":88,"props":1024,"children":1025},{"style":106},[1026],{"type":44,"value":240},{"type":39,"tag":88,"props":1028,"children":1029},{"class":90,"line":159},[1030,1035,1039,1043,1047,1052,1057],{"type":39,"tag":88,"props":1031,"children":1032},{"style":95},[1033],{"type":44,"value":1034},"  switch",{"type":39,"tag":88,"props":1036,"children":1037},{"style":263},[1038],{"type":44,"value":191},{"type":39,"tag":88,"props":1040,"children":1041},{"style":112},[1042],{"type":44,"value":197},{"type":39,"tag":88,"props":1044,"children":1045},{"style":106},[1046],{"type":44,"value":930},{"type":39,"tag":88,"props":1048,"children":1049},{"style":112},[1050],{"type":44,"value":1051},"method",{"type":39,"tag":88,"props":1053,"children":1054},{"style":263},[1055],{"type":44,"value":1056},") ",{"type":39,"tag":88,"props":1058,"children":1059},{"style":106},[1060],{"type":44,"value":1061},"{\n",{"type":39,"tag":88,"props":1063,"children":1064},{"class":90,"line":169},[1065,1070,1074,1079,1083,1087,1091,1096,1100,1105,1109,1113,1117,1122,1126],{"type":39,"tag":88,"props":1066,"children":1067},{"style":95},[1068],{"type":44,"value":1069},"    case",{"type":39,"tag":88,"props":1071,"children":1072},{"style":106},[1073],{"type":44,"value":140},{"type":39,"tag":88,"props":1075,"children":1076},{"style":143},[1077],{"type":44,"value":1078},"GET",{"type":39,"tag":88,"props":1080,"children":1081},{"style":106},[1082],{"type":44,"value":151},{"type":39,"tag":88,"props":1084,"children":1085},{"style":106},[1086],{"type":44,"value":202},{"type":39,"tag":88,"props":1088,"children":1089},{"style":95},[1090],{"type":44,"value":506},{"type":39,"tag":88,"props":1092,"children":1093},{"style":257},[1094],{"type":44,"value":1095}," handleGet",{"type":39,"tag":88,"props":1097,"children":1098},{"style":263},[1099],{"type":44,"value":266},{"type":39,"tag":88,"props":1101,"children":1102},{"style":112},[1103],{"type":44,"value":1104},"context",{"type":39,"tag":88,"props":1106,"children":1107},{"style":106},[1108],{"type":44,"value":930},{"type":39,"tag":88,"props":1110,"children":1111},{"style":112},[1112],{"type":44,"value":935},{"type":39,"tag":88,"props":1114,"children":1115},{"style":106},[1116],{"type":44,"value":930},{"type":39,"tag":88,"props":1118,"children":1119},{"style":112},[1120],{"type":44,"value":1121},"id",{"type":39,"tag":88,"props":1123,"children":1124},{"style":263},[1125],{"type":44,"value":230},{"type":39,"tag":88,"props":1127,"children":1128},{"style":106},[1129],{"type":44,"value":156},{"type":39,"tag":88,"props":1131,"children":1132},{"class":90,"line":243},[1133,1137,1141,1146,1150,1154,1159,1164,1168,1173,1178,1182,1187,1192],{"type":39,"tag":88,"props":1134,"children":1135},{"style":95},[1136],{"type":44,"value":1069},{"type":39,"tag":88,"props":1138,"children":1139},{"style":106},[1140],{"type":44,"value":140},{"type":39,"tag":88,"props":1142,"children":1143},{"style":143},[1144],{"type":44,"value":1145},"POST",{"type":39,"tag":88,"props":1147,"children":1148},{"style":106},[1149],{"type":44,"value":151},{"type":39,"tag":88,"props":1151,"children":1152},{"style":106},[1153],{"type":44,"value":202},{"type":39,"tag":88,"props":1155,"children":1156},{"style":95},[1157],{"type":44,"value":1158},"   return",{"type":39,"tag":88,"props":1160,"children":1161},{"style":257},[1162],{"type":44,"value":1163}," handlePost",{"type":39,"tag":88,"props":1165,"children":1166},{"style":263},[1167],{"type":44,"value":266},{"type":39,"tag":88,"props":1169,"children":1170},{"style":95},[1171],{"type":44,"value":1172},"await",{"type":39,"tag":88,"props":1174,"children":1175},{"style":112},[1176],{"type":44,"value":1177}," req",{"type":39,"tag":88,"props":1179,"children":1180},{"style":106},[1181],{"type":44,"value":930},{"type":39,"tag":88,"props":1183,"children":1184},{"style":257},[1185],{"type":44,"value":1186},"json",{"type":39,"tag":88,"props":1188,"children":1189},{"style":263},[1190],{"type":44,"value":1191},"())",{"type":39,"tag":88,"props":1193,"children":1194},{"style":106},[1195],{"type":44,"value":156},{"type":39,"tag":88,"props":1197,"children":1198},{"class":90,"line":27},[1199,1203,1207,1212,1216,1220,1225,1230,1234,1238,1242,1246,1250,1254,1258],{"type":39,"tag":88,"props":1200,"children":1201},{"style":95},[1202],{"type":44,"value":1069},{"type":39,"tag":88,"props":1204,"children":1205},{"style":106},[1206],{"type":44,"value":140},{"type":39,"tag":88,"props":1208,"children":1209},{"style":143},[1210],{"type":44,"value":1211},"DELETE",{"type":39,"tag":88,"props":1213,"children":1214},{"style":106},[1215],{"type":44,"value":151},{"type":39,"tag":88,"props":1217,"children":1218},{"style":106},[1219],{"type":44,"value":202},{"type":39,"tag":88,"props":1221,"children":1222},{"style":95},[1223],{"type":44,"value":1224}," return",{"type":39,"tag":88,"props":1226,"children":1227},{"style":257},[1228],{"type":44,"value":1229}," handleDelete",{"type":39,"tag":88,"props":1231,"children":1232},{"style":263},[1233],{"type":44,"value":266},{"type":39,"tag":88,"props":1235,"children":1236},{"style":112},[1237],{"type":44,"value":1104},{"type":39,"tag":88,"props":1239,"children":1240},{"style":106},[1241],{"type":44,"value":930},{"type":39,"tag":88,"props":1243,"children":1244},{"style":112},[1245],{"type":44,"value":935},{"type":39,"tag":88,"props":1247,"children":1248},{"style":106},[1249],{"type":44,"value":930},{"type":39,"tag":88,"props":1251,"children":1252},{"style":112},[1253],{"type":44,"value":1121},{"type":39,"tag":88,"props":1255,"children":1256},{"style":263},[1257],{"type":44,"value":230},{"type":39,"tag":88,"props":1259,"children":1260},{"style":106},[1261],{"type":44,"value":156},{"type":39,"tag":88,"props":1263,"children":1264},{"class":90,"line":298},[1265,1270,1274,1279,1283,1287,1291,1295,1300,1304,1308,1312,1317,1321,1327,1331,1335],{"type":39,"tag":88,"props":1266,"children":1267},{"style":95},[1268],{"type":44,"value":1269},"    default",{"type":39,"tag":88,"props":1271,"children":1272},{"style":106},[1273],{"type":44,"value":202},{"type":39,"tag":88,"props":1275,"children":1276},{"style":95},[1277],{"type":44,"value":1278},"       return",{"type":39,"tag":88,"props":1280,"children":1281},{"style":106},[1282],{"type":44,"value":254},{"type":39,"tag":88,"props":1284,"children":1285},{"style":257},[1286],{"type":44,"value":260},{"type":39,"tag":88,"props":1288,"children":1289},{"style":263},[1290],{"type":44,"value":266},{"type":39,"tag":88,"props":1292,"children":1293},{"style":106},[1294],{"type":44,"value":151},{"type":39,"tag":88,"props":1296,"children":1297},{"style":143},[1298],{"type":44,"value":1299},"Method not allowed",{"type":39,"tag":88,"props":1301,"children":1302},{"style":106},[1303],{"type":44,"value":151},{"type":39,"tag":88,"props":1305,"children":1306},{"style":106},[1307],{"type":44,"value":120},{"type":39,"tag":88,"props":1309,"children":1310},{"style":106},[1311],{"type":44,"value":109},{"type":39,"tag":88,"props":1313,"children":1314},{"style":263},[1315],{"type":44,"value":1316}," status",{"type":39,"tag":88,"props":1318,"children":1319},{"style":106},[1320],{"type":44,"value":202},{"type":39,"tag":88,"props":1322,"children":1324},{"style":1323},"--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C",[1325],{"type":44,"value":1326}," 405",{"type":39,"tag":88,"props":1328,"children":1329},{"style":106},[1330],{"type":44,"value":130},{"type":39,"tag":88,"props":1332,"children":1333},{"style":263},[1334],{"type":44,"value":230},{"type":39,"tag":88,"props":1336,"children":1337},{"style":106},[1338],{"type":44,"value":156},{"type":39,"tag":88,"props":1340,"children":1341},{"class":90,"line":306},[1342],{"type":39,"tag":88,"props":1343,"children":1344},{"style":106},[1345],{"type":44,"value":1346},"  }\n",{"type":39,"tag":88,"props":1348,"children":1349},{"class":90,"line":341},[1350],{"type":39,"tag":88,"props":1351,"children":1352},{"style":106},[1353],{"type":44,"value":295},{"type":39,"tag":88,"props":1355,"children":1356},{"class":90,"line":372},[1357],{"type":39,"tag":88,"props":1358,"children":1359},{"emptyLinePlaceholder":163},[1360],{"type":44,"value":166},{"type":39,"tag":88,"props":1362,"children":1364},{"class":90,"line":1363},10,[1365,1369,1373,1377,1381,1385,1389],{"type":39,"tag":88,"props":1366,"children":1367},{"style":95},[1368],{"type":44,"value":175},{"type":39,"tag":88,"props":1370,"children":1371},{"style":183},[1372],{"type":44,"value":316},{"type":39,"tag":88,"props":1374,"children":1375},{"style":112},[1376],{"type":44,"value":321},{"type":39,"tag":88,"props":1378,"children":1379},{"style":106},[1380],{"type":44,"value":202},{"type":39,"tag":88,"props":1382,"children":1383},{"style":205},[1384],{"type":44,"value":125},{"type":39,"tag":88,"props":1386,"children":1387},{"style":106},[1388],{"type":44,"value":334},{"type":39,"tag":88,"props":1390,"children":1391},{"style":106},[1392],{"type":44,"value":240},{"type":39,"tag":88,"props":1394,"children":1396},{"class":90,"line":1395},11,[1397,1401,1405,1409,1414,1418],{"type":39,"tag":88,"props":1398,"children":1399},{"style":263},[1400],{"type":44,"value":347},{"type":39,"tag":88,"props":1402,"children":1403},{"style":106},[1404],{"type":44,"value":202},{"type":39,"tag":88,"props":1406,"children":1407},{"style":106},[1408],{"type":44,"value":140},{"type":39,"tag":88,"props":1410,"children":1411},{"style":143},[1412],{"type":44,"value":1413},"\u002Fapi\u002Fitems\u002F:id",{"type":39,"tag":88,"props":1415,"children":1416},{"style":106},[1417],{"type":44,"value":151},{"type":39,"tag":88,"props":1419,"children":1420},{"style":106},[1421],{"type":44,"value":369},{"type":39,"tag":88,"props":1423,"children":1425},{"class":90,"line":1424},12,[1426,1431,1435,1440,1444,1448,1452,1456,1460,1464,1468,1472,1476,1480,1484,1489],{"type":39,"tag":88,"props":1427,"children":1428},{"style":263},[1429],{"type":44,"value":1430},"  method",{"type":39,"tag":88,"props":1432,"children":1433},{"style":106},[1434],{"type":44,"value":202},{"type":39,"tag":88,"props":1436,"children":1437},{"style":112},[1438],{"type":44,"value":1439}," [",{"type":39,"tag":88,"props":1441,"children":1442},{"style":106},[1443],{"type":44,"value":151},{"type":39,"tag":88,"props":1445,"children":1446},{"style":143},[1447],{"type":44,"value":1078},{"type":39,"tag":88,"props":1449,"children":1450},{"style":106},[1451],{"type":44,"value":151},{"type":39,"tag":88,"props":1453,"children":1454},{"style":106},[1455],{"type":44,"value":120},{"type":39,"tag":88,"props":1457,"children":1458},{"style":106},[1459],{"type":44,"value":140},{"type":39,"tag":88,"props":1461,"children":1462},{"style":143},[1463],{"type":44,"value":1145},{"type":39,"tag":88,"props":1465,"children":1466},{"style":106},[1467],{"type":44,"value":151},{"type":39,"tag":88,"props":1469,"children":1470},{"style":106},[1471],{"type":44,"value":120},{"type":39,"tag":88,"props":1473,"children":1474},{"style":106},[1475],{"type":44,"value":140},{"type":39,"tag":88,"props":1477,"children":1478},{"style":143},[1479],{"type":44,"value":1211},{"type":39,"tag":88,"props":1481,"children":1482},{"style":106},[1483],{"type":44,"value":151},{"type":39,"tag":88,"props":1485,"children":1486},{"style":112},[1487],{"type":44,"value":1488},"]",{"type":39,"tag":88,"props":1490,"children":1491},{"style":106},[1492],{"type":44,"value":369},{"type":39,"tag":88,"props":1494,"children":1496},{"class":90,"line":1495},13,[1497],{"type":39,"tag":88,"props":1498,"children":1499},{"style":106},[1500],{"type":44,"value":295},{"type":39,"tag":47,"props":1502,"children":1504},{"id":1503},"background-functions",[1505],{"type":44,"value":1506},"Background Functions",{"type":39,"tag":54,"props":1508,"children":1509},{},[1510,1512,1518],{"type":44,"value":1511},"For long-running tasks (up to 15 minutes). The client receives an immediate ",{"type":39,"tag":60,"props":1513,"children":1515},{"className":1514},[],[1516],{"type":44,"value":1517},"202",{"type":44,"value":1519}," response; return values are ignored.",{"type":39,"tag":54,"props":1521,"children":1522},{},[1523,1525,1531],{"type":44,"value":1524},"Enable background mode by setting ",{"type":39,"tag":60,"props":1526,"children":1528},{"className":1527},[],[1529],{"type":44,"value":1530},"background: true",{"type":44,"value":1532}," in config:",{"type":39,"tag":77,"props":1534,"children":1536},{"className":79,"code":1535,"language":81,"meta":82,"style":82},"export default async (req: Request) => {\n  await someLongRunningTask();\n};\n\nexport const config: Config = {\n  path: \"\u002Fprocess\",\n  background: true,\n};\n",[1537],{"type":39,"tag":60,"props":1538,"children":1539},{"__ignoreMap":82},[1540,1583,1605,1612,1619,1650,1678,1700],{"type":39,"tag":88,"props":1541,"children":1542},{"class":90,"line":91},[1543,1547,1551,1555,1559,1563,1567,1571,1575,1579],{"type":39,"tag":88,"props":1544,"children":1545},{"style":95},[1546],{"type":44,"value":175},{"type":39,"tag":88,"props":1548,"children":1549},{"style":95},[1550],{"type":44,"value":180},{"type":39,"tag":88,"props":1552,"children":1553},{"style":183},[1554],{"type":44,"value":186},{"type":39,"tag":88,"props":1556,"children":1557},{"style":106},[1558],{"type":44,"value":191},{"type":39,"tag":88,"props":1560,"children":1561},{"style":194},[1562],{"type":44,"value":197},{"type":39,"tag":88,"props":1564,"children":1565},{"style":106},[1566],{"type":44,"value":202},{"type":39,"tag":88,"props":1568,"children":1569},{"style":205},[1570],{"type":44,"value":208},{"type":39,"tag":88,"props":1572,"children":1573},{"style":106},[1574],{"type":44,"value":230},{"type":39,"tag":88,"props":1576,"children":1577},{"style":183},[1578],{"type":44,"value":235},{"type":39,"tag":88,"props":1580,"children":1581},{"style":106},[1582],{"type":44,"value":240},{"type":39,"tag":88,"props":1584,"children":1585},{"class":90,"line":159},[1586,1591,1596,1601],{"type":39,"tag":88,"props":1587,"children":1588},{"style":95},[1589],{"type":44,"value":1590},"  await",{"type":39,"tag":88,"props":1592,"children":1593},{"style":257},[1594],{"type":44,"value":1595}," someLongRunningTask",{"type":39,"tag":88,"props":1597,"children":1598},{"style":263},[1599],{"type":44,"value":1600},"()",{"type":39,"tag":88,"props":1602,"children":1603},{"style":106},[1604],{"type":44,"value":156},{"type":39,"tag":88,"props":1606,"children":1607},{"class":90,"line":169},[1608],{"type":39,"tag":88,"props":1609,"children":1610},{"style":106},[1611],{"type":44,"value":295},{"type":39,"tag":88,"props":1613,"children":1614},{"class":90,"line":243},[1615],{"type":39,"tag":88,"props":1616,"children":1617},{"emptyLinePlaceholder":163},[1618],{"type":44,"value":166},{"type":39,"tag":88,"props":1620,"children":1621},{"class":90,"line":27},[1622,1626,1630,1634,1638,1642,1646],{"type":39,"tag":88,"props":1623,"children":1624},{"style":95},[1625],{"type":44,"value":175},{"type":39,"tag":88,"props":1627,"children":1628},{"style":183},[1629],{"type":44,"value":316},{"type":39,"tag":88,"props":1631,"children":1632},{"style":112},[1633],{"type":44,"value":321},{"type":39,"tag":88,"props":1635,"children":1636},{"style":106},[1637],{"type":44,"value":202},{"type":39,"tag":88,"props":1639,"children":1640},{"style":205},[1641],{"type":44,"value":125},{"type":39,"tag":88,"props":1643,"children":1644},{"style":106},[1645],{"type":44,"value":334},{"type":39,"tag":88,"props":1647,"children":1648},{"style":106},[1649],{"type":44,"value":240},{"type":39,"tag":88,"props":1651,"children":1652},{"class":90,"line":298},[1653,1657,1661,1665,1670,1674],{"type":39,"tag":88,"props":1654,"children":1655},{"style":263},[1656],{"type":44,"value":347},{"type":39,"tag":88,"props":1658,"children":1659},{"style":106},[1660],{"type":44,"value":202},{"type":39,"tag":88,"props":1662,"children":1663},{"style":106},[1664],{"type":44,"value":140},{"type":39,"tag":88,"props":1666,"children":1667},{"style":143},[1668],{"type":44,"value":1669},"\u002Fprocess",{"type":39,"tag":88,"props":1671,"children":1672},{"style":106},[1673],{"type":44,"value":151},{"type":39,"tag":88,"props":1675,"children":1676},{"style":106},[1677],{"type":44,"value":369},{"type":39,"tag":88,"props":1679,"children":1680},{"class":90,"line":306},[1681,1686,1690,1696],{"type":39,"tag":88,"props":1682,"children":1683},{"style":263},[1684],{"type":44,"value":1685},"  background",{"type":39,"tag":88,"props":1687,"children":1688},{"style":106},[1689],{"type":44,"value":202},{"type":39,"tag":88,"props":1691,"children":1693},{"style":1692},"--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC",[1694],{"type":44,"value":1695}," true",{"type":39,"tag":88,"props":1697,"children":1698},{"style":106},[1699],{"type":44,"value":369},{"type":39,"tag":88,"props":1701,"children":1702},{"class":90,"line":341},[1703],{"type":39,"tag":88,"props":1704,"children":1705},{"style":106},[1706],{"type":44,"value":295},{"type":39,"tag":54,"props":1708,"children":1709},{},[1710],{"type":44,"value":1711},"Store results externally (Netlify Blobs, database) for later retrieval.",{"type":39,"tag":54,"props":1713,"children":1714},{},[1715,1717,1723,1725,1731],{"type":44,"value":1716},"The legacy filename convention (",{"type":39,"tag":60,"props":1718,"children":1720},{"className":1719},[],[1721],{"type":44,"value":1722},"process-background.ts",{"type":44,"value":1724},") is still supported, but new functions should use ",{"type":39,"tag":60,"props":1726,"children":1728},{"className":1727},[],[1729],{"type":44,"value":1730},"config.background",{"type":44,"value":930},{"type":39,"tag":47,"props":1733,"children":1735},{"id":1734},"region",[1736],{"type":44,"value":1737},"Region",{"type":39,"tag":54,"props":1739,"children":1740},{},[1741,1743,1749],{"type":44,"value":1742},"Functions deploy to ",{"type":39,"tag":60,"props":1744,"children":1746},{"className":1745},[],[1747],{"type":44,"value":1748},"cmh",{"type":44,"value":1750}," (Ohio) by default for new sites. This is a deliberate choice: US East is centrally located for an international audience, has a broad provider ecosystem, and gives most projects the lowest overall latency without any configuration. Sites created before October 4, 2023 may have a different default region — check Project configuration > Build & deploy > Continuous deployment > Functions region to confirm.",{"type":39,"tag":54,"props":1752,"children":1753},{},[1754,1756,1762],{"type":44,"value":1755},"Do NOT override ",{"type":39,"tag":60,"props":1757,"children":1759},{"className":1758},[],[1760],{"type":44,"value":1761},"config.region",{"type":44,"value":1763}," unless the user has stated a specific reason — for example, a database or backend service in another region with measurable roundtrip savings, a data-residency requirement, or an audience concentrated in one region whose compute dependencies (database, backend services) also live in that region.",{"type":39,"tag":54,"props":1765,"children":1766},{},[1767,1769,1774],{"type":44,"value":1768},"Two constraints to be aware of before adding ",{"type":39,"tag":60,"props":1770,"children":1772},{"className":1771},[],[1773],{"type":44,"value":1761},{"type":44,"value":202},{"type":39,"tag":1776,"props":1777,"children":1778},"ul",{},[1779,1785],{"type":39,"tag":1780,"props":1781,"children":1782},"li",{},[1783],{"type":44,"value":1784},"A function runs in exactly one region. Don't try to deploy the same function to multiple regions — if the user wants geo-routing, route between distinct functions with an edge function instead.",{"type":39,"tag":1780,"props":1786,"children":1787},{},[1788,1790,1795],{"type":44,"value":1789},"For framework adapter–generated functions (Next.js, Astro, Nuxt, etc.) the region must be set site-wide in the Netlify UI, not via ",{"type":39,"tag":60,"props":1791,"children":1793},{"className":1792},[],[1794],{"type":44,"value":1761},{"type":44,"value":1796}," in code. The generated files can't carry per-function config.",{"type":39,"tag":54,"props":1798,"children":1799},{},[1800,1802,1807,1809,1815,1817,1823,1825,1832],{"type":44,"value":1801},"Region values are IATA airport codes — for example ",{"type":39,"tag":60,"props":1803,"children":1805},{"className":1804},[],[1806],{"type":44,"value":1748},{"type":44,"value":1808}," (Columbus\u002FOhio, the default), ",{"type":39,"tag":60,"props":1810,"children":1812},{"className":1811},[],[1813],{"type":44,"value":1814},"dub",{"type":44,"value":1816}," (Dublin), and ",{"type":39,"tag":60,"props":1818,"children":1820},{"className":1819},[],[1821],{"type":44,"value":1822},"fra",{"type":44,"value":1824}," (Frankfurt). See ",{"type":39,"tag":421,"props":1826,"children":1830},{"href":1827,"rel":1828},"https:\u002F\u002Fdocs.netlify.com\u002Fbuild\u002Ffunctions\u002Fconfiguration#region",[1829],"nofollow",[1831],{"type":44,"value":1737},{"type":44,"value":1833}," for the full list of supported regions and details.",{"type":39,"tag":47,"props":1835,"children":1837},{"id":1836},"memory-or-vcpu",[1838],{"type":44,"value":1839},"Memory or vCPU",{"type":39,"tag":54,"props":1841,"children":1842},{},[1843],{"type":44,"value":1844},"Functions run with 1024 MB of memory and a proportional amount of compute by default. The default fits most workloads, and raising it has a direct cost impact: function billing scales linearly with the configured size.",{"type":39,"tag":54,"props":1846,"children":1847},{},[1848,1850,1856,1857,1863],{"type":44,"value":1849},"Do NOT set ",{"type":39,"tag":60,"props":1851,"children":1853},{"className":1852},[],[1854],{"type":44,"value":1855},"config.memory",{"type":44,"value":594},{"type":39,"tag":60,"props":1858,"children":1860},{"className":1859},[],[1861],{"type":44,"value":1862},"config.vcpu",{"type":44,"value":1864}," speculatively. Only reach for them when:",{"type":39,"tag":1776,"props":1866,"children":1867},{},[1868,1873],{"type":39,"tag":1780,"props":1869,"children":1870},{},[1871],{"type":44,"value":1872},"The workload is known to be memory- or compute-intensive (AI inference, image\u002FPDF manipulation, large payload processing, CPU-bound work).",{"type":39,"tag":1780,"props":1874,"children":1875},{},[1876],{"type":44,"value":1877},"The function is hitting out-of-memory errors or timeouts caused by the function's own work, rather than by waiting on an external service or database.",{"type":39,"tag":54,"props":1879,"children":1880},{},[1881,1887,1888,1894,1896,1901,1903,1909,1911,1917,1918,1924,1926,1932],{"type":39,"tag":60,"props":1882,"children":1884},{"className":1883},[],[1885],{"type":44,"value":1886},"memory",{"type":44,"value":609},{"type":39,"tag":60,"props":1889,"children":1891},{"className":1890},[],[1892],{"type":44,"value":1893},"vcpu",{"type":44,"value":1895}," configure the same underlying resource and are mutually exclusive — set one, not both. Set ",{"type":39,"tag":60,"props":1897,"children":1899},{"className":1898},[],[1900],{"type":44,"value":1886},{"type":44,"value":1902}," as a number of megabytes (e.g. ",{"type":39,"tag":60,"props":1904,"children":1906},{"className":1905},[],[1907],{"type":44,"value":1908},"memory: 2048",{"type":44,"value":1910},") or as a string with a unit (e.g. ",{"type":39,"tag":60,"props":1912,"children":1914},{"className":1913},[],[1915],{"type":44,"value":1916},"'2gb'",{"type":44,"value":594},{"type":39,"tag":60,"props":1919,"children":1921},{"className":1920},[],[1922],{"type":44,"value":1923},"'2048mb'",{"type":44,"value":1925},", case-insensitive), within the 1024–4096 MB range. Adjusting them is available only on Credit-based Pro and Enterprise plans; on other plans these settings have no effect. See ",{"type":39,"tag":421,"props":1927,"children":1930},{"href":1928,"rel":1929},"https:\u002F\u002Fdocs.netlify.com\u002Fbuild\u002Ffunctions\u002Fconfiguration#memory-or-vcpu",[1829],[1931],{"type":44,"value":1839},{"type":44,"value":1933}," for accepted values and the exact mapping.",{"type":39,"tag":47,"props":1935,"children":1937},{"id":1936},"scheduled-functions",[1938],{"type":44,"value":1939},"Scheduled Functions",{"type":39,"tag":54,"props":1941,"children":1942},{},[1943],{"type":44,"value":1944},"Run on a cron schedule (UTC timezone):",{"type":39,"tag":77,"props":1946,"children":1948},{"className":79,"code":1947,"language":81,"meta":82,"style":82},"export default async (req: Request) => {\n  const { next_run } = await req.json();\n  console.log(\"Next invocation at:\", next_run);\n};\n\nexport const config: Config = {\n  schedule: \"@hourly\", \u002F\u002F or cron: \"0 * * * *\"\n};\n",[1949],{"type":39,"tag":60,"props":1950,"children":1951},{"__ignoreMap":82},[1952,1995,2044,2094,2101,2108,2139,2173],{"type":39,"tag":88,"props":1953,"children":1954},{"class":90,"line":91},[1955,1959,1963,1967,1971,1975,1979,1983,1987,1991],{"type":39,"tag":88,"props":1956,"children":1957},{"style":95},[1958],{"type":44,"value":175},{"type":39,"tag":88,"props":1960,"children":1961},{"style":95},[1962],{"type":44,"value":180},{"type":39,"tag":88,"props":1964,"children":1965},{"style":183},[1966],{"type":44,"value":186},{"type":39,"tag":88,"props":1968,"children":1969},{"style":106},[1970],{"type":44,"value":191},{"type":39,"tag":88,"props":1972,"children":1973},{"style":194},[1974],{"type":44,"value":197},{"type":39,"tag":88,"props":1976,"children":1977},{"style":106},[1978],{"type":44,"value":202},{"type":39,"tag":88,"props":1980,"children":1981},{"style":205},[1982],{"type":44,"value":208},{"type":39,"tag":88,"props":1984,"children":1985},{"style":106},[1986],{"type":44,"value":230},{"type":39,"tag":88,"props":1988,"children":1989},{"style":183},[1990],{"type":44,"value":235},{"type":39,"tag":88,"props":1992,"children":1993},{"style":106},[1994],{"type":44,"value":240},{"type":39,"tag":88,"props":1996,"children":1997},{"class":90,"line":159},[1998,2002,2006,2011,2015,2019,2024,2028,2032,2036,2040],{"type":39,"tag":88,"props":1999,"children":2000},{"style":183},[2001],{"type":44,"value":904},{"type":39,"tag":88,"props":2003,"children":2004},{"style":106},[2005],{"type":44,"value":109},{"type":39,"tag":88,"props":2007,"children":2008},{"style":112},[2009],{"type":44,"value":2010}," next_run",{"type":39,"tag":88,"props":2012,"children":2013},{"style":106},[2014],{"type":44,"value":130},{"type":39,"tag":88,"props":2016,"children":2017},{"style":106},[2018],{"type":44,"value":334},{"type":39,"tag":88,"props":2020,"children":2021},{"style":95},[2022],{"type":44,"value":2023}," await",{"type":39,"tag":88,"props":2025,"children":2026},{"style":112},[2027],{"type":44,"value":1177},{"type":39,"tag":88,"props":2029,"children":2030},{"style":106},[2031],{"type":44,"value":930},{"type":39,"tag":88,"props":2033,"children":2034},{"style":257},[2035],{"type":44,"value":1186},{"type":39,"tag":88,"props":2037,"children":2038},{"style":263},[2039],{"type":44,"value":1600},{"type":39,"tag":88,"props":2041,"children":2042},{"style":106},[2043],{"type":44,"value":156},{"type":39,"tag":88,"props":2045,"children":2046},{"class":90,"line":169},[2047,2052,2056,2061,2065,2069,2074,2078,2082,2086,2090],{"type":39,"tag":88,"props":2048,"children":2049},{"style":112},[2050],{"type":44,"value":2051},"  console",{"type":39,"tag":88,"props":2053,"children":2054},{"style":106},[2055],{"type":44,"value":930},{"type":39,"tag":88,"props":2057,"children":2058},{"style":257},[2059],{"type":44,"value":2060},"log",{"type":39,"tag":88,"props":2062,"children":2063},{"style":263},[2064],{"type":44,"value":266},{"type":39,"tag":88,"props":2066,"children":2067},{"style":106},[2068],{"type":44,"value":151},{"type":39,"tag":88,"props":2070,"children":2071},{"style":143},[2072],{"type":44,"value":2073},"Next invocation at:",{"type":39,"tag":88,"props":2075,"children":2076},{"style":106},[2077],{"type":44,"value":151},{"type":39,"tag":88,"props":2079,"children":2080},{"style":106},[2081],{"type":44,"value":120},{"type":39,"tag":88,"props":2083,"children":2084},{"style":112},[2085],{"type":44,"value":2010},{"type":39,"tag":88,"props":2087,"children":2088},{"style":263},[2089],{"type":44,"value":230},{"type":39,"tag":88,"props":2091,"children":2092},{"style":106},[2093],{"type":44,"value":156},{"type":39,"tag":88,"props":2095,"children":2096},{"class":90,"line":243},[2097],{"type":39,"tag":88,"props":2098,"children":2099},{"style":106},[2100],{"type":44,"value":295},{"type":39,"tag":88,"props":2102,"children":2103},{"class":90,"line":27},[2104],{"type":39,"tag":88,"props":2105,"children":2106},{"emptyLinePlaceholder":163},[2107],{"type":44,"value":166},{"type":39,"tag":88,"props":2109,"children":2110},{"class":90,"line":298},[2111,2115,2119,2123,2127,2131,2135],{"type":39,"tag":88,"props":2112,"children":2113},{"style":95},[2114],{"type":44,"value":175},{"type":39,"tag":88,"props":2116,"children":2117},{"style":183},[2118],{"type":44,"value":316},{"type":39,"tag":88,"props":2120,"children":2121},{"style":112},[2122],{"type":44,"value":321},{"type":39,"tag":88,"props":2124,"children":2125},{"style":106},[2126],{"type":44,"value":202},{"type":39,"tag":88,"props":2128,"children":2129},{"style":205},[2130],{"type":44,"value":125},{"type":39,"tag":88,"props":2132,"children":2133},{"style":106},[2134],{"type":44,"value":334},{"type":39,"tag":88,"props":2136,"children":2137},{"style":106},[2138],{"type":44,"value":240},{"type":39,"tag":88,"props":2140,"children":2141},{"class":90,"line":306},[2142,2147,2151,2155,2160,2164,2168],{"type":39,"tag":88,"props":2143,"children":2144},{"style":263},[2145],{"type":44,"value":2146},"  schedule",{"type":39,"tag":88,"props":2148,"children":2149},{"style":106},[2150],{"type":44,"value":202},{"type":39,"tag":88,"props":2152,"children":2153},{"style":106},[2154],{"type":44,"value":140},{"type":39,"tag":88,"props":2156,"children":2157},{"style":143},[2158],{"type":44,"value":2159},"@hourly",{"type":39,"tag":88,"props":2161,"children":2162},{"style":106},[2163],{"type":44,"value":151},{"type":39,"tag":88,"props":2165,"children":2166},{"style":106},[2167],{"type":44,"value":120},{"type":39,"tag":88,"props":2169,"children":2170},{"style":712},[2171],{"type":44,"value":2172}," \u002F\u002F or cron: \"0 * * * *\"\n",{"type":39,"tag":88,"props":2174,"children":2175},{"class":90,"line":341},[2176],{"type":39,"tag":88,"props":2177,"children":2178},{"style":106},[2179],{"type":44,"value":295},{"type":39,"tag":54,"props":2181,"children":2182},{},[2183,2185,2191,2193,2199,2200,2206,2207,2213,2214,2219,2221,2226],{"type":44,"value":2184},"Shortcuts: ",{"type":39,"tag":60,"props":2186,"children":2188},{"className":2187},[],[2189],{"type":44,"value":2190},"@yearly",{"type":44,"value":2192},", ",{"type":39,"tag":60,"props":2194,"children":2196},{"className":2195},[],[2197],{"type":44,"value":2198},"@monthly",{"type":44,"value":2192},{"type":39,"tag":60,"props":2201,"children":2203},{"className":2202},[],[2204],{"type":44,"value":2205},"@weekly",{"type":44,"value":2192},{"type":39,"tag":60,"props":2208,"children":2210},{"className":2209},[],[2211],{"type":44,"value":2212},"@daily",{"type":44,"value":2192},{"type":39,"tag":60,"props":2215,"children":2217},{"className":2216},[],[2218],{"type":44,"value":2159},{"type":44,"value":2220},". Scheduled functions have a ",{"type":39,"tag":804,"props":2222,"children":2223},{},[2224],{"type":44,"value":2225},"30-second timeout",{"type":44,"value":2227}," and only run on published deploys.",{"type":39,"tag":54,"props":2229,"children":2230},{},[2231,2236,2238,2243,2245,2251,2253,2259,2261,2266,2268,2273],{"type":39,"tag":804,"props":2232,"children":2233},{},[2234],{"type":44,"value":2235},"Testing and triggering.",{"type":44,"value":2237}," A scheduled function does ",{"type":39,"tag":804,"props":2239,"children":2240},{},[2241],{"type":44,"value":2242},"not",{"type":44,"value":2244}," fire on its cron schedule under ",{"type":39,"tag":60,"props":2246,"children":2248},{"className":2247},[],[2249],{"type":44,"value":2250},"netlify dev",{"type":44,"value":2252}," — the local dev server never runs the schedule, so waiting for the clock will appear to do nothing. Test it by invoking it directly: ",{"type":39,"tag":60,"props":2254,"children":2256},{"className":2255},[],[2257],{"type":44,"value":2258},"netlify functions:invoke \u003Cname>",{"type":44,"value":2260}," calls the function once, on demand. In production a scheduled function also has ",{"type":39,"tag":804,"props":2262,"children":2263},{},[2264],{"type":44,"value":2265},"no public HTTP URL",{"type":44,"value":2267}," — it is not reachable at ",{"type":39,"tag":60,"props":2269,"children":2271},{"className":2270},[],[2272],{"type":44,"value":793},{"type":44,"value":2274}," and cannot be triggered by an external HTTP request; it runs only on its schedule. If you also need to trigger the same work over HTTP (a manual \"run now\" or a webhook), expose that logic through a separate ordinary HTTP function and share the implementation rather than trying to POST to the scheduled function.",{"type":39,"tag":47,"props":2276,"children":2278},{"id":2277},"streaming-responses",[2279],{"type":44,"value":2280},"Streaming Responses",{"type":39,"tag":54,"props":2282,"children":2283},{},[2284,2286,2292],{"type":44,"value":2285},"Return a ",{"type":39,"tag":60,"props":2287,"children":2289},{"className":2288},[],[2290],{"type":44,"value":2291},"ReadableStream",{"type":44,"value":2293}," body for streamed responses (up to 20 MB):",{"type":39,"tag":77,"props":2295,"children":2297},{"className":79,"code":2296,"language":81,"meta":82,"style":82},"export default async (req: Request) => {\n  const stream = new ReadableStream({ \u002F* ... *\u002F });\n  return new Response(stream, {\n    headers: { \"Content-Type\": \"text\u002Fevent-stream\" },\n  });\n};\n",[2298],{"type":39,"tag":60,"props":2299,"children":2300},{"__ignoreMap":82},[2301,2344,2395,2427,2478,2494],{"type":39,"tag":88,"props":2302,"children":2303},{"class":90,"line":91},[2304,2308,2312,2316,2320,2324,2328,2332,2336,2340],{"type":39,"tag":88,"props":2305,"children":2306},{"style":95},[2307],{"type":44,"value":175},{"type":39,"tag":88,"props":2309,"children":2310},{"style":95},[2311],{"type":44,"value":180},{"type":39,"tag":88,"props":2313,"children":2314},{"style":183},[2315],{"type":44,"value":186},{"type":39,"tag":88,"props":2317,"children":2318},{"style":106},[2319],{"type":44,"value":191},{"type":39,"tag":88,"props":2321,"children":2322},{"style":194},[2323],{"type":44,"value":197},{"type":39,"tag":88,"props":2325,"children":2326},{"style":106},[2327],{"type":44,"value":202},{"type":39,"tag":88,"props":2329,"children":2330},{"style":205},[2331],{"type":44,"value":208},{"type":39,"tag":88,"props":2333,"children":2334},{"style":106},[2335],{"type":44,"value":230},{"type":39,"tag":88,"props":2337,"children":2338},{"style":183},[2339],{"type":44,"value":235},{"type":39,"tag":88,"props":2341,"children":2342},{"style":106},[2343],{"type":44,"value":240},{"type":39,"tag":88,"props":2345,"children":2346},{"class":90,"line":159},[2347,2351,2356,2360,2364,2369,2373,2378,2383,2387,2391],{"type":39,"tag":88,"props":2348,"children":2349},{"style":183},[2350],{"type":44,"value":904},{"type":39,"tag":88,"props":2352,"children":2353},{"style":112},[2354],{"type":44,"value":2355}," stream",{"type":39,"tag":88,"props":2357,"children":2358},{"style":106},[2359],{"type":44,"value":334},{"type":39,"tag":88,"props":2361,"children":2362},{"style":106},[2363],{"type":44,"value":254},{"type":39,"tag":88,"props":2365,"children":2366},{"style":257},[2367],{"type":44,"value":2368}," ReadableStream",{"type":39,"tag":88,"props":2370,"children":2371},{"style":263},[2372],{"type":44,"value":266},{"type":39,"tag":88,"props":2374,"children":2375},{"style":106},[2376],{"type":44,"value":2377},"{",{"type":39,"tag":88,"props":2379,"children":2380},{"style":712},[2381],{"type":44,"value":2382}," \u002F* ... *\u002F",{"type":39,"tag":88,"props":2384,"children":2385},{"style":106},[2386],{"type":44,"value":130},{"type":39,"tag":88,"props":2388,"children":2389},{"style":263},[2390],{"type":44,"value":230},{"type":39,"tag":88,"props":2392,"children":2393},{"style":106},[2394],{"type":44,"value":156},{"type":39,"tag":88,"props":2396,"children":2397},{"class":90,"line":169},[2398,2402,2406,2410,2414,2419,2423],{"type":39,"tag":88,"props":2399,"children":2400},{"style":95},[2401],{"type":44,"value":249},{"type":39,"tag":88,"props":2403,"children":2404},{"style":106},[2405],{"type":44,"value":254},{"type":39,"tag":88,"props":2407,"children":2408},{"style":257},[2409],{"type":44,"value":260},{"type":39,"tag":88,"props":2411,"children":2412},{"style":263},[2413],{"type":44,"value":266},{"type":39,"tag":88,"props":2415,"children":2416},{"style":112},[2417],{"type":44,"value":2418},"stream",{"type":39,"tag":88,"props":2420,"children":2421},{"style":106},[2422],{"type":44,"value":120},{"type":39,"tag":88,"props":2424,"children":2425},{"style":106},[2426],{"type":44,"value":240},{"type":39,"tag":88,"props":2428,"children":2429},{"class":90,"line":243},[2430,2435,2439,2443,2447,2452,2456,2460,2464,2469,2473],{"type":39,"tag":88,"props":2431,"children":2432},{"style":263},[2433],{"type":44,"value":2434},"    headers",{"type":39,"tag":88,"props":2436,"children":2437},{"style":106},[2438],{"type":44,"value":202},{"type":39,"tag":88,"props":2440,"children":2441},{"style":106},[2442],{"type":44,"value":109},{"type":39,"tag":88,"props":2444,"children":2445},{"style":106},[2446],{"type":44,"value":140},{"type":39,"tag":88,"props":2448,"children":2449},{"style":263},[2450],{"type":44,"value":2451},"Content-Type",{"type":39,"tag":88,"props":2453,"children":2454},{"style":106},[2455],{"type":44,"value":151},{"type":39,"tag":88,"props":2457,"children":2458},{"style":106},[2459],{"type":44,"value":202},{"type":39,"tag":88,"props":2461,"children":2462},{"style":106},[2463],{"type":44,"value":140},{"type":39,"tag":88,"props":2465,"children":2466},{"style":143},[2467],{"type":44,"value":2468},"text\u002Fevent-stream",{"type":39,"tag":88,"props":2470,"children":2471},{"style":106},[2472],{"type":44,"value":151},{"type":39,"tag":88,"props":2474,"children":2475},{"style":106},[2476],{"type":44,"value":2477}," },\n",{"type":39,"tag":88,"props":2479,"children":2480},{"class":90,"line":27},[2481,2486,2490],{"type":39,"tag":88,"props":2482,"children":2483},{"style":106},[2484],{"type":44,"value":2485},"  }",{"type":39,"tag":88,"props":2487,"children":2488},{"style":263},[2489],{"type":44,"value":230},{"type":39,"tag":88,"props":2491,"children":2492},{"style":106},[2493],{"type":44,"value":156},{"type":39,"tag":88,"props":2495,"children":2496},{"class":90,"line":298},[2497],{"type":39,"tag":88,"props":2498,"children":2499},{"style":106},[2500],{"type":44,"value":295},{"type":39,"tag":47,"props":2502,"children":2504},{"id":2503},"event-handlers",[2505],{"type":44,"value":426},{"type":39,"tag":54,"props":2507,"children":2508},{},[2509],{"type":44,"value":2510},"A function can subscribe to platform events by exporting an object instead of a function as its default. Each event has a named handler property:",{"type":39,"tag":77,"props":2512,"children":2514},{"className":79,"code":2513,"language":81,"meta":82,"style":82},"import type { DeploySucceededEvent, UserSignupEvent } from \"@netlify\u002Ffunctions\";\n\nexport default {\n  deploySucceeded(event: DeploySucceededEvent) {\n    console.log(`Deploy ${event.deploy.id} succeeded`);\n  },\n\n  userSignup(event: UserSignupEvent) {\n    return {\n      user: {\n        ...event.user,\n        appMetadata: { ...event.user.appMetadata, roles: [\"member\"] },\n      },\n    };\n  },\n};\n",[2515],{"type":39,"tag":60,"props":2516,"children":2517},{"__ignoreMap":82},[2518,2571,2578,2593,2626,2704,2711,2718,2750,2761,2777,2802,2884,2892,2901,2909],{"type":39,"tag":88,"props":2519,"children":2520},{"class":90,"line":91},[2521,2525,2529,2533,2538,2542,2547,2551,2555,2559,2563,2567],{"type":39,"tag":88,"props":2522,"children":2523},{"style":95},[2524],{"type":44,"value":98},{"type":39,"tag":88,"props":2526,"children":2527},{"style":95},[2528],{"type":44,"value":103},{"type":39,"tag":88,"props":2530,"children":2531},{"style":106},[2532],{"type":44,"value":109},{"type":39,"tag":88,"props":2534,"children":2535},{"style":112},[2536],{"type":44,"value":2537}," DeploySucceededEvent",{"type":39,"tag":88,"props":2539,"children":2540},{"style":106},[2541],{"type":44,"value":120},{"type":39,"tag":88,"props":2543,"children":2544},{"style":112},[2545],{"type":44,"value":2546}," UserSignupEvent",{"type":39,"tag":88,"props":2548,"children":2549},{"style":106},[2550],{"type":44,"value":130},{"type":39,"tag":88,"props":2552,"children":2553},{"style":95},[2554],{"type":44,"value":135},{"type":39,"tag":88,"props":2556,"children":2557},{"style":106},[2558],{"type":44,"value":140},{"type":39,"tag":88,"props":2560,"children":2561},{"style":143},[2562],{"type":44,"value":146},{"type":39,"tag":88,"props":2564,"children":2565},{"style":106},[2566],{"type":44,"value":151},{"type":39,"tag":88,"props":2568,"children":2569},{"style":106},[2570],{"type":44,"value":156},{"type":39,"tag":88,"props":2572,"children":2573},{"class":90,"line":159},[2574],{"type":39,"tag":88,"props":2575,"children":2576},{"emptyLinePlaceholder":163},[2577],{"type":44,"value":166},{"type":39,"tag":88,"props":2579,"children":2580},{"class":90,"line":169},[2581,2585,2589],{"type":39,"tag":88,"props":2582,"children":2583},{"style":95},[2584],{"type":44,"value":175},{"type":39,"tag":88,"props":2586,"children":2587},{"style":95},[2588],{"type":44,"value":180},{"type":39,"tag":88,"props":2590,"children":2591},{"style":106},[2592],{"type":44,"value":240},{"type":39,"tag":88,"props":2594,"children":2595},{"class":90,"line":243},[2596,2601,2605,2610,2614,2618,2622],{"type":39,"tag":88,"props":2597,"children":2598},{"style":263},[2599],{"type":44,"value":2600},"  deploySucceeded",{"type":39,"tag":88,"props":2602,"children":2603},{"style":106},[2604],{"type":44,"value":266},{"type":39,"tag":88,"props":2606,"children":2607},{"style":194},[2608],{"type":44,"value":2609},"event",{"type":39,"tag":88,"props":2611,"children":2612},{"style":106},[2613],{"type":44,"value":202},{"type":39,"tag":88,"props":2615,"children":2616},{"style":205},[2617],{"type":44,"value":2537},{"type":39,"tag":88,"props":2619,"children":2620},{"style":106},[2621],{"type":44,"value":230},{"type":39,"tag":88,"props":2623,"children":2624},{"style":106},[2625],{"type":44,"value":240},{"type":39,"tag":88,"props":2627,"children":2628},{"class":90,"line":27},[2629,2634,2638,2642,2646,2651,2656,2661,2665,2669,2674,2678,2682,2687,2692,2696,2700],{"type":39,"tag":88,"props":2630,"children":2631},{"style":112},[2632],{"type":44,"value":2633},"    console",{"type":39,"tag":88,"props":2635,"children":2636},{"style":106},[2637],{"type":44,"value":930},{"type":39,"tag":88,"props":2639,"children":2640},{"style":257},[2641],{"type":44,"value":2060},{"type":39,"tag":88,"props":2643,"children":2644},{"style":263},[2645],{"type":44,"value":266},{"type":39,"tag":88,"props":2647,"children":2648},{"style":106},[2649],{"type":44,"value":2650},"`",{"type":39,"tag":88,"props":2652,"children":2653},{"style":143},[2654],{"type":44,"value":2655},"Deploy ",{"type":39,"tag":88,"props":2657,"children":2658},{"style":106},[2659],{"type":44,"value":2660},"${",{"type":39,"tag":88,"props":2662,"children":2663},{"style":112},[2664],{"type":44,"value":2609},{"type":39,"tag":88,"props":2666,"children":2667},{"style":106},[2668],{"type":44,"value":930},{"type":39,"tag":88,"props":2670,"children":2671},{"style":112},[2672],{"type":44,"value":2673},"deploy",{"type":39,"tag":88,"props":2675,"children":2676},{"style":106},[2677],{"type":44,"value":930},{"type":39,"tag":88,"props":2679,"children":2680},{"style":112},[2681],{"type":44,"value":1121},{"type":39,"tag":88,"props":2683,"children":2684},{"style":106},[2685],{"type":44,"value":2686},"}",{"type":39,"tag":88,"props":2688,"children":2689},{"style":143},[2690],{"type":44,"value":2691}," succeeded",{"type":39,"tag":88,"props":2693,"children":2694},{"style":106},[2695],{"type":44,"value":2650},{"type":39,"tag":88,"props":2697,"children":2698},{"style":263},[2699],{"type":44,"value":230},{"type":39,"tag":88,"props":2701,"children":2702},{"style":106},[2703],{"type":44,"value":156},{"type":39,"tag":88,"props":2705,"children":2706},{"class":90,"line":298},[2707],{"type":39,"tag":88,"props":2708,"children":2709},{"style":106},[2710],{"type":44,"value":546},{"type":39,"tag":88,"props":2712,"children":2713},{"class":90,"line":306},[2714],{"type":39,"tag":88,"props":2715,"children":2716},{"emptyLinePlaceholder":163},[2717],{"type":44,"value":166},{"type":39,"tag":88,"props":2719,"children":2720},{"class":90,"line":341},[2721,2726,2730,2734,2738,2742,2746],{"type":39,"tag":88,"props":2722,"children":2723},{"style":263},[2724],{"type":44,"value":2725},"  userSignup",{"type":39,"tag":88,"props":2727,"children":2728},{"style":106},[2729],{"type":44,"value":266},{"type":39,"tag":88,"props":2731,"children":2732},{"style":194},[2733],{"type":44,"value":2609},{"type":39,"tag":88,"props":2735,"children":2736},{"style":106},[2737],{"type":44,"value":202},{"type":39,"tag":88,"props":2739,"children":2740},{"style":205},[2741],{"type":44,"value":2546},{"type":39,"tag":88,"props":2743,"children":2744},{"style":106},[2745],{"type":44,"value":230},{"type":39,"tag":88,"props":2747,"children":2748},{"style":106},[2749],{"type":44,"value":240},{"type":39,"tag":88,"props":2751,"children":2752},{"class":90,"line":372},[2753,2757],{"type":39,"tag":88,"props":2754,"children":2755},{"style":95},[2756],{"type":44,"value":506},{"type":39,"tag":88,"props":2758,"children":2759},{"style":106},[2760],{"type":44,"value":240},{"type":39,"tag":88,"props":2762,"children":2763},{"class":90,"line":1363},[2764,2769,2773],{"type":39,"tag":88,"props":2765,"children":2766},{"style":263},[2767],{"type":44,"value":2768},"      user",{"type":39,"tag":88,"props":2770,"children":2771},{"style":106},[2772],{"type":44,"value":202},{"type":39,"tag":88,"props":2774,"children":2775},{"style":106},[2776],{"type":44,"value":240},{"type":39,"tag":88,"props":2778,"children":2779},{"class":90,"line":1395},[2780,2785,2789,2793,2798],{"type":39,"tag":88,"props":2781,"children":2782},{"style":106},[2783],{"type":44,"value":2784},"        ...",{"type":39,"tag":88,"props":2786,"children":2787},{"style":112},[2788],{"type":44,"value":2609},{"type":39,"tag":88,"props":2790,"children":2791},{"style":106},[2792],{"type":44,"value":930},{"type":39,"tag":88,"props":2794,"children":2795},{"style":112},[2796],{"type":44,"value":2797},"user",{"type":39,"tag":88,"props":2799,"children":2800},{"style":106},[2801],{"type":44,"value":369},{"type":39,"tag":88,"props":2803,"children":2804},{"class":90,"line":1424},[2805,2810,2814,2818,2823,2827,2831,2835,2839,2844,2848,2853,2857,2861,2865,2870,2874,2879],{"type":39,"tag":88,"props":2806,"children":2807},{"style":263},[2808],{"type":44,"value":2809},"        appMetadata",{"type":39,"tag":88,"props":2811,"children":2812},{"style":106},[2813],{"type":44,"value":202},{"type":39,"tag":88,"props":2815,"children":2816},{"style":106},[2817],{"type":44,"value":109},{"type":39,"tag":88,"props":2819,"children":2820},{"style":106},[2821],{"type":44,"value":2822}," ...",{"type":39,"tag":88,"props":2824,"children":2825},{"style":112},[2826],{"type":44,"value":2609},{"type":39,"tag":88,"props":2828,"children":2829},{"style":106},[2830],{"type":44,"value":930},{"type":39,"tag":88,"props":2832,"children":2833},{"style":112},[2834],{"type":44,"value":2797},{"type":39,"tag":88,"props":2836,"children":2837},{"style":106},[2838],{"type":44,"value":930},{"type":39,"tag":88,"props":2840,"children":2841},{"style":112},[2842],{"type":44,"value":2843},"appMetadata",{"type":39,"tag":88,"props":2845,"children":2846},{"style":106},[2847],{"type":44,"value":120},{"type":39,"tag":88,"props":2849,"children":2850},{"style":263},[2851],{"type":44,"value":2852}," roles",{"type":39,"tag":88,"props":2854,"children":2855},{"style":106},[2856],{"type":44,"value":202},{"type":39,"tag":88,"props":2858,"children":2859},{"style":263},[2860],{"type":44,"value":1439},{"type":39,"tag":88,"props":2862,"children":2863},{"style":106},[2864],{"type":44,"value":151},{"type":39,"tag":88,"props":2866,"children":2867},{"style":143},[2868],{"type":44,"value":2869},"member",{"type":39,"tag":88,"props":2871,"children":2872},{"style":106},[2873],{"type":44,"value":151},{"type":39,"tag":88,"props":2875,"children":2876},{"style":263},[2877],{"type":44,"value":2878},"] ",{"type":39,"tag":88,"props":2880,"children":2881},{"style":106},[2882],{"type":44,"value":2883},"},\n",{"type":39,"tag":88,"props":2885,"children":2886},{"class":90,"line":1495},[2887],{"type":39,"tag":88,"props":2888,"children":2889},{"style":106},[2890],{"type":44,"value":2891},"      },\n",{"type":39,"tag":88,"props":2893,"children":2895},{"class":90,"line":2894},14,[2896],{"type":39,"tag":88,"props":2897,"children":2898},{"style":106},[2899],{"type":44,"value":2900},"    };\n",{"type":39,"tag":88,"props":2902,"children":2904},{"class":90,"line":2903},15,[2905],{"type":39,"tag":88,"props":2906,"children":2907},{"style":106},[2908],{"type":44,"value":546},{"type":39,"tag":88,"props":2910,"children":2912},{"class":90,"line":2911},16,[2913],{"type":39,"tag":88,"props":2914,"children":2915},{"style":106},[2916],{"type":44,"value":295},{"type":39,"tag":54,"props":2918,"children":2919},{},[2920],{"type":44,"value":2921},"A single function can declare multiple handlers; multiple functions can also subscribe to the same event.",{"type":39,"tag":54,"props":2923,"children":2924},{},[2925],{"type":39,"tag":804,"props":2926,"children":2927},{},[2928],{"type":44,"value":2929},"Available handlers:",{"type":39,"tag":2931,"props":2932,"children":2933},"table",{},[2934,2953],{"type":39,"tag":2935,"props":2936,"children":2937},"thead",{},[2938],{"type":39,"tag":2939,"props":2940,"children":2941},"tr",{},[2942,2948],{"type":39,"tag":2943,"props":2944,"children":2945},"th",{},[2946],{"type":44,"value":2947},"Handler",{"type":39,"tag":2943,"props":2949,"children":2950},{},[2951],{"type":44,"value":2952},"Trigger",{"type":39,"tag":2954,"props":2955,"children":2956},"tbody",{},[2957,2974,3027,3072],{"type":39,"tag":2939,"props":2958,"children":2959},{},[2960,2969],{"type":39,"tag":2961,"props":2962,"children":2963},"td",{},[2964],{"type":39,"tag":60,"props":2965,"children":2967},{"className":2966},[],[2968],{"type":44,"value":417},{"type":39,"tag":2961,"props":2970,"children":2971},{},[2972],{"type":44,"value":2973},"HTTP request (equivalent to a bare function default export)",{"type":39,"tag":2939,"props":2975,"children":2976},{},[2977,3022],{"type":39,"tag":2961,"props":2978,"children":2979},{},[2980,2986,2988,2994,2995,3001,3002,3008,3009,3015,3016],{"type":39,"tag":60,"props":2981,"children":2983},{"className":2982},[],[2984],{"type":44,"value":2985},"deployBuilding",{"type":44,"value":2987}," \u002F ",{"type":39,"tag":60,"props":2989,"children":2991},{"className":2990},[],[2992],{"type":44,"value":2993},"deploySucceeded",{"type":44,"value":2987},{"type":39,"tag":60,"props":2996,"children":2998},{"className":2997},[],[2999],{"type":44,"value":3000},"deployFailed",{"type":44,"value":2987},{"type":39,"tag":60,"props":3003,"children":3005},{"className":3004},[],[3006],{"type":44,"value":3007},"deployDeleted",{"type":44,"value":2987},{"type":39,"tag":60,"props":3010,"children":3012},{"className":3011},[],[3013],{"type":44,"value":3014},"deployLocked",{"type":44,"value":2987},{"type":39,"tag":60,"props":3017,"children":3019},{"className":3018},[],[3020],{"type":44,"value":3021},"deployUnlocked",{"type":39,"tag":2961,"props":3023,"children":3024},{},[3025],{"type":44,"value":3026},"Deploy lifecycle",{"type":39,"tag":2939,"props":3028,"children":3029},{},[3030,3067],{"type":39,"tag":2961,"props":3031,"children":3032},{},[3033,3039,3040,3046,3047,3053,3054,3060,3061],{"type":39,"tag":60,"props":3034,"children":3036},{"className":3035},[],[3037],{"type":44,"value":3038},"userSignup",{"type":44,"value":2987},{"type":39,"tag":60,"props":3041,"children":3043},{"className":3042},[],[3044],{"type":44,"value":3045},"userLogin",{"type":44,"value":2987},{"type":39,"tag":60,"props":3048,"children":3050},{"className":3049},[],[3051],{"type":44,"value":3052},"userValidate",{"type":44,"value":2987},{"type":39,"tag":60,"props":3055,"children":3057},{"className":3056},[],[3058],{"type":44,"value":3059},"userModified",{"type":44,"value":2987},{"type":39,"tag":60,"props":3062,"children":3064},{"className":3063},[],[3065],{"type":44,"value":3066},"userDeleted",{"type":39,"tag":2961,"props":3068,"children":3069},{},[3070],{"type":44,"value":3071},"Identity lifecycle",{"type":39,"tag":2939,"props":3073,"children":3074},{},[3075,3084],{"type":39,"tag":2961,"props":3076,"children":3077},{},[3078],{"type":39,"tag":60,"props":3079,"children":3081},{"className":3080},[],[3082],{"type":44,"value":3083},"formSubmitted",{"type":39,"tag":2961,"props":3085,"children":3086},{},[3087],{"type":44,"value":3088},"Form submission verified",{"type":39,"tag":3090,"props":3091,"children":3093},"h3",{"id":3092},"identity-handlers-deny-an-action",[3094],{"type":44,"value":3095},"Identity handlers: deny an action",{"type":39,"tag":54,"props":3097,"children":3098},{},[3099,3104,3105,3110,3111,3116,3118,3123,3125,3131],{"type":39,"tag":60,"props":3100,"children":3102},{"className":3101},[],[3103],{"type":44,"value":3038},{"type":44,"value":2192},{"type":39,"tag":60,"props":3106,"children":3108},{"className":3107},[],[3109],{"type":44,"value":3045},{"type":44,"value":2192},{"type":39,"tag":60,"props":3112,"children":3114},{"className":3113},[],[3115],{"type":44,"value":3052},{"type":44,"value":3117},", and ",{"type":39,"tag":60,"props":3119,"children":3121},{"className":3120},[],[3122],{"type":44,"value":3059},{"type":44,"value":3124}," can reject the action by calling ",{"type":39,"tag":60,"props":3126,"children":3128},{"className":3127},[],[3129],{"type":44,"value":3130},"event.deny()",{"type":44,"value":3132},". The end user receives a 401; no observability error is produced (unlike throwing).",{"type":39,"tag":77,"props":3134,"children":3136},{"className":79,"code":3135,"language":81,"meta":82,"style":82},"export default {\n  userLogin(event: UserLoginEvent) {\n    if (!event.user.email?.endsWith(\"@example.com\")) {\n      return event.deny();\n    }\n  },\n};\n",[3137],{"type":39,"tag":60,"props":3138,"children":3139},{"__ignoreMap":82},[3140,3155,3188,3262,3292,3300,3307],{"type":39,"tag":88,"props":3141,"children":3142},{"class":90,"line":91},[3143,3147,3151],{"type":39,"tag":88,"props":3144,"children":3145},{"style":95},[3146],{"type":44,"value":175},{"type":39,"tag":88,"props":3148,"children":3149},{"style":95},[3150],{"type":44,"value":180},{"type":39,"tag":88,"props":3152,"children":3153},{"style":106},[3154],{"type":44,"value":240},{"type":39,"tag":88,"props":3156,"children":3157},{"class":90,"line":159},[3158,3163,3167,3171,3175,3180,3184],{"type":39,"tag":88,"props":3159,"children":3160},{"style":263},[3161],{"type":44,"value":3162},"  userLogin",{"type":39,"tag":88,"props":3164,"children":3165},{"style":106},[3166],{"type":44,"value":266},{"type":39,"tag":88,"props":3168,"children":3169},{"style":194},[3170],{"type":44,"value":2609},{"type":39,"tag":88,"props":3172,"children":3173},{"style":106},[3174],{"type":44,"value":202},{"type":39,"tag":88,"props":3176,"children":3177},{"style":205},[3178],{"type":44,"value":3179}," UserLoginEvent",{"type":39,"tag":88,"props":3181,"children":3182},{"style":106},[3183],{"type":44,"value":230},{"type":39,"tag":88,"props":3185,"children":3186},{"style":106},[3187],{"type":44,"value":240},{"type":39,"tag":88,"props":3189,"children":3190},{"class":90,"line":169},[3191,3196,3200,3205,3209,3213,3217,3221,3226,3231,3236,3240,3244,3249,3253,3258],{"type":39,"tag":88,"props":3192,"children":3193},{"style":95},[3194],{"type":44,"value":3195},"    if",{"type":39,"tag":88,"props":3197,"children":3198},{"style":263},[3199],{"type":44,"value":191},{"type":39,"tag":88,"props":3201,"children":3202},{"style":106},[3203],{"type":44,"value":3204},"!",{"type":39,"tag":88,"props":3206,"children":3207},{"style":112},[3208],{"type":44,"value":2609},{"type":39,"tag":88,"props":3210,"children":3211},{"style":106},[3212],{"type":44,"value":930},{"type":39,"tag":88,"props":3214,"children":3215},{"style":112},[3216],{"type":44,"value":2797},{"type":39,"tag":88,"props":3218,"children":3219},{"style":106},[3220],{"type":44,"value":930},{"type":39,"tag":88,"props":3222,"children":3223},{"style":112},[3224],{"type":44,"value":3225},"email",{"type":39,"tag":88,"props":3227,"children":3228},{"style":106},[3229],{"type":44,"value":3230},"?.",{"type":39,"tag":88,"props":3232,"children":3233},{"style":257},[3234],{"type":44,"value":3235},"endsWith",{"type":39,"tag":88,"props":3237,"children":3238},{"style":263},[3239],{"type":44,"value":266},{"type":39,"tag":88,"props":3241,"children":3242},{"style":106},[3243],{"type":44,"value":151},{"type":39,"tag":88,"props":3245,"children":3246},{"style":143},[3247],{"type":44,"value":3248},"@example.com",{"type":39,"tag":88,"props":3250,"children":3251},{"style":106},[3252],{"type":44,"value":151},{"type":39,"tag":88,"props":3254,"children":3255},{"style":263},[3256],{"type":44,"value":3257},")) ",{"type":39,"tag":88,"props":3259,"children":3260},{"style":106},[3261],{"type":44,"value":1061},{"type":39,"tag":88,"props":3263,"children":3264},{"class":90,"line":243},[3265,3270,3275,3279,3284,3288],{"type":39,"tag":88,"props":3266,"children":3267},{"style":95},[3268],{"type":44,"value":3269},"      return",{"type":39,"tag":88,"props":3271,"children":3272},{"style":112},[3273],{"type":44,"value":3274}," event",{"type":39,"tag":88,"props":3276,"children":3277},{"style":106},[3278],{"type":44,"value":930},{"type":39,"tag":88,"props":3280,"children":3281},{"style":257},[3282],{"type":44,"value":3283},"deny",{"type":39,"tag":88,"props":3285,"children":3286},{"style":263},[3287],{"type":44,"value":1600},{"type":39,"tag":88,"props":3289,"children":3290},{"style":106},[3291],{"type":44,"value":156},{"type":39,"tag":88,"props":3293,"children":3294},{"class":90,"line":27},[3295],{"type":39,"tag":88,"props":3296,"children":3297},{"style":106},[3298],{"type":44,"value":3299},"    }\n",{"type":39,"tag":88,"props":3301,"children":3302},{"class":90,"line":298},[3303],{"type":39,"tag":88,"props":3304,"children":3305},{"style":106},[3306],{"type":44,"value":546},{"type":39,"tag":88,"props":3308,"children":3309},{"class":90,"line":306},[3310],{"type":39,"tag":88,"props":3311,"children":3312},{"style":106},[3313],{"type":44,"value":295},{"type":39,"tag":54,"props":3315,"children":3316},{},[3317,3319,3324],{"type":44,"value":3318},"If multiple functions subscribe to the same event, the first to call ",{"type":39,"tag":60,"props":3320,"children":3322},{"className":3321},[],[3323],{"type":44,"value":3130},{"type":44,"value":3325}," aborts the chain.",{"type":39,"tag":47,"props":3327,"children":3329},{"id":3328},"context-object",[3330],{"type":44,"value":3331},"Context Object",{"type":39,"tag":2931,"props":3333,"children":3334},{},[3335,3351],{"type":39,"tag":2935,"props":3336,"children":3337},{},[3338],{"type":39,"tag":2939,"props":3339,"children":3340},{},[3341,3346],{"type":39,"tag":2943,"props":3342,"children":3343},{},[3344],{"type":44,"value":3345},"Property",{"type":39,"tag":2943,"props":3347,"children":3348},{},[3349],{"type":44,"value":3350},"Description",{"type":39,"tag":2954,"props":3352,"children":3353},{},[3354,3370,3391,3408,3443,3464,3485,3502,3519],{"type":39,"tag":2939,"props":3355,"children":3356},{},[3357,3365],{"type":39,"tag":2961,"props":3358,"children":3359},{},[3360],{"type":39,"tag":60,"props":3361,"children":3363},{"className":3362},[],[3364],{"type":44,"value":821},{"type":39,"tag":2961,"props":3366,"children":3367},{},[3368],{"type":44,"value":3369},"Path parameters from config",{"type":39,"tag":2939,"props":3371,"children":3372},{},[3373,3382],{"type":39,"tag":2961,"props":3374,"children":3375},{},[3376],{"type":39,"tag":60,"props":3377,"children":3379},{"className":3378},[],[3380],{"type":44,"value":3381},"context.geo",{"type":39,"tag":2961,"props":3383,"children":3384},{},[3385],{"type":39,"tag":60,"props":3386,"children":3388},{"className":3387},[],[3389],{"type":44,"value":3390},"{ city, country: {code, name}, latitude, longitude, subdivision, timezone, postalCode }",{"type":39,"tag":2939,"props":3392,"children":3393},{},[3394,3403],{"type":39,"tag":2961,"props":3395,"children":3396},{},[3397],{"type":39,"tag":60,"props":3398,"children":3400},{"className":3399},[],[3401],{"type":44,"value":3402},"context.ip",{"type":39,"tag":2961,"props":3404,"children":3405},{},[3406],{"type":44,"value":3407},"Client IP address",{"type":39,"tag":2939,"props":3409,"children":3410},{},[3411,3420],{"type":39,"tag":2961,"props":3412,"children":3413},{},[3414],{"type":39,"tag":60,"props":3415,"children":3417},{"className":3416},[],[3418],{"type":44,"value":3419},"context.cookies",{"type":39,"tag":2961,"props":3421,"children":3422},{},[3423,3429,3430,3436,3437],{"type":39,"tag":60,"props":3424,"children":3426},{"className":3425},[],[3427],{"type":44,"value":3428},".get()",{"type":44,"value":2192},{"type":39,"tag":60,"props":3431,"children":3433},{"className":3432},[],[3434],{"type":44,"value":3435},".set()",{"type":44,"value":2192},{"type":39,"tag":60,"props":3438,"children":3440},{"className":3439},[],[3441],{"type":44,"value":3442},".delete()",{"type":39,"tag":2939,"props":3444,"children":3445},{},[3446,3455],{"type":39,"tag":2961,"props":3447,"children":3448},{},[3449],{"type":39,"tag":60,"props":3450,"children":3452},{"className":3451},[],[3453],{"type":44,"value":3454},"context.deploy",{"type":39,"tag":2961,"props":3456,"children":3457},{},[3458],{"type":39,"tag":60,"props":3459,"children":3461},{"className":3460},[],[3462],{"type":44,"value":3463},"{ context, id, published }",{"type":39,"tag":2939,"props":3465,"children":3466},{},[3467,3476],{"type":39,"tag":2961,"props":3468,"children":3469},{},[3470],{"type":39,"tag":60,"props":3471,"children":3473},{"className":3472},[],[3474],{"type":44,"value":3475},"context.site",{"type":39,"tag":2961,"props":3477,"children":3478},{},[3479],{"type":39,"tag":60,"props":3480,"children":3482},{"className":3481},[],[3483],{"type":44,"value":3484},"{ id, name, url }",{"type":39,"tag":2939,"props":3486,"children":3487},{},[3488,3497],{"type":39,"tag":2961,"props":3489,"children":3490},{},[3491],{"type":39,"tag":60,"props":3492,"children":3494},{"className":3493},[],[3495],{"type":44,"value":3496},"context.account.id",{"type":39,"tag":2961,"props":3498,"children":3499},{},[3500],{"type":44,"value":3501},"Team account ID",{"type":39,"tag":2939,"props":3503,"children":3504},{},[3505,3514],{"type":39,"tag":2961,"props":3506,"children":3507},{},[3508],{"type":39,"tag":60,"props":3509,"children":3511},{"className":3510},[],[3512],{"type":44,"value":3513},"context.requestId",{"type":39,"tag":2961,"props":3515,"children":3516},{},[3517],{"type":44,"value":3518},"Unique request ID",{"type":39,"tag":2939,"props":3520,"children":3521},{},[3522,3531],{"type":39,"tag":2961,"props":3523,"children":3524},{},[3525],{"type":39,"tag":60,"props":3526,"children":3528},{"className":3527},[],[3529],{"type":44,"value":3530},"context.waitUntil(promise)",{"type":39,"tag":2961,"props":3532,"children":3533},{},[3534],{"type":44,"value":3535},"Extend execution after response is sent",{"type":39,"tag":54,"props":3537,"children":3538},{},[3539,3561,3563,3569,3571,3577,3579,3585,3587,3592],{"type":39,"tag":804,"props":3540,"children":3541},{},[3542,3547,3548,3553,3555,3560],{"type":39,"tag":60,"props":3543,"children":3545},{"className":3544},[],[3546],{"type":44,"value":3381},{"type":44,"value":609},{"type":39,"tag":60,"props":3549,"children":3551},{"className":3550},[],[3552],{"type":44,"value":3402},{"type":44,"value":3554}," are mocked under ",{"type":39,"tag":60,"props":3556,"children":3558},{"className":3557},[],[3559],{"type":44,"value":2250},{"type":44,"value":930},{"type":44,"value":3562}," Locally these return placeholder values, not your real location or client IP, so a value that looks \"stuck\" on a default country does not mean your geo code is broken — real geolocation is populated only for deployed functions. To exercise geo branching locally, start dev with the geo flags: ",{"type":39,"tag":60,"props":3564,"children":3566},{"className":3565},[],[3567],{"type":44,"value":3568},"netlify dev --geo=mock --country=DE",{"type":44,"value":3570}," forces mock data (",{"type":39,"tag":60,"props":3572,"children":3574},{"className":3573},[],[3575],{"type":44,"value":3576},"--geo=mock",{"type":44,"value":3578},") and sets the mock country (",{"type":39,"tag":60,"props":3580,"children":3582},{"className":3581},[],[3583],{"type":44,"value":3584},"--country",{"type":44,"value":3586},"). Don't conclude ",{"type":39,"tag":60,"props":3588,"children":3590},{"className":3589},[],[3591],{"type":44,"value":3381},{"type":44,"value":3593}," is broken because local values never change.",{"type":39,"tag":47,"props":3595,"children":3597},{"id":3596},"environment-variables",[3598],{"type":44,"value":3599},"Environment Variables",{"type":39,"tag":54,"props":3601,"children":3602},{},[3603,3605,3611],{"type":44,"value":3604},"Prefer ",{"type":39,"tag":60,"props":3606,"children":3608},{"className":3607},[],[3609],{"type":44,"value":3610},"Netlify.env.get",{"type":44,"value":3612}," inside functions:",{"type":39,"tag":77,"props":3614,"children":3616},{"className":79,"code":3615,"language":81,"meta":82,"style":82},"const apiKey = Netlify.env.get(\"API_KEY\");\n",[3617],{"type":39,"tag":60,"props":3618,"children":3619},{"__ignoreMap":82},[3620],{"type":39,"tag":88,"props":3621,"children":3622},{"class":90,"line":91},[3623,3628,3633,3638,3643,3647,3652,3656,3661,3665,3669,3674,3678,3682],{"type":39,"tag":88,"props":3624,"children":3625},{"style":183},[3626],{"type":44,"value":3627},"const",{"type":39,"tag":88,"props":3629,"children":3630},{"style":112},[3631],{"type":44,"value":3632}," apiKey ",{"type":39,"tag":88,"props":3634,"children":3635},{"style":106},[3636],{"type":44,"value":3637},"=",{"type":39,"tag":88,"props":3639,"children":3640},{"style":112},[3641],{"type":44,"value":3642}," Netlify",{"type":39,"tag":88,"props":3644,"children":3645},{"style":106},[3646],{"type":44,"value":930},{"type":39,"tag":88,"props":3648,"children":3649},{"style":112},[3650],{"type":44,"value":3651},"env",{"type":39,"tag":88,"props":3653,"children":3654},{"style":106},[3655],{"type":44,"value":930},{"type":39,"tag":88,"props":3657,"children":3658},{"style":257},[3659],{"type":44,"value":3660},"get",{"type":39,"tag":88,"props":3662,"children":3663},{"style":112},[3664],{"type":44,"value":266},{"type":39,"tag":88,"props":3666,"children":3667},{"style":106},[3668],{"type":44,"value":151},{"type":39,"tag":88,"props":3670,"children":3671},{"style":143},[3672],{"type":44,"value":3673},"API_KEY",{"type":39,"tag":88,"props":3675,"children":3676},{"style":106},[3677],{"type":44,"value":151},{"type":39,"tag":88,"props":3679,"children":3680},{"style":112},[3681],{"type":44,"value":230},{"type":39,"tag":88,"props":3683,"children":3684},{"style":106},[3685],{"type":44,"value":156},{"type":39,"tag":54,"props":3687,"children":3688},{},[3689,3695,3697,3702,3704,3708,3710,3715,3717,3722],{"type":39,"tag":60,"props":3690,"children":3692},{"className":3691},[],[3693],{"type":44,"value":3694},"process.env",{"type":44,"value":3696}," is also valid inside Functions and reads the same variables — prefer ",{"type":39,"tag":60,"props":3698,"children":3700},{"className":3699},[],[3701],{"type":44,"value":3610},{"type":44,"value":3703}," for cross-runtime and edge portability (a function you later move to an Edge Function keeps working, since Edge Functions expose ",{"type":39,"tag":804,"props":3705,"children":3706},{},[3707],{"type":44,"value":808},{"type":44,"value":3709}," ",{"type":39,"tag":60,"props":3711,"children":3713},{"className":3712},[],[3714],{"type":44,"value":3610},{"type":44,"value":3716},", not ",{"type":39,"tag":60,"props":3718,"children":3720},{"className":3719},[],[3721],{"type":44,"value":3694},{"type":44,"value":3723},").",{"type":39,"tag":54,"props":3725,"children":3726},{},[3727,3732,3734,3740],{"type":39,"tag":804,"props":3728,"children":3729},{},[3730],{"type":44,"value":3731},"Environment variables have a small total size budget.",{"type":44,"value":3733}," Functions run on AWS Lambda, which caps the ",{"type":39,"tag":3735,"props":3736,"children":3737},"em",{},[3738],{"type":44,"value":3739},"combined",{"type":44,"value":3741}," size of all environment variables at roughly 4 KB. A single large value — a service-account JSON credential, a PEM private key, a big config blob — can blow past that on its own and break the deploy or the function at runtime. Do not store large payloads in environment variables; keep only small secrets and config (API keys, connection strings) there and move anything large into a bundled file, Netlify Blobs, or a fetch at runtime. There is no Netlify setting that raises this cap.",{"type":39,"tag":47,"props":3743,"children":3745},{"id":3744},"reading-files-at-runtime",[3746],{"type":44,"value":3747},"Reading Files at Runtime",{"type":39,"tag":54,"props":3749,"children":3750},{},[3751,3753,3758,3760,3766,3768,3774,3776,3780,3782,3787],{"type":44,"value":3752},"Only a function's own code and the modules it ",{"type":39,"tag":60,"props":3754,"children":3756},{"className":3755},[],[3757],{"type":44,"value":98},{"type":44,"value":3759},"s are bundled and deployed. A file the function opens from disk at runtime — ",{"type":39,"tag":60,"props":3761,"children":3763},{"className":3762},[],[3764],{"type":44,"value":3765},"fs.readFile",{"type":44,"value":3767},"\u002F",{"type":39,"tag":60,"props":3769,"children":3771},{"className":3770},[],[3772],{"type":44,"value":3773},"readFileSync",{"type":44,"value":3775}," on a template, a JSON data file, a WASM binary, a fixture — is ",{"type":39,"tag":804,"props":3777,"children":3778},{},[3779],{"type":44,"value":2242},{"type":44,"value":3781}," part of the bundle unless you declare it. This is a classic \"works locally, ENOENT in production\" trap: under ",{"type":39,"tag":60,"props":3783,"children":3785},{"className":3784},[],[3786],{"type":44,"value":2250},{"type":44,"value":3788}," the function reads the file straight from your working tree, but the deployed function only contains what was bundled.",{"type":39,"tag":54,"props":3790,"children":3791},{},[3792,3794,3800,3802,3808],{"type":44,"value":3793},"Declare runtime-read files with ",{"type":39,"tag":60,"props":3795,"children":3797},{"className":3796},[],[3798],{"type":44,"value":3799},"included_files",{"type":44,"value":3801}," in ",{"type":39,"tag":60,"props":3803,"children":3805},{"className":3804},[],[3806],{"type":44,"value":3807},"netlify.toml",{"type":44,"value":3809}," so they ship with the function:",{"type":39,"tag":77,"props":3811,"children":3815},{"className":3812,"code":3813,"language":3814,"meta":82,"style":82},"language-toml shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","[functions]\n  included_files = [\"netlify\u002Ffunctions\u002Ftemplates\u002F**\"]\n\n# or scope it to one function:\n[functions.\"render-email\"]\n  included_files = [\"netlify\u002Ffunctions\u002Ftemplates\u002Fwelcome.html\"]\n","toml",[3816],{"type":39,"tag":60,"props":3817,"children":3818},{"__ignoreMap":82},[3819,3827,3835,3842,3850,3858],{"type":39,"tag":88,"props":3820,"children":3821},{"class":90,"line":91},[3822],{"type":39,"tag":88,"props":3823,"children":3824},{},[3825],{"type":44,"value":3826},"[functions]\n",{"type":39,"tag":88,"props":3828,"children":3829},{"class":90,"line":159},[3830],{"type":39,"tag":88,"props":3831,"children":3832},{},[3833],{"type":44,"value":3834},"  included_files = [\"netlify\u002Ffunctions\u002Ftemplates\u002F**\"]\n",{"type":39,"tag":88,"props":3836,"children":3837},{"class":90,"line":169},[3838],{"type":39,"tag":88,"props":3839,"children":3840},{"emptyLinePlaceholder":163},[3841],{"type":44,"value":166},{"type":39,"tag":88,"props":3843,"children":3844},{"class":90,"line":243},[3845],{"type":39,"tag":88,"props":3846,"children":3847},{},[3848],{"type":44,"value":3849},"# or scope it to one function:\n",{"type":39,"tag":88,"props":3851,"children":3852},{"class":90,"line":27},[3853],{"type":39,"tag":88,"props":3854,"children":3855},{},[3856],{"type":44,"value":3857},"[functions.\"render-email\"]\n",{"type":39,"tag":88,"props":3859,"children":3860},{"class":90,"line":298},[3861],{"type":39,"tag":88,"props":3862,"children":3863},{},[3864],{"type":44,"value":3865},"  included_files = [\"netlify\u002Ffunctions\u002Ftemplates\u002Fwelcome.html\"]\n",{"type":39,"tag":54,"props":3867,"children":3868},{},[3869,3871,3877,3879,3884],{"type":44,"value":3870},"When the data is static, prefer importing it as a module (",{"type":39,"tag":60,"props":3872,"children":3874},{"className":3873},[],[3875],{"type":44,"value":3876},"import data from \".\u002Fdata.json\"",{"type":44,"value":3878},") so bundling is automatic; reach for ",{"type":39,"tag":60,"props":3880,"children":3882},{"className":3881},[],[3883],{"type":44,"value":3799},{"type":44,"value":3885}," for files you must read from the filesystem at runtime.",{"type":39,"tag":47,"props":3887,"children":3889},{"id":3888},"resource-limits",[3890],{"type":44,"value":3891},"Resource Limits",{"type":39,"tag":2931,"props":3893,"children":3894},{},[3895,3911],{"type":39,"tag":2935,"props":3896,"children":3897},{},[3898],{"type":39,"tag":2939,"props":3899,"children":3900},{},[3901,3906],{"type":39,"tag":2943,"props":3902,"children":3903},{},[3904],{"type":44,"value":3905},"Resource",{"type":39,"tag":2943,"props":3907,"children":3908},{},[3909],{"type":44,"value":3910},"Limit",{"type":39,"tag":2954,"props":3912,"children":3913},{},[3914,3927,3940,3953,3972,3985],{"type":39,"tag":2939,"props":3915,"children":3916},{},[3917,3922],{"type":39,"tag":2961,"props":3918,"children":3919},{},[3920],{"type":44,"value":3921},"Synchronous timeout",{"type":39,"tag":2961,"props":3923,"children":3924},{},[3925],{"type":44,"value":3926},"60 seconds",{"type":39,"tag":2939,"props":3928,"children":3929},{},[3930,3935],{"type":39,"tag":2961,"props":3931,"children":3932},{},[3933],{"type":44,"value":3934},"Background timeout",{"type":39,"tag":2961,"props":3936,"children":3937},{},[3938],{"type":44,"value":3939},"15 minutes",{"type":39,"tag":2939,"props":3941,"children":3942},{},[3943,3948],{"type":39,"tag":2961,"props":3944,"children":3945},{},[3946],{"type":44,"value":3947},"Scheduled timeout",{"type":39,"tag":2961,"props":3949,"children":3950},{},[3951],{"type":44,"value":3952},"30 seconds",{"type":39,"tag":2939,"props":3954,"children":3955},{},[3956,3961],{"type":39,"tag":2961,"props":3957,"children":3958},{},[3959],{"type":44,"value":3960},"Memory",{"type":39,"tag":2961,"props":3962,"children":3963},{},[3964,3966,3971],{"type":44,"value":3965},"1024 MB default; configurable 1024–4096 MB (see ",{"type":39,"tag":421,"props":3967,"children":3969},{"href":3968},"#memory-or-vcpu",[3970],{"type":44,"value":1839},{"type":44,"value":230},{"type":39,"tag":2939,"props":3973,"children":3974},{},[3975,3980],{"type":39,"tag":2961,"props":3976,"children":3977},{},[3978],{"type":44,"value":3979},"Buffered payload",{"type":39,"tag":2961,"props":3981,"children":3982},{},[3983],{"type":44,"value":3984},"6 MB",{"type":39,"tag":2939,"props":3986,"children":3987},{},[3988,3993],{"type":39,"tag":2961,"props":3989,"children":3990},{},[3991],{"type":44,"value":3992},"Streamed payload",{"type":39,"tag":2961,"props":3994,"children":3995},{},[3996],{"type":44,"value":3997},"20 MB",{"type":39,"tag":47,"props":3999,"children":4001},{"id":4000},"framework-considerations",[4002],{"type":44,"value":4003},"Framework Considerations",{"type":39,"tag":54,"props":4005,"children":4006},{},[4007],{"type":44,"value":4008},"Frameworks with server-side capabilities (Astro, Next.js, Nuxt, SvelteKit, TanStack Start) typically generate their own serverless functions via adapters. You usually do not write raw Netlify Functions in these projects — the framework adapter handles server-side rendering and API routes. Write Netlify Functions directly when:",{"type":39,"tag":1776,"props":4010,"children":4011},{},[4012,4017,4022],{"type":39,"tag":1780,"props":4013,"children":4014},{},[4015],{"type":44,"value":4016},"Using a client-side-only framework (Vite + React SPA, vanilla JS)",{"type":39,"tag":1780,"props":4018,"children":4019},{},[4020],{"type":44,"value":4021},"Adding background or scheduled tasks to any project",{"type":39,"tag":1780,"props":4023,"children":4024},{},[4025],{"type":44,"value":4026},"Building standalone API endpoints outside the framework's routing",{"type":39,"tag":54,"props":4028,"children":4029},{},[4030,4032,4037],{"type":44,"value":4031},"See the ",{"type":39,"tag":804,"props":4033,"children":4034},{},[4035],{"type":44,"value":4036},"netlify-frameworks",{"type":44,"value":4038}," skill for adapter setup.",{"type":39,"tag":4040,"props":4041,"children":4042},"style",{},[4043],{"type":44,"value":4044},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":4046,"total":2903},[4047,4064,4081,4094,4109,4126,4138],{"slug":4048,"name":4048,"fn":4049,"description":4050,"org":4051,"tags":4052,"stars":23,"repoUrl":24,"updatedAt":4063},"netlify-access-control","manage Netlify site access control","Use when the task involves controlling who can reach a Netlify site, or telling Netlify Identity apart from Secure Access. Trigger whenever the user wants to lock a site or deploy to their company\u002Fteam, restrict access to employees only, build an internal or employees-only app, set up password protection, SSO, or SAML, asks \"who can access my site\", or is confused about Netlify Identity vs Secure Access vs team login vs OAuth providers. Routes the request to the right layer — app-level Identity, site-visitor Password Protection, the Auth0 extension, or Team\u002FOrg SAML SSO — and explains the two-layer (perimeter + in-app identity) pattern and its double-login tradeoff. For building the app-level auth itself, use the netlify-identity skill.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4053,4056,4057,4060],{"name":4054,"slug":4055,"type":15},"Access Control","access-control",{"name":9,"slug":8,"type":15},{"name":4058,"slug":4059,"type":15},"Permissions","permissions",{"name":4061,"slug":4062,"type":15},"Security","security","2026-07-14T05:40:29.082149",{"slug":4065,"name":4065,"fn":4066,"description":4067,"org":4068,"tags":4069,"stars":23,"repoUrl":24,"updatedAt":4080},"netlify-agent-runner","run AI agent tasks on Netlify","Run AI agent tasks remotely on Netlify using Claude, Codex, or Gemini. Use when the user wants to run an AI agent on their site, get a second opinion from another model, or delegate development tasks to run remotely against their repo.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4070,4073,4076,4079],{"name":4071,"slug":4072,"type":15},"Agents","agents",{"name":4074,"slug":4075,"type":15},"Automation","automation",{"name":4077,"slug":4078,"type":15},"LLM","llm",{"name":9,"slug":8,"type":15},"2026-07-17T05:30:19.462913",{"slug":4082,"name":4082,"fn":4083,"description":4084,"org":4085,"tags":4086,"stars":23,"repoUrl":24,"updatedAt":4093},"netlify-ai-gateway","route AI requests via Netlify AI Gateway","Reference for Netlify AI Gateway — the managed proxy that routes calls to OpenAI, Anthropic, and Google Gemini SDKs without provider API keys. Use this skill any time the user wants to add AI on a Netlify site (chat, completion, reasoning, image generation, image-to-image edit\u002Fstylize), choose or change a model, wire up the OpenAI \u002F Anthropic \u002F @google\u002Fgenai SDK, decide which provider to use for an image-gen feature (it's Gemini-only on the gateway), or debug \"model not found\" \u002F \"API key missing\" against the gateway. Required reading before pinning a model — the gateway exposes a curated subset, not every provider model.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4087,4090,4091,4092],{"name":4088,"slug":4089,"type":15},"AI Infrastructure","ai-infrastructure",{"name":18,"slug":19,"type":15},{"name":4077,"slug":4078,"type":15},{"name":9,"slug":8,"type":15},"2026-07-17T05:30:13.14555",{"slug":4095,"name":4095,"fn":4096,"description":4097,"org":4098,"tags":4099,"stars":23,"repoUrl":24,"updatedAt":4108},"netlify-blobs","manage file storage with Netlify Blobs","Guide for using Netlify Blobs for file and asset storage — images, documents, uploads, exports, cached binary artifacts. Covers getStore(), CRUD operations, metadata, listing, deploy-scoped vs site-scoped stores, and local development. Do NOT use Blobs as a dynamic data store — use Netlify Database for that.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4100,4101,4104,4105],{"name":13,"slug":14,"type":15},{"name":4102,"slug":4103,"type":15},"File Storage","file-storage",{"name":9,"slug":8,"type":15},{"name":4106,"slug":4107,"type":15},"Storage","storage","2026-07-17T05:30:16.503306",{"slug":4110,"name":4110,"fn":4111,"description":4112,"org":4113,"tags":4114,"stars":23,"repoUrl":24,"updatedAt":4125},"netlify-caching","configure CDN caching on Netlify","Guide for controlling caching on Netlify's CDN. Use when configuring cache headers, setting up stale-while-revalidate, implementing on-demand cache purge, or understanding Netlify's CDN caching behavior. Covers Cache-Control, Netlify-CDN-Cache-Control, cache tags, durable cache, and framework-specific caching patterns.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4115,4118,4121,4122],{"name":4116,"slug":4117,"type":15},"Caching","caching",{"name":4119,"slug":4120,"type":15},"Deployment","deployment",{"name":9,"slug":8,"type":15},{"name":4123,"slug":4124,"type":15},"Performance","performance","2026-07-14T05:40:20.066717",{"slug":4127,"name":4127,"fn":4128,"description":4129,"org":4130,"tags":4131,"stars":23,"repoUrl":24,"updatedAt":4137},"netlify-config","configure Netlify site settings","Reference for netlify.toml configuration and site environment variables. Use when configuring build settings, redirects, rewrites, headers, deploy contexts, the `[dev]` block that controls `netlify dev` (command, port, targetPort, framework), or any site-level configuration — and when managing environment variables or secrets with the Netlify CLI, including scoping values to specific deploy contexts. Covers the complete netlify.toml syntax including redirects with splats\u002Fconditions, headers, deploy contexts, functions config, edge functions config, and the `[dev]` block (including when `framework` must be `\"#custom\"` — required when both a custom `command` and `targetPort` are set).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4132,4135,4136],{"name":4133,"slug":4134,"type":15},"Configuration","configuration",{"name":4119,"slug":4120,"type":15},{"name":9,"slug":8,"type":15},"2026-07-17T05:30:21.284801",{"slug":4139,"name":4139,"fn":4140,"description":4141,"org":4142,"tags":4143,"stars":23,"repoUrl":24,"updatedAt":4152},"netlify-database","provision and manage Netlify Database","Guide for using Netlify Database — the GA managed Postgres product built into Netlify. Use when a project needs any kind of dynamic, structured, or relational data. Covers provisioning via @netlify\u002Fdatabase, Drizzle ORM (@beta) setup, migrations, preview branching, and safe production data handling. Blobs is only for file\u002Fasset storage — any dynamic data belongs in the database.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4144,4145,4148,4149],{"name":13,"slug":14,"type":15},{"name":4146,"slug":4147,"type":15},"Database","database",{"name":9,"slug":8,"type":15},{"name":4150,"slug":4151,"type":15},"PostgreSQL","postgresql","2026-07-20T05:58:58.934045",{"items":4154,"total":4273},[4155,4170,4182,4189,4196,4203,4210,4217,4223,4230,4243,4258],{"slug":4156,"name":4156,"fn":4157,"description":4158,"org":4159,"tags":4160,"stars":4167,"repoUrl":4168,"updatedAt":4169},"configure-axis","configure AXIS agent evaluation scenarios","Author AXIS (Agent Experience Index Score) scenarios and axis.config.json for a project. Use when the user asks to set up AXIS, add a scenario, write or edit axis.config.json, or evaluate an AI agent with AXIS.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4161,4162,4163,4166],{"name":4071,"slug":4072,"type":15},{"name":4133,"slug":4134,"type":15},{"name":4164,"slug":4165,"type":15},"Evals","evals",{"name":9,"slug":8,"type":15},32,"https:\u002F\u002Fgithub.com\u002Fnetlify\u002Faxis","2026-07-20T05:59:47.468757",{"slug":4171,"name":4171,"fn":4172,"description":4173,"org":4174,"tags":4175,"stars":4167,"repoUrl":4168,"updatedAt":4181},"using-axis","run and interpret AXIS reports","Run AXIS, read its reports, navigate its project layout, and interpret scores. Use when the user asks to run AXIS, invoke the CLI, compare runs, explain a score, find a regression, manage baselines, or understand where AXIS writes its files.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4176,4179,4180],{"name":4177,"slug":4178,"type":15},"CLI","cli",{"name":4164,"slug":4165,"type":15},{"name":9,"slug":8,"type":15},"2026-07-14T05:40:13.443461",{"slug":4048,"name":4048,"fn":4049,"description":4050,"org":4183,"tags":4184,"stars":23,"repoUrl":24,"updatedAt":4063},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4185,4186,4187,4188],{"name":4054,"slug":4055,"type":15},{"name":9,"slug":8,"type":15},{"name":4058,"slug":4059,"type":15},{"name":4061,"slug":4062,"type":15},{"slug":4065,"name":4065,"fn":4066,"description":4067,"org":4190,"tags":4191,"stars":23,"repoUrl":24,"updatedAt":4080},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4192,4193,4194,4195],{"name":4071,"slug":4072,"type":15},{"name":4074,"slug":4075,"type":15},{"name":4077,"slug":4078,"type":15},{"name":9,"slug":8,"type":15},{"slug":4082,"name":4082,"fn":4083,"description":4084,"org":4197,"tags":4198,"stars":23,"repoUrl":24,"updatedAt":4093},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4199,4200,4201,4202],{"name":4088,"slug":4089,"type":15},{"name":18,"slug":19,"type":15},{"name":4077,"slug":4078,"type":15},{"name":9,"slug":8,"type":15},{"slug":4095,"name":4095,"fn":4096,"description":4097,"org":4204,"tags":4205,"stars":23,"repoUrl":24,"updatedAt":4108},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4206,4207,4208,4209],{"name":13,"slug":14,"type":15},{"name":4102,"slug":4103,"type":15},{"name":9,"slug":8,"type":15},{"name":4106,"slug":4107,"type":15},{"slug":4110,"name":4110,"fn":4111,"description":4112,"org":4211,"tags":4212,"stars":23,"repoUrl":24,"updatedAt":4125},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4213,4214,4215,4216],{"name":4116,"slug":4117,"type":15},{"name":4119,"slug":4120,"type":15},{"name":9,"slug":8,"type":15},{"name":4123,"slug":4124,"type":15},{"slug":4127,"name":4127,"fn":4128,"description":4129,"org":4218,"tags":4219,"stars":23,"repoUrl":24,"updatedAt":4137},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4220,4221,4222],{"name":4133,"slug":4134,"type":15},{"name":4119,"slug":4120,"type":15},{"name":9,"slug":8,"type":15},{"slug":4139,"name":4139,"fn":4140,"description":4141,"org":4224,"tags":4225,"stars":23,"repoUrl":24,"updatedAt":4152},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4226,4227,4228,4229],{"name":13,"slug":14,"type":15},{"name":4146,"slug":4147,"type":15},{"name":9,"slug":8,"type":15},{"name":4150,"slug":4151,"type":15},{"slug":4231,"name":4231,"fn":4232,"description":4233,"org":4234,"tags":4235,"stars":23,"repoUrl":24,"updatedAt":4242},"netlify-deploy","deploy and host projects on Netlify","Deploy, host, and publish web projects on Netlify with the Netlify CLI. Use when the user wants to deploy a site or repository to Netlify, link a local project to a Netlify site, ship a production or preview\u002Fdraft deploy, set up Git-based continuous deployment, run a manual or local deploy, configure CI deploys, or troubleshoot a failed or misconfigured deploy. Also use to view or tail a deployed site's runtime logs — function and edge-function output, deploy logs — via `netlify logs` when debugging what a live site is doing (recent errors, recent activity, streaming output).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4236,4237,4238,4239],{"name":4177,"slug":4178,"type":15},{"name":4119,"slug":4120,"type":15},{"name":9,"slug":8,"type":15},{"name":4240,"slug":4241,"type":15},"Web Development","web-development","2026-07-17T05:30:14.218977",{"slug":4244,"name":4244,"fn":4245,"description":4246,"org":4247,"tags":4248,"stars":23,"repoUrl":24,"updatedAt":4257},"netlify-edge-functions","write Netlify Edge Functions","Guide for writing Netlify Edge Functions. Use when building middleware, geolocation-based logic, request\u002Fresponse manipulation, authentication checks, A\u002FB testing, or any low-latency edge compute. Covers Deno runtime, context.next() middleware pattern, geolocation, and when to choose edge vs serverless.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4249,4252,4255,4256],{"name":4250,"slug":4251,"type":15},"Edge Functions","edge-functions",{"name":4253,"slug":4254,"type":15},"Middleware","middleware",{"name":9,"slug":8,"type":15},{"name":4123,"slug":4124,"type":15},"2026-07-14T05:40:34.147865",{"slug":4259,"name":4259,"fn":4260,"description":4261,"org":4262,"tags":4263,"stars":23,"repoUrl":24,"updatedAt":4272},"netlify-forms","handle HTML forms with Netlify","Guide for using Netlify Forms for HTML form handling. Use when adding contact forms, feedback forms, file upload forms, or any form that should be collected by Netlify. Covers the data-netlify attribute, spam filtering, AJAX submissions, file uploads, notifications, and the submissions API.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[4264,4267,4270,4271],{"name":4265,"slug":4266,"type":15},"Forms","forms",{"name":4268,"slug":4269,"type":15},"HTML","html",{"name":9,"slug":8,"type":15},{"name":4240,"slug":4241,"type":15},"2026-07-14T05:40:16.075367",17]