mirror of
https://github.com/n8n-io/n8n.git
synced 2024-08-17 00:50:42 +03:00
fix(core): Throw on adding execution without execution data (#9903)
This commit is contained in:
parent
f229577209
commit
abb74587db
@ -43,6 +43,8 @@ import { ExecutionDataRepository } from './executionData.repository';
|
|||||||
import { Logger } from '@/Logger';
|
import { Logger } from '@/Logger';
|
||||||
import type { ExecutionSummaries } from '@/executions/execution.types';
|
import type { ExecutionSummaries } from '@/executions/execution.types';
|
||||||
import { PostgresLiveRowsRetrievalError } from '@/errors/postgres-live-rows-retrieval.error';
|
import { PostgresLiveRowsRetrievalError } from '@/errors/postgres-live-rows-retrieval.error';
|
||||||
|
import { separate } from '@/utils';
|
||||||
|
import { ErrorReporterProxy as ErrorReporter } from 'n8n-workflow';
|
||||||
|
|
||||||
export interface IGetExecutionsQueryFilter {
|
export interface IGetExecutionsQueryFilter {
|
||||||
id?: FindOperator<string> | string;
|
id?: FindOperator<string> | string;
|
||||||
@ -156,7 +158,9 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
|
|||||||
const executions = await this.find(queryParams);
|
const executions = await this.find(queryParams);
|
||||||
|
|
||||||
if (options?.includeData && options?.unflattenData) {
|
if (options?.includeData && options?.unflattenData) {
|
||||||
return executions.map((execution) => {
|
const [valid, invalid] = separate(executions, (e) => e.executionData !== null);
|
||||||
|
this.reportInvalidExecutions(invalid);
|
||||||
|
return valid.map((execution) => {
|
||||||
const { executionData, metadata, ...rest } = execution;
|
const { executionData, metadata, ...rest } = execution;
|
||||||
return {
|
return {
|
||||||
...rest,
|
...rest,
|
||||||
@ -166,7 +170,9 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
|
|||||||
} as IExecutionResponse;
|
} as IExecutionResponse;
|
||||||
});
|
});
|
||||||
} else if (options?.includeData) {
|
} else if (options?.includeData) {
|
||||||
return executions.map((execution) => {
|
const [valid, invalid] = separate(executions, (e) => e.executionData !== null);
|
||||||
|
this.reportInvalidExecutions(invalid);
|
||||||
|
return valid.map((execution) => {
|
||||||
const { executionData, metadata, ...rest } = execution;
|
const { executionData, metadata, ...rest } = execution;
|
||||||
return {
|
return {
|
||||||
...rest,
|
...rest,
|
||||||
@ -183,6 +189,16 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reportInvalidExecutions(executions: ExecutionEntity[]) {
|
||||||
|
if (executions.length === 0) return;
|
||||||
|
|
||||||
|
ErrorReporter.error(
|
||||||
|
new ApplicationError('Found executions without executionData', {
|
||||||
|
extra: { executionIds: executions.map(({ id }) => id) },
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
async findSingleExecution(
|
async findSingleExecution(
|
||||||
id: string,
|
id: string,
|
||||||
options?: {
|
options?: {
|
||||||
|
Loading…
Reference in New Issue
Block a user