refactor(core): Consolidate binary file not found errors (no-changelog) (#7585)

Logging was originally to see if there was a binary data file failing to
be written for [this
user](https://linear.app/n8n/issue/PAY-844/filesystem-binary-data-mode-causing-alerts-in-cloud)
but the cause was not a file failed to be written but a missing `fileId`
in a binary data item in an execution. The error should no longer be
thrown as of 1.12. See story for more info.

This PR is for cleanup and to consolidate any file not found errors in
the context of binary data, to track if this happens again.
This commit is contained in:
Iván Ovejero
2023-11-03 11:41:15 +01:00
committed by GitHub
parent e6d3d1a4c2
commit 6d42fad31a
6 changed files with 39 additions and 45 deletions

View File

@@ -1,14 +1,13 @@
import { readFile, stat } from 'node:fs/promises';
import prettyBytes from 'pretty-bytes';
import Container, { Service } from 'typedi';
import { BINARY_ENCODING, LoggerProxy as Logger, IBinaryData } from 'n8n-workflow';
import { BINARY_ENCODING } from 'n8n-workflow';
import { UnknownManagerError, InvalidModeError } from './errors';
import { areConfigModes, toBuffer } from './utils';
import { LogCatch } from '../decorators/LogCatch.decorator';
import type { Readable } from 'stream';
import type { BinaryData } from './types';
import type { INodeExecutionData } from 'n8n-workflow';
import type { INodeExecutionData, IBinaryData } from 'n8n-workflow';
@Service()
export class BinaryDataService {
@@ -40,7 +39,6 @@ export class BinaryDataService {
}
}
@LogCatch((error) => Logger.error('Failed to copy binary data file', { error }))
async copyBinaryFile(
workflowId: string,
executionId: string,
@@ -76,7 +74,6 @@ export class BinaryDataService {
return binaryData;
}
@LogCatch((error) => Logger.error('Failed to write binary data file', { error }))
async store(
workflowId: string,
executionId: string,
@@ -152,9 +149,6 @@ export class BinaryDataService {
if (manager.deleteMany) await manager.deleteMany(ids);
}
@LogCatch((error) =>
Logger.error('Failed to copy all binary data files for execution', { error }),
)
async duplicateBinaryData(
workflowId: string,
executionId: string,