fix(cli): resolve http.server via getServiceAsync in console/runtime-assets plugins#2855
Merged
Merged
Conversation
…assets plugins
The console-static + runtime-assets plugins fetched `http.server` with the
synchronous `ctx.getService('http.server')`. When that service is registered
as an async factory (the console / schema-migration boot path) the sync
accessor throws `Service 'http.server' is async - use await`; sitting outside
any try/catch, the throw escaped the plugin's start() and rolled back kernel
bootstrap, crashing the CONSOLE/migration boot (com.objectstack.runtime-assets
failed to start). The runtime serve path, where http.server is registered
synchronously, was unaffected — which is why only the control-plane migration
boot broke.
Resolve http.server through a shared resolveHttpServer() helper that prefers
getServiceAsync (which resolves a sync- or async-registered service) and falls
back to the sync accessor, mirroring plugin-auth's async cache lookup. The
helper never throws, so these optional static-asset plugins skip cleanly when
no HTTP server is present instead of taking down boot.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsVkwjvWDBRiYb1HNGfcXr
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 14 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
com.objectstack.runtime-assetsandcom.objectstack.console-staticplugins (packages/cli/src/utils/console.ts) fetch thehttp.serverservice with the synchronousctx.getService('http.server').When
http.serveris registered as an async factory — the console / schema-migration boot path —getServicethrowsService 'http.server' is async - use await. Because the call sat outside any try/catch, the throw escaped the plugin'sstart()and rolled back kernel bootstrap:This crashed the cloud control-plane schema-migration boot (the deploy's "Schema migration — production DB" step). The runtime
servepath, whereRuntimeregistershttp.serversynchronously, was unaffected — so only the console/migration boot path broke.Fix
Resolve
http.serverthrough a sharedresolveHttpServer()helper that prefers the async accessor (getServiceAsync, which resolves a sync- or async-registered service) and falls back to the sync accessor — mirroringplugin-auth's asynccachelookup. The helper never throws, so these optional static-asset plugins skip cleanly when no HTTP server is present instead of aborting boot.These two are the only hard-crash consumers of
http.server: every other consumer (serve.tsunknown-hostname-guard,metadata,rest,dispatcher) already wraps the syncgetServicein try/catch and degrades gracefully.Base / scope
Branched from
cb662a5f(the commit cloud currently pins) so the change is exactlycb662a5f+ this fix — minimal drift, keeping the objectos-prod image byte-identical apart from this boot-safety fix.console.tsis byte-identical atcb662a5fandmain, so it applies cleanly tomaintoo.Test plan
.framework-sha→decd1746; cloudbuild-and-testbuilds framework@decd1746 + boot-smoke greenruntime-assetscrash)Generated by Claude Code