Additional fix to AWS SNS Trigger

This commit is contained in:
Jan Oberhauser 2020-10-15 23:23:54 +02:00
parent ecb77926a4
commit b40dec3e4a

View file

@ -110,11 +110,18 @@ export class AwsSnsTrigger implements INodeType {
'Version=2010-03-31', 'Version=2010-03-31',
]; ];
const data = await awsApiRequestSOAP.call(this, 'sns', 'GET', '/?Action=ListSubscriptionsByTopic&' + params.join('&')); const data = await awsApiRequestSOAP.call(this, 'sns', 'GET', '/?Action=ListSubscriptionsByTopic&' + params.join('&'));
let subscriptions = get(data, 'ListSubscriptionsByTopicResponse.ListSubscriptionsByTopicResult.Subscriptions.member'); const subscriptions = get(data, 'ListSubscriptionsByTopicResponse.ListSubscriptionsByTopicResult.Subscriptions');
if (!Array.isArray(subscriptions)) { if (!subscriptions || !subscriptions.member) {
subscriptions = [subscriptions]; return false;
} }
for (const subscription of subscriptions) {
let subscriptionMembers = subscriptions.member;
if (!Array.isArray(subscriptionMembers)) {
subscriptionMembers = [subscriptionMembers];
}
for (const subscription of subscriptionMembers) {
if (webhookData.webhookId === subscription.SubscriptionArn) { if (webhookData.webhookId === subscription.SubscriptionArn) {
return true; return true;
} }