Skip to content

Conversation

@penalosa
Copy link
Contributor

@penalosa penalosa commented Jan 21, 2026

Make experimental_readRawConfig and unstable_getMiniflareWorkerOptions async in preparation for future async config operations.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: Internal refactor, experimental/unstable APIs only

@penalosa penalosa requested review from a team as code owners January 21, 2026 14:48
@penalosa penalosa requested review from a team as code owners January 21, 2026 14:48
@changeset-bot
Copy link

changeset-bot bot commented Jan 21, 2026

🦋 Changeset detected

Latest commit: 1ead9db

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

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional flags.

Open in Devin Review

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 21, 2026

create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: 1ead9db

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Jan 21, 2026
"@cloudflare/vitest-pool-workers": minor
---

Make `experimental_readRawConfig` and `unstable_getMiniflareWorkerOptions` async
Copy link
Contributor

Choose a reason for hiding this comment

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

While not technically a breaking change (because "experimental"), this will break people - i.e. Open Next.

Could me make it clearer in the changeset ?

Also unstable_readConfig should be mentioned there I think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does open next have a sufficently locked down Wrangler version, or will this cause issues for users?

Copy link
Contributor

Choose a reason for hiding this comment

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

it will cause issues, we use caret version everywhere

@github-project-automation github-project-automation bot moved this from Approved to In Review in workers-sdk Jan 21, 2026
@penalosa penalosa requested a review from vicb January 21, 2026 16:21
@penalosa penalosa force-pushed the penalosa/async-read-config branch from 8f1d3a1 to 96e97af Compare January 22, 2026 13:38
@penalosa penalosa added the blocked Blocked on other work label Jan 22, 2026
@penalosa
Copy link
Contributor Author

Blocking this until open next releases

@penalosa penalosa force-pushed the penalosa/async-read-config branch from fbd8007 to 3136a1d Compare January 22, 2026 23:18
Update all callers across wrangler, vitest-pool-workers, and vite-plugin-cloudflare
to await the now-async config reading functions.

This change prepares for future async config operations.
@penalosa penalosa force-pushed the penalosa/async-read-config branch from 3136a1d to 1ead9db Compare January 23, 2026 13:58
@penalosa penalosa marked this pull request as draft January 23, 2026 14:01
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 2 new potential issues.

View issues and 6 additional flags in Devin Review.

Open in Devin Review


try {
const { rawConfig, configPath } = experimental_readRawConfig(args);
const { rawConfig, configPath } = await experimental_readRawConfig(args);
Copy link
Contributor

Choose a reason for hiding this comment

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

🟡 Awaiting synchronous experimental_readRawConfig instead of async version

The code is awaiting experimental_readRawConfig which is synchronous and returns a plain object, not a Promise.

Click to expand

The middleware function at packages/wrangler/src/index.ts:1781 uses:

const { rawConfig, configPath } = await experimental_readRawConfig(args);

However, experimental_readRawConfig is defined as a synchronous function in packages/workers-utils/src/config/index.ts:137-154 that returns ReadRawConfigResult directly, not a Promise<ReadRawConfigResult>.

The async version is experimental_readRawConfigAsync (defined at packages/workers-utils/src/config/index.ts:164-169).

Impact: This will work at runtime because awaiting a non-Promise value just returns that value, but it's semantically incorrect and violates the intended API design. The code should either use experimental_readRawConfigAsync (and await it) or remove the await keyword.

Expected behavior: Use await experimental_readRawConfigAsync(args) to properly call the async version, which will support future code-based config files.

Recommendation: Change to await experimental_readRawConfigAsync(args) to use the proper async API

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

const config =
def.behaviour?.provideConfig ?? true
? readConfig(args, {
? await readConfig(args, {
Copy link
Contributor

Choose a reason for hiding this comment

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

🟡 Awaiting synchronous readConfig function

The code is awaiting readConfig which is synchronous and returns Config, not Promise<Config>.

Click to expand

In packages/wrangler/src/core/register-yargs-command.ts:171, the code uses:

const config =
  def.behaviour?.provideConfig ?? true
    ? await readConfig(args, {
        hideWarnings: !(def.behaviour?.printConfigWarnings ?? true),
        useRedirectIfAvailable:
          def.behaviour?.useConfigRedirectIfAvailable,
      })
    : defaultWranglerConfig;

However, readConfig is defined as a synchronous function in packages/wrangler/src/config/index.ts:105-111:

export function readConfig(
  args: ReadConfigCommandArgs,
  options: ReadConfigOptions = {}
): Config {
  const raw = experimental_readRawConfig(args, options);
  return convertRawConfigToConfig(args, options, raw);
}

The async version is readConfigAsync (defined at packages/wrangler/src/config/index.ts:121-127).

Impact: This will work at runtime because awaiting a non-Promise value returns that value immediately, but it's semantically incorrect and defeats the purpose of the refactor to make config reading async.

Expected behavior: Use await readConfigAsync(args, {...}) to properly call the async version.

Recommendation: Change to await readConfigAsync(args, {...}) to use the proper async API

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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

Labels

blocked Blocked on other work

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

3 participants