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

The currently selected adapter @astrojs/cloudflare is not compatible with the image service "Sharp". #191

Closed
1 task
hkbertoson opened this issue Mar 19, 2024 · 17 comments · Fixed by #454
Closed
1 task
Assignees
Labels
- P2: nice to have Not breaking anything but nice to have (priority) pkg: cloudflare

Comments

@hkbertoson
Copy link

Astro Info

Astro                    v4.4.13
Node                     v20.11.0
System                   macOS (arm64)
Package Manager          npm
Output                   server
Adapter                  @astrojs/cloudflare
Integrations             none

Describe the Bug

The currently selected adapter @astrojs/cloudflare is not compatible with the image service "Sharp".

What's the expected result?

I have set my configuration to use 'compile'. Which according to the docs. Uses Astro’s default service (sharp), but only on pre-rendered routes at build time. During SSR for pages rendered on-demand, all astro:assets features are disabled.

Link to Minimal Reproducible Example

https://github.com/hkbertoson/sleepy-spiral

Participation

  • I am willing to submit a pull request for this issue.
@alexanderniebuhr alexanderniebuhr added the - P2: nice to have Not breaking anything but nice to have (priority) label Mar 20, 2024
@alexanderniebuhr
Copy link
Member

It's reproduced and should be fixed. But it is not breaking anything, it's just a warning.

@alexanderniebuhr alexanderniebuhr added this to the Cloudflare v11.1 milestone Jun 22, 2024
@danawoodman
Copy link

danawoodman commented Aug 14, 2024

I'm also getting this error with Astro + CloudFlare adapter and the passthrough image service, assuming this error shouldnt even be possible if im not using sharp?

import cloudflare from "@astrojs/cloudflare";
import tailwind from "@astrojs/tailwind";
import { defineConfig, passthroughImageService } from "astro/config";
import sitemap from "@astrojs/sitemap";

export default defineConfig({
  output: "hybrid",
  integrations: [tailwind(), sitemap()],
  adapter: cloudflare({ imageService: "cloudflare" }),
  image: { service: passthroughImageService() },
});

@hkbertoson
Copy link
Author

The error is always there. It doesn’t break anything.

@alexanderniebuhr
Copy link
Member

Yeah it's a warning, which we would like to hide, but it's a core upstream change, so it might take some time. Still we appreciate all the reports and feedback

@alexanderniebuhr alexanderniebuhr self-assigned this Aug 22, 2024
@florian-lefebvre
Copy link
Member

This should be fixed in 5.0, see https://5-0-0-beta.docs.astro.build/en/guides/upgrade-to/v5/#changed-properties-on-supportedastrofeatures-adapter-api

@nlnw
Copy link

nlnw commented Dec 3, 2024

It is not fixed in 5.0. It's a problem with the cloudflare adapter.

@florian-lefebvre
Copy link
Member

I think that's because the adapter is not using the new shape yet, @alexanderniebuhr may confirm

@alexanderniebuhr
Copy link
Member

Yes we still need to update some things

@millette
Copy link

millette commented Dec 8, 2024

With Astro 5.0.3 and @astrojs/node v9.0.0, there's a similar warning for the node adapter:

[WARN] The currently selected adapter @astrojs/node is not compatible with the image service "Sharp".

@florian-lefebvre
Copy link
Member

Can you update a dedicated issue for it? That would help thank you!

@nlnw
Copy link

nlnw commented Jan 13, 2025

This is not fixed even with the latest release.

@Uninen
Copy link

Uninen commented Jan 13, 2025

Using Astro 5.1.6 and @astrojs/cloudflare 12.2.0 I now get not one but two warnings of this when running the dev server:

22:36:16 [WARN] [config] The adapter @astrojs/cloudflare has limited support for "sharp". Certain features may not work as expected.
22:36:16 [WARN] [adapter] Cloudflare does not support sharp. You can use the `compile` image service to compile images at build time. It will not work for any on-demand rendered images.

(the project has no sharp anywhere)

@alexanderniebuhr
Copy link
Member

@Uninen the warning you get is expected.

@alexanderniebuhr
Copy link
Member

@nlnw can you show the warning you get?

@Uninen
Copy link

Uninen commented Jan 14, 2025

Umm, okay, that's weird. Is there a way to deactivate or filter out these warnings? They are noise in the dev server output.

@ekwoka
Copy link

ekwoka commented Jan 18, 2025

@alexanderniebuhr Why is it expected if the settings are telling it not to use sharp?

@alexanderniebuhr
Copy link
Member

The 'compile' option uses sharp, if switching to a different option which doesn't use sharp, the warning should go away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P2: nice to have Not breaking anything but nice to have (priority) pkg: cloudflare
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants