Skip to content

fix(logs): normalize Deno Deploy "warn" level to "warning"#549

Merged
ImriKochWix merged 4 commits into
mainfrom
fix/logs-warn-level
Jun 24, 2026
Merged

fix(logs): normalize Deno Deploy "warn" level to "warning"#549
ImriKochWix merged 4 commits into
mainfrom
fix/logs-warn-level

Conversation

@ImriKochWix

@ImriKochWix ImriKochWix commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Note

Description

Backend function log entries can arrive with runtime-specific log levels that don't match the canonical set the CLI expects (info, warning, error, debug). These non-canonical values caused Zod validation to fail when displaying logs. This PR adds a z.preprocess step that normalizes incoming levels — mapping "warn" to "warning" (Deno Deploy, Cloudflare) and empty/missing or "log" values to "info" (Cloudflare) — before schema validation.

Related Issue

None

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Other (please describe):

Changes Made

  • Wrapped the `level` field of `FunctionLogEntrySchema` in a `z.preprocess` that normalizes incoming log levels to canonical values.
  • Mapped `"warn"` → `"warning"` and empty/falsy or `"log"` → `"info"` so logs from Deno Deploy and Cloudflare runtimes validate correctly.
  • Updated the `LogLevelSchema` doc comment to reflect that levels are emitted by all backend function runtimes, not just Deno Deploy.

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All tests pass (`npm test`)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have updated `docs/` (AGENTS.md) if I made architectural changes

Additional Notes

The fix preserves any already-canonical level unchanged, so it is fully backward compatible. No tests were added for the normalization logic.


🤖 Generated by Claude | 2026-06-22 13:45 UTC | 43ef1d0

Deno Deploy returns "warn" in some runtime versions. Normalize it to
"warning" at parse time so the schema doesn't throw on valid log entries.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.0.56-pr.549.43ef1d0

Prefer not to change any import paths? Install using npm alias so your code still imports base44:

npm i "base44@npm:@base44-preview/cli@0.0.56-pr.549.43ef1d0"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.0.56-pr.549.43ef1d0"
  }
}

Preview published to npm registry — try new features instantly!

ImriKochWix and others added 3 commits June 22, 2026 15:13
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lues

console.log() on Cloudflare Workers returns level "" (empty string).
console.warn() returns "warn". Normalize both to the canonical values
("info" and "warning") that Deno Deploy uses per its OpenAPI spec.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ImriKochWix ImriKochWix merged commit eb711f4 into main Jun 24, 2026
13 checks passed
@ImriKochWix ImriKochWix deleted the fix/logs-warn-level branch June 24, 2026 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants