Verdaccio: Notification for multiple endpoints seem not working for slack channel's webhook

Created on 11 Oct 2017  路  3Comments  路  Source: verdaccio/verdaccio

My reason:

The notification feature is working on single endpoint, but for multiple endpoints it seems not working. Not sure if my configuration is incorrect or slack has weird limitation. Any suggestion ? guys:)

Steps to reproduce:

I tried to configure 2 notification endpoints to 2 of my team's slack channels webhook, e.g.
A and B

Then only the first channel A get notified, then I tried to exchange the 1st configure item with the 2nd one like B and A, then still the new first one B channel get notified.

Check out the config.yaml snippet.

App Version:

My test environment is on latest master branch:

commit c570cf21a37fe7d7e2c7eada3938ff42fc274bb0
Author: Juan Picado @jotadeveloper <[email protected]>
Date:   Sun Oct 8 09:13:54 2017 +0200

Config file:

config.yaml file snippet

notify:
  'slack-general':
    method: POST
    headers: [{'Content-type': 'application/x-www-form-urlencoded'}]
    endpoint: https://hooks.slack.com/services/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
    content: '{ "text": "Package *{{ name }}* published to version *{{ dist-tags.latest }}*", "username": "npm.dianrong.com", "icon_emoji": ":package:" }'
  'slack-npm-dianrong-com':
    method: POST
    headers: [{'Content-type': 'application/x-www-form-urlencoded'}]
    endpoint: https://hooks.slack.com/services/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
    content: '{ "text": "Package *{{ name }}* published to version *{{ dist-tags.latest }}*", "username": "npm.dianrong.com", "icon_emoji": ":package:" }'

No error message from log.

screen shot 2017-10-11 at 3 17 56 pm

outdated

Most helpful comment

It is the problem:

https://github.com/verdaccio/verdaccio/blob/c570cf21a37fe7d7e2c7eada3938ff42fc274bb0/src/lib/notify.js#L72

we have return inside the loop, return stops execution and exits the function. return always exits its function immediately, with no further execution if it's inside a loop.

Sending a PR to correct this.

All 3 comments

It is the problem:

https://github.com/verdaccio/verdaccio/blob/c570cf21a37fe7d7e2c7eada3938ff42fc274bb0/src/lib/notify.js#L72

we have return inside the loop, return stops execution and exits the function. return always exits its function immediately, with no further execution if it's inside a loop.

Sending a PR to correct this.

Cool thanks @ayusharma ! I'll cook a new version after your PR.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bhabgs picture bhabgs  路  4Comments

ianschmitz picture ianschmitz  路  3Comments

lope picture lope  路  3Comments

roddy-toomim-sp picture roddy-toomim-sp  路  4Comments

ceoaliongroo picture ceoaliongroo  路  4Comments