跳转到内容

The middleware didn't return a Response.

MiddlewareNoDataOrNextCalled: 确保你的中间件直接返回 Response 对象,或者通过调用 next函数返回 Response

当中间件没有返回任何数据或者没有调用 next 函数时,抛出此错误。

例如:

import { defineMiddleware } from "astro:middleware";
export const onRequest = defineMiddleware((context, _) => {
// 没有返回任何数据或者调用 `next`
context.locals.someData = false;
});
Contribute

What’s on your mind?

Create GitHub Issue

Quickest way to alert our team of a problem.

Community