#Locals in edge middleware

2 messages · Page 1 of 1 (latest)

bright craterBOT
#

Hi @crystal jacinth. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Short answer: no.

When Astro middleware runs at the edge (e.g., Vercel/Netlify with edgeMiddleware enabled), the context.locals object is serialized to JSON and forwarded to the serverless renderer for on‑demand pages. Because it must be JSON-serializable, unserializable values (e.g., functions, complex class instances) are not supported in this scenario (Vercel adapter, Netlify adapter).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: