Monitoring Web3 Functions Tasks

Learn how to monitor your Web3 Function Task

Besides the task logs available in the UI, Gelato Web3 Functions offer a more detailed and granular monitoring system providing status and logs APIs.

Task Status URL

Provided the ChainId and taskId, this API will return the current Task status

https://api.gelato.digital/tasks/web3functions/networks/{chainId}/tasks/{taskId}/status

For example, if your chainId, taskId are:

chainId: 137
taskId: 0xdeaeee394c952d8b23c86eacc704adf7b605d89d992cec9a5fc86e4a517f053b

Then the URL to go to is:

https://api.gelato.digital/tasks/web3functions/networks/137/tasks/0xdeaeee394c952d8b23c86eacc704adf7b605d89d992cec9a5fc86e4a517f053b/status

For this taskId, here is the returned task information:

{
    "task":{
    "chainId":137,               
    "taskId":
"0xdeaeee394c952d8b23c86eacc704adf7b605d89d992cec9a5fc86e4a517f053b",
    "taskState":"CheckPending",
    "creationDate":"2023-06-01T20:10:39.985Z",
    "lastCheckDate":"2023-06-09T06:22:44.966Z",
    "lastCheckMessage":"Fail to run Web3Function: Web3Function exited with code=1",
    "lastExecDate":"2023-06-09T08:15:11.883Z",
    "lastExecTransactionHash":
"0xc2e57f5b56bf24ae77eca31fbe76ecf16cd30cb0fc5592207bb567addff62402"
          }
 }

The first thing to look at is the taskState key:

Task states:

For the taskState key, these are the possible values:

  • CheckPending: the task is pending simulation.

  • ExecPending: the task is executable and is awaiting inclusion into the blockchain.

  • WaitingForConfirmation: the task was included into the blockchain but is still awaiting the required amount of blocks confirmations.

  • ExecSuccess: the task has been successfully executed.

  • Cancelled: the task has been canceled by the owner

  • ExecReverted: the task transaction has been reverted.

Task Logs URL

Provided the ChainId and taskId, this API will return the logs in the last 24 hours, the query param limit is optional

https://api.gelato.digital/tasks/web3functions/networks/{chainId}/tasks/{taskId}/logs?limit=NrLogs

For example, if your chainId, taskId and NrLogs are:

chainId: 137
taskId: 0xdeaeee394c952d8b23c86eacc704adf7b605d89d992cec9a5fc86e4a517f053b
NrLogs:2

Then the URL to go to is:

https://api.gelato.digital/tasks/web3functions/networks/137/tasks/0xdeaeee394c952d8b23c86eacc704adf7b605d89d992cec9a5fc86e4a517f053b/logs?limit=2

For this taskId, here is the returned task information:

{
    {"logs":
      [
        {"date":"2023-06-09T08:43:52.404Z",
        "state":"WaitingForConfirmation",
        "type":"WaitingForConfirmation",
        "message":"txHash: 0x788726ed95f2f916a47cae0c6cdfbea91e1c8e3756f91e0efc08fa501daed8f0"
        },
        {"date":"2023-06-09T08:43:51.835Z",
        "state":"ExecPending",
        "type":"ExecPendingCheck",
        "message":"Task submitted for execution",
        "web3FunctionLogs":["Text generated: ","Chaffinches are small, colourful birds which feed on seeds and insects. They have buff-coloured breasts streaked with brown markings, bright pinkish-red faces and wings marked with white bars. In summer they breed in woodlands; in winter many move south to warmer areas.","Text generated: ","Chameleons are lizards known for their ability to change color, excellent vision and long, sticky tongues used to catch prey."]
        }
    ]
}

Last updated

#272: W3F context including gelato args

Change request updated