diff --git a/.changeset/lemon-buckets-know.md b/.changeset/lemon-buckets-know.md new file mode 100644 index 000000000000..8ab72f884b24 --- /dev/null +++ b/.changeset/lemon-buckets-know.md @@ -0,0 +1,5 @@ +--- +"wrangler": patch +--- + +Fix observability.logs.enabled validation diff --git a/packages/wrangler/src/__tests__/configuration.test.ts b/packages/wrangler/src/__tests__/configuration.test.ts index 35ece1dcf03a..0a56c2f9fda0 100644 --- a/packages/wrangler/src/__tests__/configuration.test.ts +++ b/packages/wrangler/src/__tests__/configuration.test.ts @@ -5537,6 +5537,29 @@ describe("normalizeAndValidateConfig()", () => { expect(diagnostics.hasErrors()).toBe(false); }); + + it("should not error on mixed observability config", () => { + const { diagnostics } = normalizeAndValidateConfig( + { + observability: { + enabled: true, + logs: { + invocation_logs: false, + }, + }, + } as unknown as RawConfig, + undefined, + { env: undefined } + ); + + expect(diagnostics.hasWarnings()).toBe(false); + expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(` + "Processing wrangler configuration: + " + `); + + expect(diagnostics.hasErrors()).toBe(false); + }); it("should error on a sampling rate out of range", () => { const { diagnostics } = normalizeAndValidateConfig( { diff --git a/packages/wrangler/src/config/validation.ts b/packages/wrangler/src/config/validation.ts index 9bda9ae9fdae..1315019110df 100644 --- a/packages/wrangler/src/config/validation.ts +++ b/packages/wrangler/src/config/validation.ts @@ -3384,7 +3384,7 @@ const validateObservability: ValidatorFn = (diagnostics, field, value) => { */ if (typeof val.logs === "object") { isValid = - validateRequiredProperty( + validateOptionalProperty( diagnostics, field, "logs.enabled",