Skip to content

Warning messages when reading cookies in middleware functions with hybrid output #11756

@RaphaelBossek

Description

@RaphaelBossek

Astro Info

Astro                    v4.14.2
Node                     v18.17.1
System                   Linux (x64)
Package Manager          pnpm
Output                   hybrid
Adapter                  @astrojs/node
Integrations             set-prerender

If this issue only occurs in one browser, which browser is a problem?

Not a browser problem

Describe the Bug

While reading cookies in middleware function result in following warning:

[WARN] Astro.request.headers is unavailable in "static" output mode, and in prerendered pages within "hybrid" and "server" output modes. If you need access to request headers, make sure that output is configured as either "server" or output: "hybrid" in your config file, and that the page accessing the headers is rendered on-demand.

What's the expected result?

No warning message.

Link to Minimal Reproducible Example

https://stackblitz.com/~/github.com/RaphaelBossek/astro-auth-middleware-test

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P2: has workaroundAn edge case that only affects very specific usage, but has a trivial workaround (priority)feat: middlewareRelated to middleware (scope)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions