mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
fix(Mailchimp Trigger Node): Fix webhook recreation (#5328)
This commit is contained in:
parent
78bbe2ba27
commit
8f5f1c3aa5
|
@ -1,6 +1,6 @@
|
||||||
import { validate as jsonSchemaValidate } from 'jsonschema';
|
import { validate as jsonSchemaValidate } from 'jsonschema';
|
||||||
import type { INode, IPinData, JsonObject } from 'n8n-workflow';
|
import type { INode, IPinData, JsonObject } from 'n8n-workflow';
|
||||||
import { jsonParse, LoggerProxy, Workflow } from 'n8n-workflow';
|
import { NodeApiError, jsonParse, LoggerProxy, Workflow } from 'n8n-workflow';
|
||||||
import type { FindOptionsWhere } from 'typeorm';
|
import type { FindOptionsWhere } from 'typeorm';
|
||||||
import { In } from 'typeorm';
|
import { In } from 'typeorm';
|
||||||
import pick from 'lodash.pick';
|
import pick from 'lodash.pick';
|
||||||
|
@ -336,8 +336,12 @@ export class WorkflowsService {
|
||||||
// Also set it in the returned data
|
// Also set it in the returned data
|
||||||
updatedWorkflow.active = false;
|
updatedWorkflow.active = false;
|
||||||
|
|
||||||
|
let message;
|
||||||
|
if (error instanceof NodeApiError) message = error.description;
|
||||||
|
message = message ?? (error as Error).message;
|
||||||
|
|
||||||
// Now return the original error for UI to display
|
// Now return the original error for UI to display
|
||||||
throw new ResponseHelper.BadRequestError((error as Error).message);
|
throw new ResponseHelper.BadRequestError(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,13 +165,8 @@ export class MailchimpTrigger implements INodeType {
|
||||||
// select them easily
|
// select them easily
|
||||||
async getLists(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
async getLists(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
const returnData: INodePropertyOptions[] = [];
|
const returnData: INodePropertyOptions[] = [];
|
||||||
let lists, response;
|
const response = await mailchimpApiRequest.call(this, '/lists', 'GET');
|
||||||
try {
|
const lists = response.lists;
|
||||||
response = await mailchimpApiRequest.call(this, '/lists', 'GET');
|
|
||||||
lists = response.lists;
|
|
||||||
} catch (error) {
|
|
||||||
throw new NodeApiError(this.getNode(), error);
|
|
||||||
}
|
|
||||||
for (const list of lists) {
|
for (const list of lists) {
|
||||||
const listName = list.name;
|
const listName = list.name;
|
||||||
const listId = list.id;
|
const listId = list.id;
|
||||||
|
@ -200,8 +195,11 @@ export class MailchimpTrigger implements INodeType {
|
||||||
try {
|
try {
|
||||||
await mailchimpApiRequest.call(this, endpoint, 'GET');
|
await mailchimpApiRequest.call(this, endpoint, 'GET');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.statusCode === 404) {
|
if (error instanceof NodeApiError && error.cause && 'isAxiosError' in error.cause) {
|
||||||
return false;
|
if (error.cause.statusCode === 404) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
throw new NodeApiError(this.getNode(), error);
|
throw new NodeApiError(this.getNode(), error);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue