Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 1000 Bytes

middleware-not-aresponse.mdx

File metadata and controls

30 lines (21 loc) · 1000 Bytes
title The middleware returned something that is not a Response object.
i18nReady true
githubURL https://github.com/withastro/astro/blob/main/packages/runtime/src/internal/core/errors/errors-data.ts

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

MiddlewareNotAResponse: Any data returned from middleware must be a valid Response object.

What went wrong?

Thrown in development mode when middleware returns something that is not a Response object.

For example:

import {defineMiddleware} from "astro:middleware";
export const onRequest = defineMiddleware(() => {
  return "string"
});