Skip to content

fix(dev): Deno 2.8 compat for local function runner (Deno.serve getter)#533

Open
yurynix wants to merge 1 commit into
mainfrom
fix/deno-2.8-serve-getter
Open

fix(dev): Deno 2.8 compat for local function runner (Deno.serve getter)#533
yurynix wants to merge 1 commit into
mainfrom
fix/deno-2.8-serve-getter

Conversation

@yurynix
Copy link
Copy Markdown

@yurynix yurynix commented Jun 2, 2026

Note

Description

Fixes base44 dev failing under Deno 2.8, which redefined Deno.serve as a getter-only property. The previous direct assignment (Deno.serve = ...) now throws at runtime. This PR uses Object.defineProperty to override Deno.serve so the runtime works on both pre-2.8 (writable property) and 2.8+ (accessor) versions of Deno.

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

  • Extracted the Deno.serve patch logic into a patchedServe constant in packages/cli/deno-runtime/main.ts.
  • Replaced the direct Deno.serve = ... assignment (which fails on Deno 2.8) with Object.defineProperty(Deno, "serve", { value: patchedServe, writable: true, configurable: true }).
  • Removed the @ts-expect-error previously needed for the direct assignment.
  • Added a comment explaining the Deno 2.8 getter-only behavior and the compatibility rationale.

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

Behavior on older Deno versions is preserved: defineProperty works on both the previous writable property and the new accessor. No public CLI surface changes.


🤖 Generated by Claude | 2026-06-02 11:43 UTC | ff4dead

Deno 2.8 exposes `Deno.serve` as a getter-only property, so the wrapper's
plain `Deno.serve = ...` assignment throws
`TypeError: Cannot set property serve ... which has only a getter`. The
function process crashes on startup, the dev-server proxy can't reach it,
and requests return 500.

Override it with Object.defineProperty (writable + configurable) instead,
which works on both the old writable property and the new 2.8 accessor.

CI installs Deno via `setup-deno@v2` with `deno-version: v2.x`, which now
floats to 2.8.1 — this is why the local-functions dev tests started
failing on every PR despite no related code change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.0.52-pr.533.ff4dead

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.52-pr.533.ff4dead"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.0.52-pr.533.ff4dead"
  }
}

Preview published to npm registry — try new features instantly!

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.

1 participant