fix: serve chat-widget.js correctly in production
- Copy product/ into Docker image (was missing from final stage) - Fix static file path: ../../product → ../product (wrong depth from dist/index.js) - Add ANTHROPIC_API_KEY to K8s manifest (chat endpoint was returning 500) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
18
src/index.ts
18
src/index.ts
@@ -38,6 +38,22 @@ import { notifyNewPilotRequest } from './notifications/index.js';
|
||||
import redis from './redis.js';
|
||||
import { handleChat, type ChatMessage } from './chat.js';
|
||||
|
||||
process.on('uncaughtException', (err) => {
|
||||
console.error('FATAL uncaughtException:', err);
|
||||
if (err && typeof err === 'object') {
|
||||
console.error('Stack:', (err as Error).stack);
|
||||
}
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', (reason, promise) => {
|
||||
console.error('FATAL unhandledRejection at:', promise, 'reason:', reason);
|
||||
if (reason && typeof reason === 'object') {
|
||||
console.error('Stack:', (reason as Error).stack);
|
||||
}
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
const app = express();
|
||||
app.use(cookieParser());
|
||||
app.use(cors({
|
||||
@@ -58,7 +74,7 @@ app.use(express.urlencoded({ extended: true }));
|
||||
|
||||
// ── Static files (videos, assets) ──────────────────────────────────────────
|
||||
app.use('/public', express.static('/vaults/public'));
|
||||
app.use(express.static(new URL('../../product', import.meta.url).pathname));
|
||||
app.use(express.static(new URL('../product', import.meta.url).pathname));
|
||||
|
||||
// ── Config ─────────────────────────────────────────────────────────────────
|
||||
const PORT = process.env.PORT ?? 3456;
|
||||
|
||||
Reference in New Issue
Block a user