Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions apps/server/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ObjectKernel } from '@objectstack/runtime';
import { createHonoApp } from '@objectstack/hono';
import { getRequestListener } from '@hono/node-server';
import type { Hono } from 'hono';
import config from '../objectstack.config';
import stackConfig from '../objectstack.config';

// ---------------------------------------------------------------------------
// Singleton state — persists across warm Vercel invocations
Expand All @@ -38,7 +38,11 @@ async function ensureKernel(): Promise<ObjectKernel> {
const kernel = new ObjectKernel();

// Register all plugins from shared config
for (const plugin of config.plugins ?? []) {
if (!stackConfig.plugins || stackConfig.plugins.length === 0) {
throw new Error(`[Vercel] No plugins found in stackConfig`);
}
Comment on lines +41 to +43
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thrown error message is very generic and doesn’t include the actual shape of the imported config, which makes the Vercel failure harder to diagnose. Include details like typeof stackConfig, Object.keys(stackConfig ?? {}), and the detected plugins type/length (and whether default.plugins was present) in the error or preceding logs.

Copilot uses AI. Check for mistakes.

for (const plugin of stackConfig.plugins) {
Comment on lines +41 to +45
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stackConfig.plugins is assumed to be a real array. If the config import ends up being a module namespace object (common with ESM/CJS interop on some bundlers), the plugins may actually live under stackConfig.default.plugins, and the current code will throw even though plugins exist. Consider resolving const plugins = stackConfig.plugins ?? (stackConfig as any).default?.plugins; and validating with Array.isArray(plugins) before iterating.

Suggested change
if (!stackConfig.plugins || stackConfig.plugins.length === 0) {
throw new Error(`[Vercel] No plugins found in stackConfig`);
}
for (const plugin of stackConfig.plugins) {
const plugins = stackConfig.plugins ?? (stackConfig as any).default?.plugins;
if (!Array.isArray(plugins) || plugins.length === 0) {
throw new Error(`[Vercel] No plugins found in stackConfig`);
}
for (const plugin of plugins) {

Copilot uses AI. Check for mistakes.
await kernel.use(plugin as any);
Comment on lines 40 to 46
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description mentions adding config-structure diagnostics, ESM interop fallback, and per-plugin registration logging, but the current diff only renames the import and adds a basic empty-check. Either implement the described diagnostics/fallback/logging here, or update the PR description to match what’s actually being shipped.

Copilot uses AI. Check for mistakes.
}

Expand Down
Loading