Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.0.0-beta.2] Astro.request.headers warning when building app #12069

Closed
1 task
GiyoMoon opened this issue Sep 25, 2024 · 8 comments
Closed
1 task

[5.0.0-beta.2] Astro.request.headers warning when building app #12069

GiyoMoon opened this issue Sep 25, 2024 · 8 comments
Assignees
Labels
5.0 beta Related to the Astro 5.0 beta - P4: important Violate documented behavior or significantly impacts performance (priority)

Comments

@GiyoMoon
Copy link

GiyoMoon commented Sep 25, 2024

Astro Info

Astro                    v5.0.0-beta.2
Node                     v22.8.0
System                   macOS (arm64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             none

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

No response

Describe the Bug

When building the page with pnpm build, every page prints this warning about astro headers:

 generating static routes 
10:22:48 ▶ src/pages/index.astro
10:22:48   └─ /index.html10:22:48 [WARN] `Astro.request.headers` is not available on prerendered pages. If you need access to request headers, make sure that the page is server rendered using `export const prerender = false;` or by setting `output` to `"server"` in your Astro config to make all your pages server rendered.
 (+3ms)
10:22:48 ✓ Completed in 6ms.

The warning doesn't appear when using 5.0.0-beta.1.

What's the expected result?

It shouldn't print this warning as I'm not accessing the headers in my code.

Link to Minimal Reproducible Example

https://github.com/GiyoMoon/astro-header-warning-v5-beta-2

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Sep 25, 2024
@stefanprobst
Copy link

seeing the same warning with v4.15.9 (but not with 4.15.8)

@ematipico
Copy link
Member

@GiyoMoon please provide a valid reproduction, the repository you provided still relies on v4

@ematipico ematipico added the needs repro Issue needs a reproduction label Sep 25, 2024
Copy link
Contributor

Hello @GiyoMoon. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs repro will be closed if they have no activity within 3 days.

@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Sep 25, 2024
@ematipico ematipico self-assigned this Sep 25, 2024
@GiyoMoon
Copy link
Author

@ematipico wait huh? The repo has 5.0.0-beta.2 as it's dependency 🤔
image

@ematipico
Copy link
Member

Weird. Anyway, I could reproduce and I sent a PR to fix the issue :)

@ematipico ematipico added - P4: important Violate documented behavior or significantly impacts performance (priority) 5.0 beta Related to the Astro 5.0 beta and removed needs repro Issue needs a reproduction labels Sep 25, 2024
@GiyoMoon
Copy link
Author

awesome, thanks!

@ematipico
Copy link
Member

Closed by #12070

@stefanprobst
Copy link

seeing the same warning with v4.15.9 (but not with 4.15.8)

this is when the following is set in astro.config.js:

security: {
	checkOrigin: true,
},

should i open a new issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0 beta Related to the Astro 5.0 beta - P4: important Violate documented behavior or significantly impacts performance (priority)
Projects
None yet
Development

No branches or pull requests

3 participants