-
Notifications
You must be signed in to change notification settings - Fork 287
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
No image processing occurs after deployment (Cloudflare Pages) #1061
Comments
What's the url of the images in production? Is it something like /_ipx/... ? |
No, the URL is still just The reproduction is right there. Deploy it and see for yourself. |
Indeed. Deployed to Cloudflare: not working, are rather the src was not changed Deployed to Vercel: working Maybe IPX doesn't run on CF runtime? |
We're having the same issue with Deno Deploy and Cloudflare Pages combined with the IPX provider. Works fine with self hosted PM2 & Vercel for example. Have managed to solve this somehow using a different configuration or setting? |
@adamskyle My current alternative until this is fixed is the following Custom Provider for Cloudflare Images: import { encodeQueryItem, joinURL } from "ufo";
import { createOperationsGenerator } from "#image";
import type { ProviderGetImage } from "@nuxt/image";
const operationsGenerator = createOperationsGenerator({
keyMap: {
width: "w",
height: "h"
},
joinWith: ",",
formatter: (key: string, value: string) => {
return encodeQueryItem(key, value);
}
});
export const getImage: ProviderGetImage = (src, options) => {
const base = "https://imagedelivery.net/<YOUR_ACCOUNT_HASH>";
const operations = operationsGenerator(options.modifiers);
return { url: joinURL(base, src, operations) };
}; Replace Managing the images this way is a lot more tedious than just storing them in the repository though. |
I am not using cloudflare, but I had a similar problem with SSR and PM2, where images were not loading. I installed |
Same problem |
same here with netlify ! |
Any updates about this bug? |
Just using the workaround suggested by @AaronBeaudoin at the moment. Would love to contribute but I'm afraid this is a bit ambitious for a first PR here for me. Could be a bug in nuxt-image, but I can't rule out ipx or even nitro. Some insights / attention from the nuxt team would be really great, the reproduction speaks for itself I think. |
Same here. If I have a |
FWIW, I believe this is a Sharp limitation: lovell/sharp#2863 |
Looks like it is indeed sharp (or unjs/ipx which uses sharp) CF Workers and Pages seems to be single threaded. |
I unexpectedly ran into the same issue when I tried to deploy a page on GitHub pages |
@nathanchase What's your workaround like with the |
My workaround at the moment is to not use ipx in production if deployed to Cloudflare Pages, but use some other image provider (like Cloudflare themselves, or weserv, or imagekit, or any others that do the processing elsewhere). |
Doesn't the following comment solve an issue for you? |
I'm also experiencing this issue, I would like to not build an entirely static website and want to benefits of ipx pre-rendered images. I think I found a temporary solution for it. {
image: {
provider: 'ipxStatic',
},
modules: [
"@nuxt/image",
"nitro-cloudflare-dev",
],
nitro: {
preset: "cloudflare-pages",
prerender: {
routes: ['/'],
crawlLinks: true,
},
},
} By defining It would be great that we could have a config that just automatically tags the ipx images as pre-rendered but that's all I found for now. |
has anyone come up with a solution for this? |
Any update? Even Cloudflare workers paid plan doesn't help. |
I'm having the same problem. Already tried all the suggested fixes but nothing worked. |
@cf-wasm/photon might work as replacement for IPX on workers |
Same issue here. Hopefully someone finds a solution. |
I managed to solve the problem by changing the build command from If you are building a static site using nuxt ^3.12.4 My project is a simple blog using @nuxt/content. |
Any news on that issue? I'm using a headless API and serving the content to a nuxt 3 app. Locally I'm using the image provider Deployed to CF Pages I tried
The resulting links always end in 404s. As I understand the docs even this minimal config
should work, as the default provider is `
` As I've read, maybe it will never work on CF (with Ok, then I would like to use https://image.nuxt.com/providers/cloudflare so the CF image provider, as we are already using the Pages Provider there. It says: "To use this provider you just need to specify the base url (zone) of your service"
Has anyone got the Nuxt-Image module working on CF? |
In a recent project, I managed to use R2 Object Storage together with Cloudflare Images. I created a bucket in R2 with the images, in the settings:
// CORS policy
[
{
"AllowedOrigins": [
"http://localhost:3000",
"https://img.example.com"
],
...
}
] In Cloudflare Images, I chose the free plan (1,000 source image requests) and enabled it to be used in the bucket created in R2. I was then able to manipulate the images. Configuration in Nuxt js // nuxt.config.ts
image: {
cloudflare: {
baseURL: 'https://img.example.com',
},
}, <!-- app.vue -->
<NuxtImg
src="/avatar.png" alt="test image" width="400"
provider="cloudflare" format="webp" loading="lazy" :modifiers="{ fit: 'contain' }"
/> Output <img alt="test image" loading="lazy" data-nuxt-img="" src="https://img.example.com/cdn-cgi/image/w=400,f=webp/avatar.png"> |
Thanks for the explanation, in our case the images are uploaded and managed in a third party CMS outside of Cloudflare. I'm getting the absolute urls of the images passed to the nuxt app. I activated the paid plan for testing, got an Here would be the correct part in the docs, as we are just trying to transform images while serving: https://developers.cloudflare.com/images/transform-images/transform-via-url/ Which is understandable per se - but I found no documentation of how to use the transformation service from CF in the nuxt-config for the image module. Because the Nuxt-Image Module would be the one, who would concatenate the correct urls with its parameters. If I'm following the CF docs I would then create my own nuxt-image service, which is not the intention of using the nuxt-image module... |
I was dealing with this issue for days. Finally got it working by setting:
|
Thats the solution, finally thanks !!! |
Info
Darwin
v18.18.2
3.8.0
3.9.1
2.7.0
[email protected]
-
modules
,nitro
,experimental
@nuxt/[email protected]
-
Reproduction
https://github.com/AaronBeaudoin/nuxt-image-issue-1
Description of Issue
In the reproduction above there is a minimal
app.vue
like this:As you can see, the quality is set to 1. This is so that you can see very obviously that image processing is occurring. If you run
npm run dev
you'll see that the image looks like crap, so you know that IPX is working great.But now, deploy the reproduction to Cloudflare Pages. After doing so, go to the deployed URL and you'll see this:
Obviously image processing is not working.
The text was updated successfully, but these errors were encountered: