Error with triggering webhook #6

Closed
opened 2026-03-29 17:49:47 -05:00 by GiteaMirror · 14 comments
Owner

Originally created by @AnandChowdhary on GitHub (Aug 26, 2020).

Since v2, I'm getting an error triggering webhooks. The webhook is a long Caprover URL that looks like this, and is stored as a secret in the GitHub repository:

https://example.environment.domain.com/api/v2/user/apps/webhooks/triggerbuild?namespace=captain&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7InRva2VuVmVyc2lvbiI6ImE1Njk1Mjg1LTEyMzQtNTY3OC04OTA0LTE2YTg3NTNiZGI3YyIsImFwcE5hbWUiOiJhcGkiLCJuYW1lc3BhY2UiOiJjYXB0YWluIn0sImlhdCI6MTU5NDU3ODQ5NH0.9nQzitytlOx5xo8CDgU1-1pa1rIlF8SXToC402V7MlE

This is the error:

Run joelwmale/webhook-action@master
  with:
  env:
    WEBHOOK_URL: ***
    data: Trigger
Sending webhook request to 
(node:2606) UnhandledPromiseRejectionWarning: TypeError: Only absolute URLs are supported
    at getNodeRequestOptions (/home/runner/work/_actions/joelwmale/webhook-action/master/node_modules/node-fetch/lib/index.js:1299:9)
    at /home/runner/work/_actions/joelwmale/webhook-action/master/node_modules/node-fetch/lib/index.js:1404:19
    at new Promise (<anonymous>)
    at fetch (/home/runner/work/_actions/joelwmale/webhook-action/master/node_modules/node-fetch/lib/index.js:1401:9)
    at /home/runner/work/_actions/joelwmale/webhook-action/master/dist/http.js:11:13
    at new Promise (<anonymous>)
    at Http.make (/home/runner/work/_actions/joelwmale/webhook-action/master/dist/http.js:10:16)
    at /home/runner/work/_actions/joelwmale/webhook-action/master/dist/main.js:51:25
    at step (/home/runner/work/_actions/joelwmale/webhook-action/master/dist/main.js:33:23)
    at Object.next (/home/runner/work/_actions/joelwmale/webhook-action/master/dist/main.js:14:53)
(node:2606) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:2606) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

This is the configuration:

# ...
      - name: Trigger webhook
        uses: joelwmale/webhook-action@master
        env:
          WEBHOOK_URL: ${{ secrets.BUILD_WEBHOOK }}
Originally created by @AnandChowdhary on GitHub (Aug 26, 2020). Since v2, I'm getting an error triggering webhooks. The webhook is a long Caprover URL that looks like this, and is stored as a secret in the GitHub repository: https://example.environment.domain.com/api/v2/user/apps/webhooks/triggerbuild?namespace=captain&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7InRva2VuVmVyc2lvbiI6ImE1Njk1Mjg1LTEyMzQtNTY3OC04OTA0LTE2YTg3NTNiZGI3YyIsImFwcE5hbWUiOiJhcGkiLCJuYW1lc3BhY2UiOiJjYXB0YWluIn0sImlhdCI6MTU5NDU3ODQ5NH0.9nQzitytlOx5xo8CDgU1-1pa1rIlF8SXToC402V7MlE This is the error: ``` Run joelwmale/webhook-action@master with: env: WEBHOOK_URL: *** data: Trigger Sending webhook request to (node:2606) UnhandledPromiseRejectionWarning: TypeError: Only absolute URLs are supported at getNodeRequestOptions (/home/runner/work/_actions/joelwmale/webhook-action/master/node_modules/node-fetch/lib/index.js:1299:9) at /home/runner/work/_actions/joelwmale/webhook-action/master/node_modules/node-fetch/lib/index.js:1404:19 at new Promise (<anonymous>) at fetch (/home/runner/work/_actions/joelwmale/webhook-action/master/node_modules/node-fetch/lib/index.js:1401:9) at /home/runner/work/_actions/joelwmale/webhook-action/master/dist/http.js:11:13 at new Promise (<anonymous>) at Http.make (/home/runner/work/_actions/joelwmale/webhook-action/master/dist/http.js:10:16) at /home/runner/work/_actions/joelwmale/webhook-action/master/dist/main.js:51:25 at step (/home/runner/work/_actions/joelwmale/webhook-action/master/dist/main.js:33:23) at Object.next (/home/runner/work/_actions/joelwmale/webhook-action/master/dist/main.js:14:53) (node:2606) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:2606) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. ``` This is the configuration: ```yaml # ... - name: Trigger webhook uses: joelwmale/webhook-action@master env: WEBHOOK_URL: ${{ secrets.BUILD_WEBHOOK }} ```
GiteaMirror added the question label 2026-03-29 17:49:47 -05:00
Author
Owner

@Evanfeenstra commented on GitHub (Aug 26, 2020):

Same here, and my URL is not super long. FYI you can use the previous version by specifying the commit hash uses: joelwmale/webhook-action@749e2dcbc6735ce0c36e1dbbb660618cd7b5f91c

@Evanfeenstra commented on GitHub (Aug 26, 2020): Same here, and my URL is not super long. FYI you can use the previous version by specifying the commit hash `uses: joelwmale/webhook-action@749e2dcbc6735ce0c36e1dbbb660618cd7b5f91c`
Author
Owner

@joelwmale commented on GitHub (Aug 26, 2020):

@AnandChowdhary Using the URL you provided as an example I cannot replicate the error. I do get a failed to reach host as obviously the URL does not point anywhere but that goes past the check to see if the URL is a well-formatted URL or not.

Are you able to find another URL that is failing that you are able to provide?

@joelwmale commented on GitHub (Aug 26, 2020): @AnandChowdhary Using the URL you provided as an example I cannot replicate the error. I do get a failed to reach host as obviously the URL does not point anywhere but that goes past the check to see if the URL is a well-formatted URL or not. Are you able to find another URL that is failing that you are able to provide?
Author
Owner

@ok200paul commented on GitHub (Aug 27, 2020):

Seeing this also. The webhook URL I'm using triggers deployments so I can't share it here, but I can confirm that it (the deployment URL) is still working, is not super-long, and the webhook action is failing. Excellent action btw, thanks so much for putting it together!

@ok200paul commented on GitHub (Aug 27, 2020): Seeing this also. The webhook URL I'm using triggers deployments so I can't share it here, but I can confirm that it (the deployment URL) is still working, is not super-long, and the webhook action is failing. Excellent action btw, thanks so much for putting it together!
Author
Owner
@AnandChowdhary commented on GitHub (Aug 27, 2020): I created a repo so you can reproduce it: https://github.com/AnandChowdhary/joelwmale-webhook-action-17 Failing action: https://github.com/AnandChowdhary/joelwmale-webhook-action-17/runs/1035325989?check_suite_focus=true Workflow: https://github.com/AnandChowdhary/joelwmale-webhook-action-17/blob/master/.github/workflows/test.yml Secrets has `EXAMPLE_URL` set to https://example.com: ![Screen Shot 2020-08-27 at 13 02 52](https://user-images.githubusercontent.com/2841780/91411220-a5d8a100-e865-11ea-9c3f-c33dbf63f1aa.png)
Author
Owner

@joelwmale commented on GitHub (Aug 27, 2020):

@AnandChowdhary is the webhook being hit with the post request at all? Or is it just not making the request?

@joelwmale commented on GitHub (Aug 27, 2020): @AnandChowdhary is the webhook being hit with the post request at all? Or is it just not making the request?
Author
Owner

@AnandChowdhary commented on GitHub (Aug 27, 2020):

I've changed the secret to a RequestBin.com URL so I can see all requests to it (https://en5cm912o0dug.x.pipedream.net/).

Here's the test with the new URL: https://github.com/AnandChowdhary/joelwmale-webhook-action-17/runs/1035357460

No requests have been made.

@AnandChowdhary commented on GitHub (Aug 27, 2020): I've changed the secret to a RequestBin.com URL so I can see all requests to it (https://en5cm912o0dug.x.pipedream.net/). Here's the test with the new URL: https://github.com/AnandChowdhary/joelwmale-webhook-action-17/runs/1035357460 No requests have been made.
Author
Owner

@joelwmale commented on GitHub (Aug 27, 2020):

@AnandChowdhary That's odd because I'm using a requestbin url and I get no errors: https://github.com/joelwmale/test/blob/master/.github/workflows/deploy.yml (where @develop is the current @master)

@joelwmale commented on GitHub (Aug 27, 2020): @AnandChowdhary That's odd because I'm using a requestbin url and I get no errors: https://github.com/joelwmale/test/blob/master/.github/workflows/deploy.yml (where @develop is the current @master)
Author
Owner

@joelwmale commented on GitHub (Aug 27, 2020):

@AnandChowdhary Can you try removing the / at the end?

@joelwmale commented on GitHub (Aug 27, 2020): @AnandChowdhary Can you try removing the `/` at the end?
Author
Owner

@AnandChowdhary commented on GitHub (Aug 27, 2020):

Can you try using a GitHub secret rather than a hard-coded URL? I think that's somehow the problem...

@AnandChowdhary commented on GitHub (Aug 27, 2020): Can you try using a GitHub secret rather than a hard-coded URL? I think that's somehow the problem...
Author
Owner

@AnandChowdhary commented on GitHub (Aug 27, 2020):

Aah, you're using with instead of env. I'm almost certain that's the issue, v2 is no longer checking process.env. for the URL.

@AnandChowdhary commented on GitHub (Aug 27, 2020): Aah, you're using `with` instead of `env`. I'm almost certain that's the issue, v2 is no longer checking `process.env.` for the URL.
Author
Owner

@joelwmale commented on GitHub (Aug 27, 2020):

@AnandChowdhary Ah sorry I did not notice that in your initial comment. Yes, I migrated to with instead of env for this update since it's now using JS/TS and not Bash. Can you try that and let me know?

I will update the code to check for at least the URL existing in a well-formatted format but hopefully, that fixes your issue.

@joelwmale commented on GitHub (Aug 27, 2020): @AnandChowdhary Ah sorry I did not notice that in your initial comment. Yes, I migrated to `with` instead of `env` for this update since it's now using JS/TS and not Bash. Can you try that and let me know? I will update the code to check for at least the URL existing in a well-formatted format but hopefully, that fixes your issue.
Author
Owner

@AnandChowdhary commented on GitHub (Aug 27, 2020):

Yes, it works. I've added a PR to add support for environment variables in v1 back to v2.

@AnandChowdhary commented on GitHub (Aug 27, 2020): Yes, it works. I've added a PR to add support for environment variables in v1 back to v2.
Author
Owner

@joelwmale commented on GitHub (Aug 27, 2020):

@AnandChowdhary Great. Left a small comment on the PR for you.

@Evanfeenstra @ok200paul Can you guys please use with or continue using env after the PR is released? I'm closing this now and will continue discussions on the PR. Thanks for the help @AnandChowdhary!

@joelwmale commented on GitHub (Aug 27, 2020): @AnandChowdhary Great. Left a small comment on the PR for you. @Evanfeenstra @ok200paul Can you guys please use `with` or continue using `env` after the PR is released? I'm closing this now and will continue discussions on the PR. Thanks for the help @AnandChowdhary!
Author
Owner

@joelwmale commented on GitHub (Aug 27, 2020):

@AnandChowdhary @Evanfeenstra @ok200paul When your workflow pulls the latest version (if you have it set to @master) it will work once more. If you are targetting a release @2.0.0, please update this to @2.0.1.

Thanks for the feedback & help guys.

@joelwmale commented on GitHub (Aug 27, 2020): @AnandChowdhary @Evanfeenstra @ok200paul When your workflow pulls the latest version (if you have it set to @master) it will work once more. If you are targetting a release @2.0.0, please update this to @2.0.1. Thanks for the feedback & help guys.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/webhook-action#6