Cloudflare Page Functions and Image Resizing Not Working


I’m having a lot of trouble getting Cloudflare’s Image Resizing feature to work inside a Cloudflare Page function. I have a barebones Astro project with a functions folder that has one hello.js file in it. That file has the following code:

export function onRequest() {
  return fetch(
      cf: {
        image: {
          format: "avif",
          width: 200,

I’m trying to use Cloudflare’s image resizing within workers as described in the docs. I’ve added a custom domain to this pages project and have enabled image resizing for this zone. Yet, when I visit the /hello path in my browser the image that comes back is unoptimized and it appears that the cf object is being ignored. The response also doesn’t contain the Cf-Resized header described here.

Does image resizing not work within a page function? What have I misunderstood?

Thank you for your help!

1 Like

I encountered the same issue

This topic was automatically closed after 15 days. New replies are no longer allowed.