webhook returning task id that does not exist on board

I created a webhook to query a section change on a board and return the story of a task.

it is working 95% of the time, but sometimes it is being triggered and the task_id of the parent of the story doesnt exist on the board.

webhook returns

events
   1
     user
       gid
         1200327866514063
       resource_type
         user
       created_at
          2022-08-19T01:11:27.760Z
       action
          added
     resource
       gid
         1202827780299738
       resource_type
         story
       resource_subtype
         section_changed
     parent
       gid
         1202802348661595
       resource_type
          task
        resource_subtype
          default_task

this is a list of tasks on that same board the resource of the webhook is pointing to

 [1] "1202646037955651" "1202157913639375" "1202221178034321" "1202569239373976" "1202764998621215" "1200733569301546"
 [7] "1202700305124291" "1202700134151315" "1202699531637425" "1202771008962059" "1202717042716971" "1202773106759228"
[13] "1202773098789995" "1202784406602222" "1202815936862786" "1202817091568295"

Hi @Yoni_Sidi,

I’m not sure why that would be happening. @Andrew-asana/DevRel team, any ideas?

FYI I moved your post to the Developers & API section; that’s the home for all API-related questions/issues.

@Phil_Seeman thanks for moving it to the right place.

pinging @JGibbard

This issue is referenced to another issue

This is still happening.

Now the story gid is not found in the task story list.

# Third Party
import requests
import re

ACCESS_TOKEN = input_data['ACCESS_TOKEN']
API_URL = "https://app.asana.com/api/1.0"
headers = {"Authorization": f"Bearer {ACCESS_TOKEN}"}
url = f"{API_URL}/tasks/{input_data['parent_id']}/stories"

r = requests.get(url, headers=headers)
story = r.json()["data"]
this_story = list(filter(lambda x: x['gid'] == input_data['resource_id'], story))

found = bool(len(this_story)>0)
output = {'found': found, 'story': this_story}
>>> found
False

Hi @Yoni_Sidi ,

I’m Andrew and I’m part of the Developer Relations team here at Asana. Just wanted to check in on this one:

it is working 95% of the time, but sometimes it is being triggered and the task_id of the parent of the story doesnt exist on the board.

For the other 5% of events, can you share more about the nature of these tasks? With the information given, I’m most curious about:

  • Are these tasks (i.e., those that change sections) being removed from the project (and as such, no longer exist on the board)?
    • Have these tasks ever existed on the board?
  • Do events on these non-existent tasks share the same action (e.g., “added”) as tasks that do exist on the board?
  • Are there other webhooks established on this board?

Best,

Andrew