[workers-utils] Report a null observability.logs/traces as a config error - #15039
[workers-utils] Report a null observability.logs/traces as a config error#15039LeSingh1 wants to merge 1 commit into
Conversation
…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 detectedLatest commit: a53197a The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
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 |
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
|
|
||
| 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. |
There was a problem hiding this comment.
🟡 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.
| `{ "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. |
Was this helpful? React with 👍 or 👎 to provide feedback.
@cloudflare/autoconfig
@cloudflare/build-output-utils
@cloudflare/config
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-functions
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
A null nested observability block crashes config validation instead of reporting a config error:
{ "observability": { "enabled": true, "logs": null } }typeof null === "object", so a nulllogs/tracespasses the object type check and the per-property checks then dereference it. A null top-levelobservabilityis 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: nullandtraces: null; both throw theTypeErrorbefore the change.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.