question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Webhook triggered even if conditions evaluation is False

See original GitHub issue

I deployed a listener using ark-core webhook :

{
    "target": "http://144.202.75.170:5001/forger/logSomething", 
    "enabled": true, 
    "event": "transaction.applied", 
    "token": "9a83155f9ea8998f1ab0d0a952f7c213xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 
    "conditions": [
        {
            "key": "amount", 
            "condition": "gte", 
            "value": "2500000000"
        }, 
        {
            "key": "vendorField", 
            "condition": "regexp", 
            "value": "^arky.*$"
        }
    ], 
    "id": "143e37f6-6eca-46ec-8099-ace9b09e7413"
}

The transactions bellow triggerred this webhook (I provide the log from my app to see token authorization match) : https://explorer.ark.io:8443/api/transactions/f1aa4f28eeed5565a450ba83fd511fc0e506472c12f9fa98da9e6209ec165e70

>>> data autorized - 9a83155f9ea8998f1ab0d0a952f7c213
2019-08-18 19:12 +00:00: >>> Data received :
2019-08-18 19:12 +00:00: {
2019-08-18 19:12 +00:00:   "amount": "681877755", 
2019-08-18 19:12 +00:00:   "blockId": "b8bc0d18f2c6b5442976d1921300674bad90939bd7c786791dfd7cd081f0c63e", 
2019-08-18 19:12 +00:00:   "expiration": 0, 
2019-08-18 19:12 +00:00:   "fee": "2011076", 
2019-08-18 19:12 +00:00:   "id": "f1aa4f28eeed5565a450ba83fd511fc0e506472c12f9fa98da9e6209ec165e70", 
2019-08-18 19:12 +00:00:   "network": 23, 
2019-08-18 19:12 +00:00:   "recipientId": "AYaZAUGmfZ3hx8p9LWez5mYjLowBAyXu3x", 
2019-08-18 19:12 +00:00:   "senderPublicKey": "03d77805a7e23f8d413c3fd2202b610341d80443c047826790a4094c76749b5df4", 
2019-08-18 19:12 +00:00:   "sequence": 0, 
2019-08-18 19:12 +00:00:   "signature": "30440220661af7e736165ffc79e576c1a3fab55b05a639b0a45efa667064073b8c56bb640220726879ed59dd147b4822b7094849706a0b807611df8c747593e49126b33ea893", 
2019-08-18 19:12 +00:00:   "timestamp": 76054315, 
2019-08-18 19:12 +00:00:   "type": 0, 
2019-08-18 19:12 +00:00:   "version": 1
2019-08-18 19:12 +00:00: }
2019-08-18 19:12 +00:00: >>> logSomething response:
2019-08-18 19:12 +00:00: {"success": true}

https://explorer.ark.io:8443/api/transactions/d1da70d8d5805b952571ae0776702f39dee4771a3f5498596fd15fec2cc6a698

2019-08-18 19:30 +00:00: >>> Data received :
2019-08-18 19:30 +00:00: {
2019-08-18 19:30 +00:00:   "amount": "56695861", 
2019-08-18 19:30 +00:00:   "blockId": "2570b880127dc1c48951e7deebd9964294ac6e8ef67ad10998c2d71517c1ae8e", 
2019-08-18 19:30 +00:00:   "expiration": 0, 
2019-08-18 19:30 +00:00:   "fee": "1500000", 
2019-08-18 19:30 +00:00:   "id": "d1da70d8d5805b952571ae0776702f39dee4771a3f5498596fd15fec2cc6a698", 
2019-08-18 19:30 +00:00:   "network": 23, 
2019-08-18 19:30 +00:00:   "recipientId": "AQ9K7USynPxYezhHJmgtHLQeao7Vg3rxL8", 
2019-08-18 19:30 +00:00:   "secondSignature": "304402207430d77c5988f8322fd0b36d3bf78eb874016af771bd02da412597913bef859f0220665e2ec133f1f1e0543ffdef6496507926273ed21301b77ec228230df6a7adbd", 
2019-08-18 19:30 +00:00:   "senderPublicKey": "0371e0dabfd774b4f53fb9c5386a31ee4b3cb951529f18fdb5b8b7e21dbfb4b885", 
2019-08-18 19:30 +00:00:   "sequence": 32, 
2019-08-18 19:30 +00:00:   "signature": "3045022100c8991fd00fc708145734e4236458e05b14ad98856ba49ef1065adf436f900afe02204987ef913aec2aae23b1206c76b960f8cb6c09537c83b9983d055f887a5f9152", 
2019-08-18 19:30 +00:00:   "timestamp": 76054929, 
2019-08-18 19:30 +00:00:   "type": 0, 
2019-08-18 19:30 +00:00:   "vendorField": "arkship - Profit sharing, thank you!\"", 
2019-08-18 19:30 +00:00:   "vendorFieldHex": "61726b73686970202d2050726f6669742073686172696e672c207468616e6b20796f752122", 
2019-08-18 19:30 +00:00:   "version": 1
2019-08-18 19:30 +00:00: }
2019-08-18 19:30 +00:00: >>> logSomething response:
2019-08-18 19:30 +00:00: {"success": true}

Expected Behavior

In thoses transactions, amount <= "2500000000" and their vendorFields do not match the re ^arky.*$ so they should never have triggered the webhook POST.

Context

Testing my ark-listener project : https://github.com/Moustikitos/ark-listener

Ideas

The reasons I see is that the amount comparison is done using string (see python example). I got no idea about why the regexp did not work well.

>>> # example of string amount comparison in python
>>> "2500000000" > "681877755"
False
>>> "2500000000" < "681877755"
True

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
faustbriancommented, Aug 23, 2019

https://github.com/ArkEcosystem/core/pull/2887 - Will be release on mainnet sometime next week.

0reactions
Moustikitoscommented, Oct 6, 2019

I deployed a webhook using the condition type eq 3 and nothing is triggered.

Using an amount eq 0-based-webhook, I caught a vote transaction:

2019-10-06 04:43 +00:00: {
2019-10-06 04:43 +00:00:   "amount": "0", 
2019-10-06 04:43 +00:00:   "asset": {
2019-10-06 04:43 +00:00:     "votes": [
2019-10-06 04:43 +00:00:       "+021f277f1e7a48c88f9c02988f06ca63d6f1781471f78dba49d58bab85eb3964c6"
2019-10-06 04:43 +00:00:     ]
2019-10-06 04:43 +00:00:   }, 
2019-10-06 04:43 +00:00:   "blockId": "34b45174342f37d4c5449e0035e0bf28506af242f20c16c8642d40afefbecd45", 
2019-10-06 04:43 +00:00:   "fee": "100000000", 
2019-10-06 04:43 +00:00:   "id": "bf192ed044563f846bf3d8e0621a9da1380e3a04995e6e7bb9614d7f7875319b", 
2019-10-06 04:43 +00:00:   "network": 23, 
2019-10-06 04:43 +00:00:   "recipientId": "AeHsYn1r33b8463w5NwLmJVehm2juCQPZW", 
2019-10-06 04:43 +00:00:   "senderPublicKey": "0398675076fef0c72ecfab8baeddefa820b674b1bc861598c16d41a070c730eb1d", 
2019-10-06 04:43 +00:00:   "sequence": 0, 
2019-10-06 04:43 +00:00:   "signature": "3044022065cbe21b1dd16e8bfcd7ff7121ea5c8f646523585e1766ce095d5328d6b2853302200a7d84ddc74558f2d3cca9613ca716358430d9995340be157e87fefc0eddec98", 
2019-10-06 04:43 +00:00:   "timestamp": 80235774, 
2019-10-06 04:43 +00:00:   "type": 3, 
2019-10-06 04:43 +00:00:   "version": 1
2019-10-06 04:43 +00:00: }

In sent data, type type is an int and it is register as a str in the webhook database, could be the bug like in the amount comparison…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common Problems with Webhooks - Zapier Help
If the Zap receives an invalid payload, it may be ignored and the Zap may fail to trigger. Zapier can accept payloads that...
Read more >
GitHub webhook events - AWS CodeBuild
A build is triggered if all the filters on one or more filter groups evaluate to true. When you create a filter group,...
Read more >
Trigger Based Ad Rules - Marketing API
A Trigger Based Rule only checks its condition when this field is changed. A Trigger Based Rule can only have one trigger ....
Read more >
Ways to trigger a Logicblock - Getting Started & How-To's
Logicblocks have two elements inside them: the condition that makes them true or false, and the actions that should be executed. In Apilio,...
Read more >
GitHub: Webhook Troubleshooting - CloudBees Support
Check that "GitHub-API-User" has Admin permissions for the repo. · If GitHub Username and Password is used for GitHub plugin configuration, validate that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found