Skip to content

Commit

Permalink
fix: Disable errors obfuscation (no-changelog) (n8n-io#10617)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-radency committed Aug 30, 2024
1 parent 1e08f44 commit 9fa1a9a
Show file tree
Hide file tree
Showing 320 changed files with 445 additions and 518 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export async function conversationalAgentExecute(
} catch (error) {
throwIfToolSchema(this, error);

if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message }, pairedItem: { item: itemIndex } });
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export async function openAiFunctionsAgentExecute(

returnData.push({ json: response });
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message }, pairedItem: { item: itemIndex } });
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export async function planAndExecuteAgentExecute(
returnData.push({ json: response });
} catch (error) {
throwIfToolSchema(this, error);
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message }, pairedItem: { item: itemIndex } });
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export async function reActAgentAgentExecute(
returnData.push({ json: response });
} catch (error) {
throwIfToolSchema(this, error);
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message }, pairedItem: { item: itemIndex } });
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export async function sqlAgentAgentExecute(

returnData.push({ json: response });
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message }, pairedItem: { item: i } });
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export async function toolsAgentExecute(this: IExecuteFunctions): Promise<INodeE
),
});
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({
json: { error: error.message },
pairedItem: { item: itemIndex },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ export class OpenAiAssistant implements INodeType {

returnData.push({ json: response });
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message }, pairedItem: { item: itemIndex } });
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ export class ChainLlm implements INodeType {
});
});
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message }, pairedItem: { item: itemIndex } });
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export class ChainRetrievalQa implements INodeType {
const response = await chain.withConfig(getTracingConfig(this)).invoke({ query });
returnData.push({ json: { response } });
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message }, pairedItem: { item: itemIndex } });
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ export class ChainSummarizationV2 implements INodeType {
returnData.push({ json: { response } });
}
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message }, pairedItem: { item: itemIndex } });
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export class InformationExtractor implements INodeType {
const output = await chain.invoke(messages);
resultData.push({ json: { output } });
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
resultData.push({ json: { error: error.message }, pairedItem: { item: itemIndex } });
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export class SentimentAnalysis implements INodeType {
);
}
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
const executionErrorData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray({ error: error.message }),
{ itemData: { item: i } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ ${fallbackPrompt}`,
});
if (fallback === 'other' && output.fallback) returnData[returnData.length - 1].push(item);
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData[0].push({
json: { error: error.message },
pairedItem: { item: itemIdx },
Expand Down
2 changes: 1 addition & 1 deletion packages/@n8n/nodes-langchain/nodes/code/Code.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ export class Code implements INodeType {
try {
items = await sandbox.runCodeAllItems(options);
} catch (error) {
if (!this.continueOnFail(error)) throw error;
if (!this.continueOnFail()) throw error;
items = [{ json: { error: (error as Error).message } }];
if (options.multiOutput) {
items = [items];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export async function router(this: IExecuteFunctions) {

returnData.push(...responseData);
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message }, pairedItem: { item: i } });
continue;
}
Expand Down
9 changes: 2 additions & 7 deletions packages/core/src/NodeExecuteFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ import {
jsonParse,
ApplicationError,
sleep,
OBFUSCATED_ERROR_MESSAGE,
} from 'n8n-workflow';
import type { Token } from 'oauth-1.0a';
import clientOAuth1 from 'oauth-1.0a';
Expand Down Expand Up @@ -3628,12 +3627,8 @@ export function getExecuteFunctions(
itemIndex,
),
getExecuteData: () => executeData,
continueOnFail: (error?: Error) => {
const shouldContinue = continueOnFail(node);
if (error && shouldContinue && !(error instanceof ApplicationError)) {
error.message = OBFUSCATED_ERROR_MESSAGE;
}
return shouldContinue;
continueOnFail: () => {
return continueOnFail(node);
},
evaluateExpression: (expression: string, itemIndex: number) => {
return workflow.expression.resolveSimpleParameterValue(
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/WorkflowExecute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1333,8 +1333,6 @@ export class WorkflowExecute {
} else {
// Report any unhandled and non-wrapped errors to Sentry
toReport = error;
// Set obfuscate to true so that the error would be obfuscated in th UI
error.obfuscate = true;
}
if (toReport) {
ErrorReporterProxy.error(toReport, {
Expand Down
4 changes: 0 additions & 4 deletions packages/editor-ui/src/components/Error/NodeErrorView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,6 @@ function addItemIndexSuffix(message: string): string {
}
function getErrorMessage(): string {
if ('obfuscate' in props.error && props.error.obfuscate === true) {
return i18n.baseText('nodeErrorView.showMessage.obfuscate');
}
let message = '';
const isSubNodeError =
Expand Down
1 change: 0 additions & 1 deletion packages/editor-ui/src/plugins/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,6 @@
"nodeErrorView.itemIndex": "Item Index",
"nodeErrorView.runIndex": "Run Index",
"nodeErrorView.showMessage.title": "Copied to clipboard",
"nodeErrorView.showMessage.obfuscate": "Internal error",
"nodeErrorView.stack": "Stack",
"nodeErrorView.theErrorCauseIsTooLargeToBeDisplayed": "The error cause is too large to be displayed",
"nodeErrorView.time": "Time",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ export class ActionNetwork implements INodeType {
? returnData.push(...(response as IDataObject[]))
: returnData.push(response as IDataObject);
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ error: error.message });
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ export class ActiveCampaign implements INodeType {

returnData.push(...executionData);
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
const executionErrorData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray({ error: error.message }),
{ itemData: { item: i } },
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Affinity/Affinity.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ export class Affinity implements INodeType {

returnData.push(...executionData);
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
const executionErrorData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray({ error: error.message }),
{ itemData: { item: i } },
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/AiTransform/AiTransform.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class AiTransform implements INodeType {
try {
items = (await sandbox.runCodeAllItems()) as INodeExecutionData[];
} catch (error) {
if (!this.continueOnFail(error)) {
if (!this.continueOnFail()) {
set(error, 'node', node);
throw error;
}
Expand Down
10 changes: 5 additions & 5 deletions packages/nodes-base/nodes/Airtable/v1/AirtableV1.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ export class AirtableV1 implements INodeType {
rows.length = 0;
}
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message } });
continue;
}
Expand Down Expand Up @@ -696,7 +696,7 @@ export class AirtableV1 implements INodeType {
rows.length = 0;
}
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message } });
continue;
}
Expand Down Expand Up @@ -757,7 +757,7 @@ export class AirtableV1 implements INodeType {
}),
];
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message } });
} else {
throw error;
Expand Down Expand Up @@ -792,7 +792,7 @@ export class AirtableV1 implements INodeType {

returnData.push(...executionData);
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message } });
continue;
}
Expand Down Expand Up @@ -880,7 +880,7 @@ export class AirtableV1 implements INodeType {
rows.length = 0;
}
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message } });
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export async function execute(
returnData.push(...executionData);
} catch (error) {
error = processAirtableError(error as NodeApiError, undefined, i);
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message } });
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export async function execute(
returnData.push(...executionData);
} catch (error) {
error = processAirtableError(error as NodeApiError, undefined, i);
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { message: error.message, error } });
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export async function execute(
returnData.push(...executionData);
} catch (error) {
error = processAirtableError(error as NodeApiError, id, i);
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message } });
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export async function execute(
returnData.push(...executionData);
} catch (error) {
error = processAirtableError(error as NodeApiError, id, i);
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message } });
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export async function execute(

returnData.push(...executionData);
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { message: error.message, error }, pairedItem: { item: i } });
continue;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export async function execute(
returnData.push(...executionData);
} catch (error) {
error = processAirtableError(error as NodeApiError, recordId, i);
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { message: error.message, error } });
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export async function execute(
returnData.push(...executionData);
} catch (error) {
error = processAirtableError(error as NodeApiError, undefined, i);
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { message: error.message, error } });
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Amqp/Amqp.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export class Amqp implements INodeType {

return [responseData];
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
return [[{ json: { error: error.message }, pairedItems: { item: 0 } }]];
} else {
throw error;
Expand Down
6 changes: 3 additions & 3 deletions packages/nodes-base/nodes/ApiTemplateIo/ApiTemplateIo.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ export class ApiTemplateIo implements INodeType {

returnData.push(responseData as IDataObject);
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message } });
continue;
}
Expand Down Expand Up @@ -471,7 +471,7 @@ export class ApiTemplateIo implements INodeType {
}
returnData.push(responseData as IDataObject);
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message } });
continue;
}
Expand Down Expand Up @@ -561,7 +561,7 @@ export class ApiTemplateIo implements INodeType {
}
returnData.push(responseData as IDataObject);
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message } });
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Asana/Asana.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2467,7 +2467,7 @@ export class Asana implements INodeType {
),
);
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
returnData.push({ error: error.message });
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Autopilot/Autopilot.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ export class Autopilot implements INodeType {
);
returnData.push(...executionData);
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
const exectionErrorWithMetaData = this.helpers.constructExecutionMetaData(
[{ json: { error: error.message } }],
{ itemData: { item: i } },
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Aws/AwsLambda.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export class AwsLambda implements INodeType {
returnData.push(...executionData);
}
} catch (error) {
if (this.continueOnFail(error)) {
if (this.continueOnFail()) {
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray({ error: (error as JsonObject).message }),
{ itemData: { item: i } },
Expand Down
Loading

0 comments on commit 9fa1a9a

Please sign in to comment.