Skip to content

add debug logs for workerd#9640

Merged
CarmenPopoviciu merged 4 commits intomainfrom
emily/workerd-config
Jun 20, 2025
Merged

add debug logs for workerd#9640
CarmenPopoviciu merged 4 commits intomainfrom
emily/workerd-config

Conversation

@emily-shen
Copy link
Contributor

@emily-shen emily-shen commented Jun 17, 2025

Might be useful again, just dumps the workerd config into a file for debugging. Does overwrite the file each time we restart workerd, so when the worker or wrangler config changes, but i think that's probably fine.

@danlapid does this help? any requests while i'm here?


  • Tests
    • TODO (before merge)
    • Tests included
    • Tests not necessary because:
  • Wrangler / Vite E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required
    • Not required because: trivial miniflare change change
  • Public documentation
    • TODO (before merge)
    • Cloudflare docs PR(s):
    • Documentation not necessary because: updated miniflare readme but mostly for internal usage
  • Wrangler V3 Backport
    • TODO (before merge)
    • Wrangler PR:
    • Not necessary because: not wrangler

@emily-shen emily-shen requested a review from a team as a code owner June 17, 2025 21:13
@changeset-bot
Copy link

changeset-bot bot commented Jun 17, 2025

🦋 Changeset detected

Latest commit: 2f00b48

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

This PR includes changesets to release 5 packages
Name Type
miniflare Minor
@cloudflare/pages-shared Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch
wrangler Patch

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 Jun 17, 2025

create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

wrangler

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

commit: 2f00b48

Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

Nice idea. Looks good. I made a suggestion.
Also won't we need to add this to the turbo.json?

Comment on lines +51 to +54
if (process.env.MINIFLARE_WORKERD_CONFIG_DEBUG === "true") {
writeFileSync("workerd-config.json", JSON.stringify(config, null, 2));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can I propose that instead of a boolean you can provide a path to the output file. E.g.

Suggested change
if (process.env.MINIFLARE_WORKERD_CONFIG_DEBUG === "true") {
writeFileSync("workerd-config.json", JSON.stringify(config, null, 2));
}
if (process.env.MINIFLARE_WORKERD_CONFIG_DEBUG_PATH) {
writeFileSync(process.env.MINIFLARE_WORKERD_CONFIG_DEBUG_PATH, JSON.stringify(config, null, 2));
}

@github-project-automation github-project-automation bot moved this from Untriaged to In Review in workers-sdk Jun 18, 2025
@emily-shen emily-shen force-pushed the emily/workerd-config branch from ab6a02b to c1ba681 Compare June 20, 2025 08:44
@emily-shen emily-shen force-pushed the emily/workerd-config branch from c1ba681 to d4fbdf8 Compare June 20, 2025 08:53
export function serializeConfig(config: Config): Buffer {
const debugPath = process.env.MINIFLARE_WORKERD_CONFIG_DEBUG;
if (debugPath) {
writeFileSync(debugPath, JSON.stringify(config, null, 2));
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to be clear, if the file path is relative then it will be local to the current working directory.
Is that OK?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

would you expect it to be relative to the wrangler config?

as its just for debugging, and i'm not sure we have the wrangler config path here in miniflare, i'm inclined to just let it be 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah its fine. just wanted to make sure this was expected

@github-project-automation github-project-automation bot moved this from In Review to Approved in workers-sdk Jun 20, 2025
@emily-shen emily-shen enabled auto-merge June 20, 2025 13:45
@CarmenPopoviciu CarmenPopoviciu disabled auto-merge June 20, 2025 15:28
@CarmenPopoviciu CarmenPopoviciu merged commit bfb791e into main Jun 20, 2025
25 checks passed
@CarmenPopoviciu CarmenPopoviciu deleted the emily/workerd-config branch June 20, 2025 15:28
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Jun 20, 2025
jseba added a commit to jseba/workers-sdk that referenced this pull request Jun 20, 2025
…seba/containers_scope_debug

* 'main' of ssh://github.com/cloudflare/workers-sdk:
  Version Packages (cloudflare#9697)
  add remote bindings support to `getPlatformProxy` (cloudflare#9688)
  feat(containers): add support for handling images that link to the CF registry (cloudflare#9596)
  CC-5418: Set instance_type in wrangler (cloudflare#9633)
  remove warnings during config validations on `experimental_remote` fields (cloudflare#9678)
  add debug logs for workerd (cloudflare#9640)
  `wrangler containers apply` uses `observability` configuration (cloudflare#9558)
  Version Packages (cloudflare#9658)
  Temporarily skip Openapi C3 e2e tests (cloudflare#9691)
  Skip authed fixture on forks (cloudflare#9681)
jseba added a commit to jseba/workers-sdk that referenced this pull request Jun 21, 2025
…seba/containers_scope

* 'main' of ssh://github.com/cloudflare/workers-sdk:
  Add CLAUDE.md for Claude Code guidance (cloudflare#9563)
  Version Packages (cloudflare#9697)
  add remote bindings support to `getPlatformProxy` (cloudflare#9688)
  feat(containers): add support for handling images that link to the CF registry (cloudflare#9596)
  CC-5418: Set instance_type in wrangler (cloudflare#9633)
  remove warnings during config validations on `experimental_remote` fields (cloudflare#9678)
  add debug logs for workerd (cloudflare#9640)
  `wrangler containers apply` uses `observability` configuration (cloudflare#9558)
  Version Packages (cloudflare#9658)
  Temporarily skip Openapi C3 e2e tests (cloudflare#9691)
  Skip authed fixture on forks (cloudflare#9681)
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

Successfully merging this pull request may close these issues.

3 participants