I’ve got a HTTP POST task that’s sending a lump of JSON to the GraphQL External Adapter.
When I send a literal regular JSON string it works fine.
{\"jobRunId\":1,\"data\":{\"query\":\"query rightToLeft ($code: ID!) {language(code: $code) { rtl }}\",\"variables\":{\"code\":\"ar\"},\"graphqlEndpoint\":\"https://countries.trevorblades.com/\"}}
When I replace {\"code\":\"ar\"}
with {\"code\":\"$(decode_cbor.languageCode)\"}
I get the following error when the HTTP POST task is executed
requestData: while unmarshalling JSON: invalid character '_' after object key:value pair; js: {"jobRunId":1,"data":{"query":"query rightToLeft ($code: ID!) {language(code: $code) { rtl }}","variables":{"code":"{ "__chainlink_key_path__": "decode_cbor.languageCode" }"},"graphqlEndpoint":"https://countries.trevorblades.com/"}}: bad input for task
I’m trying to use the $(foo)
notation that’s documented here https://docs.chain.link/docs/jobs/task-types/http/
Here’s the complete jobspec’s observationSource:
decode_log [type="ethabidecodelog" abi="OracleRequest(bytes32 indexed specId, address requester, bytes32 requestId, uint256 payment, address callbackAddr, bytes4 callbackFunctionId, uint256 cancelExpiration, uint256 dataVersion, bytes data)" data="$(jobRun.logData)" topics="$(jobRun.logTopics)"] decode_cbor [type="cborparse" data="$(decode_log.data)"] post [type="http" method=POST url="https://ea-graphql-k3zq5wb52q-uc.a.run.app/" requestData="{\"jobRunId\":1,\"data\":{\"query\":\"query rightToLeft ($code: ID!) {language(code: $code) { rtl }}\",\"variables\":{\"code\":\"$(decode_cbor.languageCode)\"},\"graphqlEndpoint\":\"https://countries.trevorblades.com/\"}}"] parse [type="jsonparse" path="result,data,language,rtl" data="$(post)"] encode_data [type="ethabiencode" abi="(bool value)" data="{ \"value\": $(parse) }"] encode_tx [type="ethabiencode" abi="fulfillOracleRequest(bytes32 requestId, uint256 payment, address callbackAddress, bytes4 callbackFunctionId, uint256 expiration, bytes32 data)" data="{\"requestId\": $(decode_log.requestId), \"payment\": $(decode_log.payment), \"callbackAddress\": $(decode_log.callbackAddr), \"callbackFunctionId\": $(decode_log.callbackFunctionId), \"expiration\": $(decode_log.cancelExpiration), \"data\": $(encode_data)}" ] submit_tx [type="ethtx" to="0x188b71C9d27cDeE01B9b0dfF5C1aff62E8D6F434" data="$(encode_tx)"] decode_log -> decode_cbor -> post -> parse -> encode_data -> encode_tx -> submit_tx
What am I doing wrong?
Any help is kindly appreciated.