Skip to content

fix: worker errors on start (local development) #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"@types/body-parser": "^1.19.5",
"@types/csurf": "^1.11.5",
"@types/jsonwebtoken": "^9.0.7",
"@types/node": "22.7.9",
"@types/react": "^18.0.5",
"@types/react-dom": "^18.0.1",
"@types/uuid": "^8.3.4",
Expand Down Expand Up @@ -90,7 +89,7 @@
"@types/cookie-parser": "^1.4.7",
"@types/express": "^4.17.13",
"@types/loglevel": "^1.6.3",
"@types/node": "22.7.9",
"@types/node": "^22.7.9",
"@types/node-cron": "^3.0.11",
"@types/prismjs": "^1.26.0",
"@types/react-highlight": "^0.12.5",
Expand All @@ -103,7 +102,7 @@
"concurrently": "^7.0.0",
"cross-env": "^7.0.3",
"nodemon": "^2.0.15",
"ts-node": "^10.4.0",
"ts-node": "^10.9.2",
"vite": "^5.4.10"
}
}
8 changes: 5 additions & 3 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import { record, workflow, storage, auth, integration, proxy } from './routes';
import { BrowserPool } from "./browser-management/classes/BrowserPool";
import logger from './logger';
import { connectDB, syncDB } from './storage/db'
import bodyParser from 'body-parser';
import cookieParser from 'cookie-parser';
import csrf from 'csurf';
import { SERVER_PORT } from "./constants/config";
import { Server } from "socket.io";
import { readdirSync } from "fs"
Expand Down Expand Up @@ -68,7 +66,11 @@ const workerPath = path.resolve(__dirname, isProduction ? './worker.js' : './wor
let workerProcess: any;
if (!isProduction) {
workerProcess = fork(workerPath, [], {
execArgv: ['--inspect=5859'],
execArgv: [
'--inspect=5859',
'--loader=ts-node/esm',
'--no-warnings=ExperimentalWarning'
],
});
workerProcess.on('message', (message: any) => {
console.log(`Message from worker: ${message}`);
Expand Down
5 changes: 0 additions & 5 deletions server/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ import { handleRunRecording } from "./workflow-management/scheduler";
import Robot from './models/Robot';
import { computeNextRun } from './utils/schedule';

console.log('Environment variables:', {
REDIS_HOST: process.env.REDIS_HOST,
REDIS_PORT: process.env.REDIS_PORT,
});

const connection = new IORedis({
host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT ? parseInt(process.env.REDIS_PORT, 10) : 6379,
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"module": "CommonJS",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
Expand Down