onlyjazz / book-launch

Launch a book on social media
0 stars 0 forks source link

Webhook service throws error message: "Post was not approved or already tweeted" #5

Closed onlyjazz closed 1 hour ago

onlyjazz commented 3 hours ago

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


HTTP Requests
-------------

22:35:56.085 IDT POST /sanity-webhook           200 OK

Code prints:

Post was not approved or already tweeted
127.0.0.1 - - [21/Oct/2024 22:35:56] "POST /sanity-webhook HTTP/1.1" 200 -
onlyjazz commented 2 hours 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
onlyjazz commented 2 hours ago

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

onlyjazz commented 2 hours ago

On Create doesn't trigger

onlyjazz commented 2 hours ago

Test: Trigger on Update

onlyjazz commented 2 hours ago

Triggers twice 5s apart

10:20:19.990 IDT POST /sanity-webhook           200 OK
10:20:14.783 IDT POST /sanity-webhook           200 OK
onlyjazz commented 2 hours ago

Test: wait 1' after clicking approve and then click publish

Screenshot 2024-10-22 at 10 23 20
onlyjazz commented 1 hour ago

2 POSTS to webhook

10:43:40.201 IDT POST /sanity-webhook           200 OK
10:43:36.004 IDT POST /sanity-webhook           200 OK
onlyjazz commented 1 hour ago

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"
  },