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

Astro experimental assets does not work with Node.js SSR adapter #7974

Closed
1 task
YonicDev opened this issue Aug 6, 2023 · 6 comments
Closed
1 task

Astro experimental assets does not work with Node.js SSR adapter #7974

YonicDev opened this issue Aug 6, 2023 · 6 comments
Labels
feat: assets Related to the Assets feature (scope) feat: ssr Related to SSR (scope) pkg: node Related to Node adapter (scope)

Comments

@YonicDev
Copy link

YonicDev commented Aug 6, 2023

What version of astro are you using?

2.10.1

Are you using an SSR adapter? If so, which one?

Node

What package manager are you using?

npm

What operating system are you using?

Windows 10, Linux (Debian)

What browser are you using?

Chrome, Firefox

Describe the Bug

While using astro:assets with the Node SSR adapter, optimized images don't work properly on not prerendered pages when running via node ./dist/server/entry.mjs, on both Squoosh and sharp image services. This doesn't seem to be the case when executing npm run preview or npm run dev, however.

When requesting the images directly, the only error printed is a 404 "Not found" error in the client.
Stackblitz seems to deliver corrupt images with "unexpected end of JPEG file", but this may be a different issue altogether, so I'm linking the repository to a minimal code example directly.
CodeSandbox seems to be the only environment where it does seem to work for some reason.

What's the expected result?

The optimized images should be delivered correctly from the server on non-prerendered pages.

Link to Minimal Reproducible Example

https://github.com/YonicDev/astro-bug-assets-node

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 Aug 6, 2023
@deeprobin
Copy link
Contributor

I have this problem too. I solved it locally by upgrading from node 18 to node 20.

@Princesseuh any update on this?

@natemoo-re natemoo-re added feat: assets Related to the Assets feature (scope) - P4: important Violate documented behavior or significantly impacts performance (priority) labels Aug 7, 2023
@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Aug 7, 2023
@Princesseuh Princesseuh added feat: ssr Related to SSR (scope) pkg: node Related to Node adapter (scope) labels Aug 9, 2023
@Princesseuh
Copy link
Member

The repro you shared works for me on both Node 18 and Node 20. Does it still happen for you on the latest versions of Astro?

@Princesseuh Princesseuh added needs response Issue needs response from OP and removed - P4: important Violate documented behavior or significantly impacts performance (priority) labels Aug 29, 2023
@YonicDev
Copy link
Author

YonicDev commented Sep 1, 2023

This still does not work on Astro v3 and @astrojs/node 6. I'm using Node 19.

@doidor
Copy link

doidor commented Sep 21, 2023

This issue is still reproducing in Astro v3.1.1 with Node 18

@matthewp matthewp removed the needs response Issue needs response from OP label Sep 27, 2023
@matthewp
Copy link
Contributor

Works fine for me too. Can someone who's experiencing this issue debug it and see what is going on? Thanks.

Screen Shot 2023-09-27 at 5 36 15 PM

@Princesseuh
Copy link
Member

I believe the only remaining issue related to this is this one: #8735 that is specific to Windows. Otherwise, recent patches should've fixed everything, so I'll close this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: assets Related to the Assets feature (scope) feat: ssr Related to SSR (scope) pkg: node Related to Node adapter (scope)
Projects
None yet
Development

No branches or pull requests

6 participants