diff --git a/apps/http-backend/src/routes/userRoutes/executionRoutes.ts b/apps/http-backend/src/routes/userRoutes/executionRoutes.ts index 2cfd7ed..0d8abd4 100644 --- a/apps/http-backend/src/routes/userRoutes/executionRoutes.ts +++ b/apps/http-backend/src/routes/userRoutes/executionRoutes.ts @@ -7,7 +7,7 @@ export const execRouter: Router = Router() execRouter.post('/node', userMiddleware, async(req: AuthRequest, res: Response)=>{ try{ - if(!req.user){ + if(!req.user?.sub){ return res.status(statusCodes.BAD_REQUEST).json({ message: "User is not logged in ", }); @@ -30,15 +30,17 @@ execRouter.post('/node', userMiddleware, async(req: AuthRequest, res: Response) const type = nodeData.AvailableNode.type const config = dataSafe.data.Config ? dataSafe.data.Config : nodeData.config // for test api data prefered fist then config in db console.log(`config and type: ${JSON.stringify(config)} & ${type}`) + // if(nodeData.CredentialsID) const context = { - userId: req.user.sub || "", - config: config + userId: req.user.sub, + config: config , + // credentialsId: nodeData.CredentialsID || "" } const executionResult = await ExecutionRegister.execute(type, context) console.log(`Execution result: ${executionResult}`) - if(executionResult) + if(executionResult.success) return res.status(statusCodes.ACCEPTED).json({ message: `${nodeData.name} node execution done` , data: executionResult diff --git a/apps/worker/src/engine/executor.ts b/apps/worker/src/engine/executor.ts index 767c9f9..3b06575 100644 --- a/apps/worker/src/engine/executor.ts +++ b/apps/worker/src/engine/executor.ts @@ -47,6 +47,7 @@ export async function executeWorkflow( nodeId: node.id, workflowExecId: workflowExecutionId, status: "Start", + inputData: currentInputData ? currentInputData : {}, startedAt: new Date() } }) diff --git a/packages/nodes/src/registry/execution.registory.ts b/packages/nodes/src/registry/execution.registory.ts index 74e17a9..c63464e 100644 --- a/packages/nodes/src/registry/execution.registory.ts +++ b/packages/nodes/src/registry/execution.registory.ts @@ -27,7 +27,7 @@ class ExecutionRegistry { } catch (error: any) { return { success: false, - error: error, + error: error instanceof Error ? error.message : String(error), }; } } @@ -38,8 +38,8 @@ class ExecutionRegistry { //wehen visits this next time make sure chang gmail executor implements NodeExecutor - this.register("gmail", new GmailExecutor() as unknown as NodeExecutor); - this.register("google_sheet", new GoogleSheetsNodeExecutor() as unknown as NodeExecutor) + this.register("gmail", new GmailExecutor() as NodeExecutor); + this.register("google_sheet", new GoogleSheetsNodeExecutor() as NodeExecutor) console.log(`The current Executors are ${this.executors.size}`); } }