fix rebuild for serverless
This commit is contained in:
parent
76fbc07343
commit
8f439f8ab7
2
package-lock.json
generated
2
package-lock.json
generated
@ -4004,7 +4004,7 @@
|
|||||||
},
|
},
|
||||||
"packages/library": {
|
"packages/library": {
|
||||||
"name": "mcp-ui-kit",
|
"name": "mcp-ui-kit",
|
||||||
"version": "1.0.0",
|
"version": "1.0.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mcp-ui/server": "^5.15.0",
|
"@mcp-ui/server": "^5.15.0",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mcp-ui-kit",
|
"name": "mcp-ui-kit",
|
||||||
"version": "1.0.0",
|
"version": "1.0.2",
|
||||||
"description": "MCP UI Kit - Create rich UI components for MCP servers",
|
"description": "MCP UI Kit - Create rich UI components for MCP servers",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist/server/index.cjs",
|
"main": "./dist/server/index.cjs",
|
||||||
|
|||||||
@ -28,14 +28,20 @@ export async function bundleComponent(entryPath: string): Promise<string> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let result: esbuild.BuildResult<{ write: false }>;
|
let result: esbuild.BuildResult<{ write: false }>;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
result = await runBuild(entryPath);
|
result = await runBuild(entryPath);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Handle "The service was stopped" error in serverless environments (Vercel, Lambda, etc.)
|
// Handle esbuild service errors in serverless environments (Vercel, Lambda, etc.)
|
||||||
// This happens when the serverless runtime freezes/stops the esbuild subprocess.
|
// This happens when the serverless runtime freezes/stops the esbuild subprocess.
|
||||||
|
// Error messages vary: "service was stopped", "service is no longer running", etc.
|
||||||
// esbuild automatically restarts its service on the next call, so we just retry.
|
// esbuild automatically restarts its service on the next call, so we just retry.
|
||||||
if (error instanceof Error && error.message.includes('service was stopped')) {
|
const isServiceError = error instanceof Error && (
|
||||||
|
error.message.includes('service was stopped') ||
|
||||||
|
error.message.includes('service is no longer running') ||
|
||||||
|
error.message.includes('The service')
|
||||||
|
);
|
||||||
|
if (isServiceError) {
|
||||||
result = await runBuild(entryPath);
|
result = await runBuild(entryPath);
|
||||||
} else {
|
} else {
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user