Skip to content

Commit 34d4827

Browse files
Claudehotlong
andauthored
fix: rename config import to stackConfig to avoid shadowing Vercel function config
The imported 'config' from objectstack.config.ts was being shadowed by the exported 'config' object (Vercel function configuration) at the end of the file. This caused stackConfig.plugins to be undefined, preventing any plugins from being registered during kernel bootstrap. Fixes the "CRITICAL: Required service missing: data" error on Vercel deployment. Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/e4cad7a6-741c-4f4d-9ab8-c69516fa044e Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent d062a77 commit 34d4827

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

apps/server/server/index.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { ObjectKernel } from '@objectstack/runtime';
1111
import { createHonoApp } from '@objectstack/hono';
1212
import { getRequestListener } from '@hono/node-server';
1313
import type { Hono } from 'hono';
14-
import config from '../objectstack.config';
14+
import stackConfig from '../objectstack.config';
1515

1616
// ---------------------------------------------------------------------------
1717
// Singleton state — persists across warm Vercel invocations
@@ -33,23 +33,16 @@ async function ensureKernel(): Promise<ObjectKernel> {
3333

3434
_bootPromise = (async () => {
3535
console.log('[Vercel] Booting ObjectStack Kernel...');
36-
console.log('[Vercel] Config type:', typeof config);
37-
console.log('[Vercel] Config keys:', Object.keys(config || {}).join(', '));
38-
console.log('[Vercel] Config.plugins type:', typeof config?.plugins);
39-
console.log('[Vercel] Config.plugins length:', Array.isArray(config?.plugins) ? config.plugins.length : 'not an array');
4036

4137
try {
4238
const kernel = new ObjectKernel();
4339

4440
// Register all plugins from shared config
45-
const plugins = config.plugins || config.default?.plugins;
46-
if (!plugins || !Array.isArray(plugins) || plugins.length === 0) {
47-
throw new Error(`[Vercel] No plugins found in config. Config structure may be incorrect.`);
41+
if (!stackConfig.plugins || stackConfig.plugins.length === 0) {
42+
throw new Error(`[Vercel] No plugins found in stackConfig`);
4843
}
4944

50-
console.log(`[Vercel] Registering ${plugins.length} plugins...`);
51-
for (const plugin of plugins) {
52-
console.log(`[Vercel] Registering plugin: ${plugin?.name || 'unknown'}`);
45+
for (const plugin of stackConfig.plugins) {
5346
await kernel.use(plugin as any);
5447
}
5548

0 commit comments

Comments
 (0)