Reputation: 345
I have to integrate my Chainlink Bridge task with an asynchronous call. Looking at the official documentation, there's the parameter named async
and I can set it to true
to invoke it asynchronously.
I also found this link which explains how to create Asynchronous callbacks
.
I created the following job step:
fetch [type="bridge"
name="generate-hash"
requestData="{\\"id\\": $(jobSpec.externalJobID), \\"data\\": {\\"fileList\\": $(decode_cbor.fileList)}}"
async=true
]
I also set the environment variable BRIDGE_RESPONSE_URL equals to my Chainlink Oracle address. Looking at the documentation, I must set when using async external adapters.
If I start the job execution, I can see the async call to my bridge and it contains the responseURL
equals to {BRIDGE_RESPONSE_URL}/v2/resume/{id}
.
Once the process finishes, I call the responseURL
using the PATCH http method with the following body:
{
"data": {
"fileList": ["aaa...fff", "bbbb...vvvv"],
"hashList": ["0x...", "0x..."]
}
}
The error I get is 422 - Unprocessable Entity
.
What am I doing wrong?
Upvotes: 0
Views: 68
Reputation: 345
I finally fixed the problem looking at the DEBUG
logs on the Chainlink Node. My logs were these ones:
2023-01-17T21:49:01.538Z [DEBUG] PATCH /v2/resume/b5c2254d-6f85-4953-9f63-7911951a3fb4 web/router.go:535
body={"data":{"fileList":["aaa...fff","bbb...vvv"], hashList":["0x...","0x..."]}} clientIP={client_ip} ùerrors=Error #01: must provide only one of either 'value' or 'error' key
Even if the official Chainlink documentation says you have to send back the result or the error setting data
or error
, it's wrong.
You have to set the parameter value
and then you can set the parameter data
inside. This is how I updated my PATCH HTTP request body:
{
"value": {
"data": {
"fileList": ["aaa...fff", "bbbb...vvvv"],
"hashList": ["0x...", "0x..."]
}
}
}
Upvotes: 1