컨텐츠로 이동

Value assigned to locals is not accepted.

LocalsNotAnObject: locals can only be assigned to an object. Other values like numbers, strings, etc. are not accepted.

locals를 객체가 아닌 것으로 덮어쓸 때 개발 모드에서 발생합니다.

예시:

import {defineMiddleware} from "astro:middleware";
export const onRequest = defineMiddleware((context, next) => {
context.locals = 1541;
return next();
});