Skip to content

[workers-utils] Report a null observability.logs/traces as a config error - #15039

Open
LeSingh1 wants to merge 1 commit into
cloudflare:mainfrom
LeSingh1:fix/observability-nested-null
Open

[workers-utils] Report a null observability.logs/traces as a config error#15039
LeSingh1 wants to merge 1 commit into
cloudflare:mainfrom
LeSingh1:fix/observability-nested-null

Conversation

@LeSingh1

@LeSingh1 LeSingh1 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

A null nested observability block crashes config validation instead of reporting a config error:

{ "observability": { "enabled": true, "logs": null } }
TypeError: Cannot read properties of null (reading 'enabled')

typeof null === "object", so a null logs/traces passes the object type check and the per-property checks then dereference it. A null top-level observability is already rejected with a normal validation error, so only the nested case is affected.

This rejects null for the nested blocks the same way, so the user gets a diagnostic naming the offending key rather than a stack trace. Tests cover logs: null and traces: null; both throw the TypeError before the change.


  • Tests
    • Tests included/updated
  • Public documentation
    • Documentation not necessary because: it rejects a value that previously crashed validation; no documented config surface changes.

Note

This is a contribution from an AI agent: Claude Code (Claude Opus 4.5), working on behalf of @LeSingh1. Review comments will be read and responded to.

…rror

`{ "observability": { "enabled": true, "logs": null } }` crashed config
validation with `TypeError: Cannot read properties of null (reading
'enabled')`. `typeof null === "object"`, so null passed the type check for
these nested objects and the per-property checks then dereferenced it.

Null is now rejected with a normal validation error, matching how a null
top-level `observability` is already handled.
@changeset-bot

changeset-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a53197a

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

This PR includes changesets to release 6 packages
Name Type
@cloudflare/workers-utils Patch
@cloudflare/autoconfig Patch
@cloudflare/cli-shared-helpers Patch
@cloudflare/deploy-helpers Patch
@cloudflare/remote-bindings Patch
@cloudflare/workers-auth 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

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Aug 5, 2026
@workers-devprod
workers-devprod requested review from a team and petebacondarwin and removed request for a team August 5, 2026 14:39
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/observability-nested-null-validation.md: [@cloudflare/wrangler]
  • packages/workers-utils/src/config/validation.ts: [@cloudflare/wrangler]
  • packages/workers-utils/tests/config/validation/normalize-and-validate-config.test.ts: [@cloudflare/wrangler]

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 1 additional finding in Devin Review.

Open in Devin Review


Report a null `observability.logs`/`observability.traces` as a config error instead of crashing

`{ "observability": { "enabled": true, "logs": null } }` crashed with `TypeError: Cannot read properties of null (reading 'enabled')` instead of producing a validation error. Because `typeof null === "object"`, null passed the type check for these nested objects and then the per-property checks dereferenced it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Release note explains internal code details instead of user impact

The release note text includes an internal implementation explanation (Because "typeof null === \"object\""... at .changeset/observability-nested-null-validation.md:7) instead of only describing what changes for people using the tool, so the published changelog reads like maintainer notes.
Impact: Users reading the changelog see internal reasoning rather than a clear statement of what was fixed.

Repository changeset rule being violated

REVIEW.md states: "Changesets should target users of the tools (e.g. Wrangler users) rather than maintainers. Avoid including implementation details ... Instead, focus on user-facing impact and benefits." The middle paragraph of the changeset explains the JavaScript typeof null quirk and internal per-property dereferencing, which is maintainer-facing detail.

Suggested change
`{ "observability": { "enabled": true, "logs": null } }` crashed with `TypeError: Cannot read properties of null (reading 'enabled')` instead of producing a validation error. Because `typeof null === "object"`, null passed the type check for these nested objects and then the per-property checks dereferenced it.
Setting `observability.logs` or `observability.traces` to `null` in your Wrangler configuration previously crashed with an unhandled error instead of reporting a configuration problem.
Open in Devin Review

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

@pkg-pr-new

pkg-pr-new Bot commented Aug 5, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@15039

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@15039

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@15039

create-cloudflare

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

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@15039

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@15039

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@15039

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: a53197a

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