Astro.locals is not serializable
LocalsNotSerializable:在路径 ”
HREF” 下存储的Astro.locals中的信息不可序列化。请确保只存储可序列化的数据。(E03034)
哪里发生了错误?
段落标题 哪里发生了错误?在开发模式下,当用户尝试将不可序列化的内容存储在 locals 中时,会抛出该错误。
例如:
import { defineMiddleware } from "astro/middleware";
export const onRequest = defineMiddleware((context, next) => { context.locals = { foo() { alert("Hello world!") } }; return next();});