roccomuso / node-webhooks

:arrow_right_hook: Node.js module to create and trigger your own webHooks.
190 stars 47 forks source link

Why it triggers several times, depends upon the number of URL #25

Closed iamrommel closed 4 years ago

iamrommel commented 4 years ago

I was trying to call the webhooks.trigger('ticket_upsert', { data: "1" }) and setup the webhooks like this

const db =  {
        "ticket_upsert" : [
            "https://webhook.site/563f5326-da57-4a1b-ba3b-82686832694f", 
            "https://webhook.site/563f5326-da57-4a1b-ba3b-82686832694f", 
            "https://webhook.site/563f5326-da57-4a1b-ba3b-82686832694f"
        ]
    }

 const webHooks = new nodeWebHooks({ db })

The problem is the webhooks pushes 3times on the same URL, so like the first url "https://webhook.site/563f5326-da57-4a1b-ba3b-82686832694f", was called 3 times. I was triggerring it once. I'm expecting that it will call only once, for each URL

----update

i guess the problem lies on instantiate of new nodeWebHooks({ db }), i did instantiate it on my class constructor, and that class was called 3 times on several places. Disregard this issue, i was able to solve it