Closed onlyjazz closed 1 hour ago
I clicked send webhook on create and update - the sanity POSTs twice
09:43:19.585 IDT POST /sanity-webhook 200 OK
09:43:15.330 IDT POST /sanity-webhook 200 OK
Log confirms that the webhook function was called twice and second time correctly did not post to X The webhook was configured to trigger on Create and Update
Test: Change to trigger on Create
On Create doesn't trigger
Test: Trigger on Update
Triggers twice 5s apart
10:20:19.990 IDT POST /sanity-webhook 200 OK
10:20:14.783 IDT POST /sanity-webhook 200 OK
Test: wait 1' after clicking approve and then click publish
2 POSTS to webhook
10:43:40.201 IDT POST /sanity-webhook 200 OK
10:43:36.004 IDT POST /sanity-webhook 200 OK
Sends the same hook id twice 4s apart
{
"id": "atm-2nmf9Yr2hR7czBuSuC9UiBCBG6F",
"projectId": "rh2kgtdt",
"inProgress": false,
"duration": 820,
"createdAt": "2024-10-22T07:43:40.029Z",
"updatedAt": "2024-10-22T07:43:40.029Z",
"messageId": "msg-2nmf9OGS7L7SGGlnMdzlxbWruXQ",
"hookId": "Id93HEHYwh4kIgSr",
"isFailure": false,
"failureReason": null,
"resultCode": 200,
"resultBody": "{\"message\":\"tweet processed\",\"status\":200}\n"
},
{
"id": "atm-2nmf9NdzSgotkfsbWW1yCDXd0IH",
"projectId": "rh2kgtdt",
"inProgress": false,
"duration": 4269,
"createdAt": "2024-10-22T07:43:35.723Z",
"updatedAt": "2024-10-22T07:43:35.723Z",
"messageId": "msg-2nmf8ttphTpJKXhT1nWzDKYnDd3",
"hookId": "Id93HEHYwh4kIgSr",
"isFailure": false,
"failureReason": null,
"resultCode": 200,
"resultBody": "{\"message\":\"tweet processed\",\"status\":200}\n"
},
webhook_service.py calls sanity_to_x
res=sanity_to_x(content)
It looks like the webhook is being invoked once by the Sanity backend so the issue seems to be in sanity_to_x
Code prints: