컨텐츠로 이동

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.

Thrown in development mode when locals is overwritten with something that is not an object

For example:

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