mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(core): Add logs and error catches for possible failures in queue mode (#3032)
This commit is contained in:
@@ -119,9 +119,14 @@ export class Worker extends Command {
|
|||||||
|
|
||||||
async runJob(job: Bull.Job, nodeTypes: INodeTypes): Promise<IBullJobResponse> {
|
async runJob(job: Bull.Job, nodeTypes: INodeTypes): Promise<IBullJobResponse> {
|
||||||
const jobData = job.data as IBullJobData;
|
const jobData = job.data as IBullJobData;
|
||||||
const executionDb = (await Db.collections.Execution!.findOne(
|
const executionDb = await Db.collections.Execution!.findOne(jobData.executionId);
|
||||||
jobData.executionId,
|
|
||||||
)) as IExecutionFlattedDb;
|
if (!executionDb) {
|
||||||
|
LoggerProxy.error('Worker failed to find execution data in database. Cannot continue.', {
|
||||||
|
executionId: jobData.executionId,
|
||||||
|
});
|
||||||
|
throw new Error('Unable to find execution data in database. Aborting execution.');
|
||||||
|
}
|
||||||
const currentExecutionDb = ResponseHelper.unflattenExecutionData(executionDb);
|
const currentExecutionDb = ResponseHelper.unflattenExecutionData(executionDb);
|
||||||
LoggerProxy.info(
|
LoggerProxy.info(
|
||||||
`Start job: ${job.id} (Workflow ID: ${currentExecutionDb.workflowData.id} | Execution: ${jobData.executionId})`,
|
`Start job: ${job.id} (Workflow ID: ${currentExecutionDb.workflowData.id} | Execution: ${jobData.executionId})`,
|
||||||
@@ -139,6 +144,13 @@ export class Worker extends Command {
|
|||||||
findOptions,
|
findOptions,
|
||||||
);
|
);
|
||||||
if (workflowData === undefined) {
|
if (workflowData === undefined) {
|
||||||
|
LoggerProxy.error(
|
||||||
|
'Worker execution failed because workflow could not be found in database.',
|
||||||
|
{
|
||||||
|
workflowId: currentExecutionDb.workflowData.id,
|
||||||
|
executionId: jobData.executionId,
|
||||||
|
},
|
||||||
|
);
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`The workflow with the ID "${currentExecutionDb.workflowData.id}" could not be found`,
|
`The workflow with the ID "${currentExecutionDb.workflowData.id}" could not be found`,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user