Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 1.06 KB

File metadata and controls

31 lines (22 loc) · 1.06 KB
title The middleware didn't return a Response.
i18nReady true
githubURL https://github.com/withastro/astro/blob/main/packages/astro/src/core/errors/errors-data.ts

import DontEditWarning from '~/components/DontEditWarning.astro'

MiddlewareNoDataOrNextCalled: Make sure your middleware returns a Response object, either directly or by returning the Response from calling the next function.

What went wrong?

Thrown when the middleware does not return any data or call the next function.

For example:

import {defineMiddleware} from "astro:middleware";
export const onRequest = defineMiddleware((context, _) => {
	// doesn't return anything or call `next`
	context.locals.someData = false;
});