Skip to content

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 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();
});
Contribute

What’s on your mind?

Create GitHub Issue

Quickest way to alert our team of a problem.

Community
京ICP备15031610号-99