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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 BUG: Image resizing is not supported by wrangler2 dev #534

Closed
ptim opened this issue Mar 2, 2022 · 11 comments
Closed

馃悰 BUG: Image resizing is not supported by wrangler2 dev #534

ptim opened this issue Mar 2, 2022 · 11 comments
Assignees

Comments

@ptim
Copy link

ptim commented Mar 2, 2022

What version of Wrangler are you using?

0.0.17

What operating system are you using?

Mac

Describe the Bug

Any requests for a resized image passes through to the source image (returns "content-type: image/whatever").

This is easily seen when requesting format='json'...

Is this due to wrangler2 using miniflare under the hood? I'm accustomed to this behaviour in local dev with miniflare, and have a "canary fetch" to a known-good image early in my debug handler to remind me of this situation...

I'm expecting that when I run wrangler2 dev, live image resizing will occur, as it does with wrangler1 dev

(BTW, my wrangler.toml for the env under test points to an enterprise enabled domain with image-resizing activated)

I couldn't find any mention of "image" in the project, 2.0 milestone, or issues - hth!

Regards, ptim

@ptim ptim added the bug label Mar 2, 2022
@petebacondarwin
Copy link
Contributor

Is this using "sites" functionality? If so, I believe the problem is that in Wrangler2, for dev we intercept requests for assets and serve them locally rather than asking the Edge for them. This is an optimization to save having to upload all assets every time the code changes and we update the Worker.

@threepointone
Copy link
Contributor

@petebacondarwin We still use the edge for Sites, uploads and all, so I don't think that's the issue here.
@ptim we don't use miniflare by default, unless you've triggered local mode via --local or the L hotkey (in which case, I don't think we honour the resizing options, but I could be wrong).
This issue may need some investigation. Could you make a sample reproduction repo to help? Thank you!

@ptim
Copy link
Author

ptim commented Mar 2, 2022

Here we go: https://github.com/ptim/wrangler2-repro-534

...unless you've triggered local mode via --local or the L hotkey (in which case, I don't think we honour the resizing options, but I could be wrong).

Nope, confident I haven't done either 馃憤

BTW - unrelated feedback:

  • although wrangler.toml has workers_dev = false, hitting B opened up https://wrangler2-repro-534.my-org-com.workers.dev/ - not sure if that's expected - I don't really use that functionality
  • in my work repo, the keys no longer work (eg have to ctrl+c to quit wrangler2). Seemed to work fine in this toy repo, though. Using iterm2 on mac 11.6.2

HTH!

@ptim
Copy link
Author

ptim commented Mar 2, 2022

BTW, as a related FR, I'd love to receive warning (maybe a response header?) if image resizing is not enabled - this had me super confused for a while :)

#barrier-to-entry

@threepointone
Copy link
Contributor

although wrangler.toml has workers_dev = false, hitting B opened up https://wrangler2-repro-534.my-org-com.workers.dev/ - not sure if that's expected - I don't really use that functionality

We haven't fleshed out proper support for zoned workers just yet, that should be incoming soon. Thanks for the report!

We should just fix the image resizing thing. Sorry about that, we'll do it soon.

@threepointone
Copy link
Contributor

The latest beta has better support for zoned workers, feel free to give that a spin and let us know if it worked? We'll have a look at the image cache issue in a bit.

@petebacondarwin petebacondarwin added this to the 2.0 milestone Mar 17, 2022
@petebacondarwin petebacondarwin self-assigned this Mar 24, 2022
@petebacondarwin
Copy link
Contributor

@ptim - I just upgraded my account to do image resizing and ran your reproduction (https://workers.bacondarwin.com/wrangler2-repro-534?url=https%3A%2F%2Fi.imgur.com%2FtuJY33L.png).
I could not get it to fail in wrangler dev. I see the same result for the URL above and for http://localhost:8787/?url=https://i.imgur.com/tuJY33L.png in wrangler dev.

Can you please check with the latest alpha?

@petebacondarwin
Copy link
Contributor

BTW, as a related FR, I'd love to receive warning (maybe a response header?) if image resizing is not enabled - this had me super confused for a while :)

#barrier-to-entry

By the way, I took at look at the headers returned from a request that was resized and I see these items that do not appear if the resizing did not happen:

"cf-bgj": "imgq:0,h2pri",
"cf-cache-status": "HIT",
"cf-resized": "internal=ok/m q=0 n=58 c=10 v=2022.3.3 l=104",

In the case where the resizing did not happen we only get:

"cf-cache-status": "MISS",

So I think you could use that as a marker for whether image resizing is turned on.

@threepointone
Copy link
Contributor

This was probably fixed in #544, since wrangler dev now uses domain entitlements correctly.

@ptim
Copy link
Author

ptim commented Mar 28, 2022

Can you please check with the latest alpha?

Thanks - this is working for me now!

@ptim ptim closed this as completed Mar 28, 2022
@petebacondarwin
Copy link
Contributor

Great! Glad you are unblocked. Thanks @threepointone for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants