webhook icon indicating copy to clipboard operation
webhook copied to clipboard

Error during processing webhook

Open alexwesemann opened this issue 2 years ago • 10 comments

Good afternoon, Currently I am running Webhook version 2.6.9 on a virtualized Ubuntu 11 machine. Maybe this is a really noob question, but I am struggling now for a couple of days and running out of inspiration.

My hooks.json file looks like this: hooks My redeploy.sh script looks like this: image

I constantly get the following error when running the listener: image

Can someone tell me what I am doing wrong? Hope to hear from you guys soon.

alexwesemann avatar May 22 '23 13:05 alexwesemann

This is probably a duplicate of #615. What does you payload look like?

moorereason avatar May 22 '23 16:05 moorereason

Hmm, seems to work with 2.8.0

adnanh avatar May 22 '23 20:05 adnanh

Good morning,

I suppose you mean what's coming in from the KPN IOT platform (I use two destinations: webhook.site for testing and webhook for production which is now work in progress). This is what it looks like in Webhook.site: [image: image.png] [image: image.png] Hope this helps? Let me know if you need more information. KR Alex

Op ma 22 mei 2023 om 18:14 schreef Cameron Moore @.***>:

This is probably a duplicate of #615 https://github.com/adnanh/webhook/issues/615. What does you payload look like?

— Reply to this email directly, view it on GitHub https://github.com/adnanh/webhook/issues/640#issuecomment-1557517184, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARXX43G2SQFSOGN6KYXESGDXHOGFXANCNFSM6AAAAAAYKNSZY4 . You are receiving this because you authored the thread.Message ID: @.***>

alexwesemann avatar May 23 '23 05:05 alexwesemann

Dear Adnan, Is there an easy way to upgrade to 2.8.0? I am currently on 2.9.6 and installed a couple of days ago using sudo apt install in debian11.

If the upgrade solves the problem, then I can move on. Basically, the goal here is to throw every received webhook into the MySQL database and use it in combination with google maps presenting the measured IOT data to the user using the latitude and longitude coordinates.

I have the database in place (working with Webhook.site) and the google maps web application retrieving the data from the database. So, basically the only step I have to take is transfer the webhook data into the MySQL database when the bash script is triggered.

Does that make sense? KR Alex

Op ma 22 mei 2023 om 22:53 schreef Adnan Hajdarević < @.***>:

Hmm, seems to work with 2.8.0

— Reply to this email directly, view it on GitHub https://github.com/adnanh/webhook/issues/640#issuecomment-1557976647, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARXX43BP2ITTWXIY7WIQSFDXHPG6LANCNFSM6AAAAAAYKNSZY4 . You are receiving this because you authored the thread.Message ID: @.***>

alexwesemann avatar May 23 '23 05:05 alexwesemann

As an addition to my last e-mail, this is what is coming with the received webhook: [{"bn":"urn:dev:IMEI:86***********4:","bt":1.684833304E9},{"n":"CPU temperatuur","u":"Cel","v":43.312},{"n":"Processorgebruik","u":"%","v":22.5},{"n":"Breedtegraad","u":"lat","v":51.87695},{"n":"Lengtegraad","u":"lon","v":4.61525}]

Op ma 22 mei 2023 om 18:14 schreef Cameron Moore @.***>:

This is probably a duplicate of #615 https://github.com/adnanh/webhook/issues/615. What does you payload look like?

— Reply to this email directly, view it on GitHub https://github.com/adnanh/webhook/issues/640#issuecomment-1557517184, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARXX43G2SQFSOGN6KYXESGDXHOGFXANCNFSM6AAAAAAYKNSZY4 . You are receiving this because you authored the thread.Message ID: @.***>

alexwesemann avatar May 23 '23 09:05 alexwesemann

Gents,

After a lot of struggling I managed to install and run a 2.8.0 instance of webhook. This seems to solve the issue. I am now receiving this: [image: image.png] But, the milion dollar noob question is: How do I get this data in my database? Can I use the id and run a php script to insert the data into the MySQL database like I do with webhook.site? Or is there a more simpler/common way to do this? Sorry, I need a little bit more information to point me in the right direction, here.

But, I am already happy that I got this far! :) KR Alex

Op ma 22 mei 2023 om 22:53 schreef Adnan Hajdarević < @.***>:

Hmm, seems to work with 2.8.0

— Reply to this email directly, view it on GitHub https://github.com/adnanh/webhook/issues/640#issuecomment-1557976647, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARXX43BP2ITTWXIY7WIQSFDXHPG6LANCNFSM6AAAAAAYKNSZY4 . You are receiving this because you authored the thread.Message ID: @.***>

alexwesemann avatar May 23 '23 10:05 alexwesemann

Morning, any news on this question? KR Alex

Op di 23 mei 2023 om 12:02 schreef Alex Wesemann @.***>:

Gents,

After a lot of struggling I managed to install and run a 2.8.0 instance of webhook. This seems to solve the issue. I am now receiving this: [image: image.png] But, the milion dollar noob question is: How do I get this data in my database? Can I use the id and run a php script to insert the data into the MySQL database like I do with webhook.site? Or is there a more simpler/common way to do this? Sorry, I need a little bit more information to point me in the right direction, here.

But, I am already happy that I got this far! :) KR Alex

Op ma 22 mei 2023 om 22:53 schreef Adnan Hajdarević < @.***>:

Hmm, seems to work with 2.8.0

— Reply to this email directly, view it on GitHub https://github.com/adnanh/webhook/issues/640#issuecomment-1557976647, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARXX43BP2ITTWXIY7WIQSFDXHPG6LANCNFSM6AAAAAAYKNSZY4 . You are receiving this because you authored the thread.Message ID: @.***>

alexwesemann avatar May 25 '23 06:05 alexwesemann

Gents, I cannot find the hook anywhere in any folder. This is what is coming through while running Webhook:

[webhook] 2023/05/25 09:31:50 [df23ab] incoming HTTP POST request from 127.0.0.1:42954 [webhook] 2023/05/25 09:31:50 [df23ab] redeploy-webhook got matched [webhook] 2023/05/25 09:31:50 [df23ab] redeploy-webhook hook triggered successfully [webhook] 2023/05/25 09:31:50 [df23ab] 200 | 0 B | 188.526µs | 127.0.0.1:9000 | POST /hooks/redeploy-webhook [webhook] 2023/05/25 09:31:50 [df23ab] executing /home/debian/hooks/redeploy-webhook/redeploy.sh (/home/debian/hooks/redeploy-webhook/redeploy.sh) with arguments ["/home/debian/hooks/redeploy-webhook/redeploy.sh" "{"Accept":"text/plain, application/json, application/+json, /","Accept-Encoding":"gzip,deflate","Connection":"close","Content-Length":"416","Content-Type":"application/json","Things-Device-Barcode":"NULL","Things-Message-Token":"c3a62f7b43b3cbfef1895088924c87935ccc752693c557e9c656dcc7b6f098b3","Things-Plug-Uuid":"4aff6a7c-8d9b-44a2-b984-700c777be714","User-Agent":"axios/0.24.0"}" "{"root":[{"bn":"urn:dev:IMEI:86*********1814:","bt":1.684999803E9},{"n":"CPU temperatuur","u":"Cel","v":41.16},{"n":"GPRS-signaal","u":"count","v":27.0},{"n":"Hoogte in masl","u":"count","v":1.0},{"n":"Actuele grondsnelheid in km/h","u":"count","v":0.0},{"n":"Aantal gevonden satellieten","u":"count","v":1.0},{"n":"Totale schijfruimte in Gb","u":"count","v":14.0},{"n":"Beschikbare schijfruimte in Gb","u":"count","v":9.0}]}"] and environment [] using /var/www/html/hooks/redeploy-webhook as cwd [webhook] 2023/05/25 09:31:50 [31c5f8] command output: mysql: [Warning] Using a password on the command line interface can be insecure. mysql: [Warning] Using a password on the command line interface can be insecure.

[webhook] 2023/05/25 09:31:50 [31c5f8] finished handling redeploy-webhook [webhook] 2023/05/25 09:31:50 [df23ab] command output: mysql: [Warning] Using a password on the command line interface can be insecure. mysql: [Warning] Using a password on the command line interface can be insecure.

I would expect to find the webhook in the folder /var/www/html/hooks/redeploy-webhook but its empty. Does it have to do with the fact that <[webhook] 2023/05/25 09:31:50 [df23ab] 200 | 0 B | 188.526µs | 127.0.0.1:9000 | POST /hooks/redeploy-webhook?> states 0 B??? Is it all empty?? I am really stuck here.

Anyone? KR Alex

alexwesemann avatar May 25 '23 07:05 alexwesemann

I think you're misunderstanding what webhook does. webhook parses a web request and passes parts of that request to a local script or executable. It's up to the script or executable to do something useful with what's passed to it.

Your config is telling webhook to pass a JSON representation of the entire headers and payload to your script, but your script isn't doing anything with the parameters that are passed to it. It's only appending stuff to a log file.

moorereason avatar May 25 '23 18:05 moorereason

Hi Cameron,Thanks a lot for your explanation. Today, I learned this and changed my script to pass both header and payload data to a python script that extracts the iot information and imports it into the mysql database. There is still a lot of work to do but I think I made some good steps forward today.Appreciate your help and support!Verstuurd vanaf mijn iPhone - Sent from my iPhone,Met vriendelijke groet,Alex WesemannOp 25 mei 2023 om 20:42 heeft Cameron Moore @.***> het volgende geschreven: I think you're misunderstanding what webhook does. webhook parses a web request and passes parts of that request to a local script or executable. It's up to the script or executable to do something useful with what's passed to it. Your config is telling webhook to pass a JSON representation of the entire headers and payload to your script, but your script isn't doing anything with the parameters that are passed to it. It's only appending stuff to a log file.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

alexwesemann avatar May 25 '23 18:05 alexwesemann