Astro.locals is not serializable
:::caution[사용되지 않음]이 오류는 이전 버전의 Astro에서 발생한 것으로 더 이상 사용되지 않습니다. 프로젝트를 최신 버전으로 업그레이드할 수 없는 경우 이전 문서의 관리되지 않는 스냅샷을 참조하여 도움을 받을 수 있습니다.:::
LocalsNotSerializable: The information stored in
Astro.localsfor the path "HREF" is not serializable. Make sure you store only serializable data. (E03034)
무엇이 잘못되었나요?
사용자가 locals에 직렬화할 수 없는 항목을 저장하려고 하면 개발 모드에서 발생합니다.
예시:
import {defineMiddleware} from "astro/middleware";
export const onRequest = defineMiddleware((context, next) => {
context.locals = {
foo() {
alert("Hello world!")
}
};
return next();
});
Error Reference