Skip to content

Conversation

@emily-shen
Copy link
Contributor

@emily-shen emily-shen commented Nov 20, 2025

Fixes CC-6472

Previously the only image registry allowed was the cloudflare managed one, and the only way to auth with that was to query the containers api for credentials. So we always did that before pulling an image. The vite plugin (for various reasons) couldn't call that api, so registry uris didn't work at all with the vite plugin.

Now we support some external registries, which users could authenticate with directly using docker login, so let's try pulling the image anyway even if calling our API fails. The API might return (short-lived) credentials for external registries if this has been previously configured via wrangler contaienrs registries configure, so it is worth trying to call it still.

The cloudflare-managed registry still wont work with the vite plugin as the only way to get credentials for that is via our API, so this PR also adds a more helpful error message in that case.

Also note that I'm not sure if it is worth adding CI tests for this, since it would involve having to set up a wrangler AWS or dockerhub account to run those tests, and storing secrets for that on this github repo, and introducing a likely spot for flakes.

However, i have tested this manually by:

  1. pointing a wrangler config to an ECR image
  2. logging in using docker login
  3. running wrangler dev and vite dev

  • Tests
    • Tests included
    • Tests not necessary because: see description
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: bugfix
  • Wrangler V3 Backport
    • Wrangler PR:
    • Not necessary because: containers

@changeset-bot
Copy link

changeset-bot bot commented Nov 20, 2025

🦋 Changeset detected

Latest commit: 258e5be

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 20, 2025

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@11360

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@11360

miniflare

npm i https://pkg.pr.new/miniflare@11360

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@11360

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@11360

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@11360

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@11360

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@11360

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@11360

wrangler

npm i https://pkg.pr.new/wrangler@11360

commit: 258e5be

@emily-shen emily-shen marked this pull request as ready for review November 20, 2025 15:10
@emily-shen emily-shen requested review from a team as code owners November 20, 2025 15:10
try {
// this will fail in two cases:
// 1. this is being called from the vite plugin (doesn't have the appropriate auth context)
// 2.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

domain not configured I think?

And if so, are we okay with local dev working for something that won't work in prod?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

2 participants