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

AstroV5 building on static as 'hybrid', gives unnecessary warning #12292

Closed
1 task
pijusz opened this issue Oct 23, 2024 · 7 comments
Closed
1 task

AstroV5 building on static as 'hybrid', gives unnecessary warning #12292

pijusz opened this issue Oct 23, 2024 · 7 comments
Assignees
Labels
5.0 beta Related to the Astro 5.0 beta - P4: important Violate documented behavior or significantly impacts performance (priority)

Comments

@pijusz
Copy link

pijusz commented Oct 23, 2024

Astro Info

Tried migrating Astro to v5, but I started getting heavy warnings when building the project.

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

No response

Describe the Bug

When building gives warning on each static route.

What's the expected result?

Warning should not appear

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-lbe5ot?file=astro.config.mjs

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 Oct 23, 2024
@ematipico
Copy link
Member

@pijusz I don't see any warning in your reproduction. Can you please update it and tell us how to reproduce the warnings?

@ematipico ematipico added needs response Issue needs response from OP needs repro Issue needs a reproduction labels Oct 23, 2024
Copy link
Contributor

Hello @pijusz. 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 Oct 23, 2024
@pijusz
Copy link
Author

pijusz commented Oct 23, 2024

You have to run build, it's written just after each file path build

@pijusz I don't see any warning in your reproduction. Can you please update it and tell us how to reproduce the warnings?

@robertsosinski
Copy link

I'm also seeing this on Astro 5 when i set build to "server" and have the following in my index.astro template:

export const prerender = true
export function getStaticPaths() {
  return [
    { params: { group: 'apple', action: 'one' } },
    { params: { group: 'apple', action: 'two' } },
    { params: { group: 'apple', action: 'three' } },
    { params: { group: 'banana', action: 'one' } },
    { params: { group: 'banana', action: 'two' } },
    { params: { group: 'banana', action: 'three' } },
  ]
}

when i run astro build i get the following errors:

 prerendering static routes 
17:42:14 ▶ src/pages/app/[group]/[action]/index.astro
17:42:14   ├─ /app/apple/one/index.html17:42:14 [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.
 (+4ms)
17:42:14   ├─ /app/apple/two/index.html17:42:14 [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.
 (+1ms)
17:42:14   ├─ /app/apple/three/index.html17:42:14 [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.
 (+1ms)
17:42:14   ├─ /app/banana/one/index.html17:42:14 [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.
 (+1ms)
17:42:14   ├─ /app/banana/two/index.html17:42:14 [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.
 (+1ms)
17:42:14   └─ /app/banana/three/index.html17:42:14 [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.
 (+1ms)
17:42:14 ✓ Completed in 25ms.

I am not using Astro.request.headers in my code at all.

Hope this helps. Thanks!

@JojokCreator
Copy link

I'm also getting this with a deployed site on cloudflare running ssg using cloudflare adapter and output:"static".

@ematipico ematipico added 5.0 beta Related to the Astro 5.0 beta - P4: important Violate documented behavior or significantly impacts performance (priority) and removed needs response Issue needs response from OP needs repro Issue needs a reproduction labels Oct 25, 2024
@ematipico ematipico self-assigned this Oct 25, 2024
@hkbertoson
Copy link

I'm also getting this with a deployed site on cloudflare running ssg using cloudflare adapter and output:"static".

Im also getting this and not using the Beta.

@ematipico
Copy link
Member

Fixed by #12302

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

5 participants