I'm attempting to create a transaction on the Kylin network (via the dfuse endpoint https://kylin.eos.dfuse.io) and I'm using a bespoke fetch to add some headers dfuse wants to see. here's the method:

const customizedFetch = (input, init) => {
  if (init.headers === undefined) {
    init.headers = {}

  const headers = init.headers;
  headers["Authorization"] = `Bearer ${config.dfuseApiToken}`
  headers["X-Eos-Push-Guarantee"] = "in-block" // Can be "irreversible", "handoff:1", "handoffs:2", "handoffs:3"

  return fetch(input, init);

which I then pass to the JsonRcp:

const rpc = new JsonRpc(config.endpoint, { fetch: customizedFetch })

but when I call api.transact() I get the error below:

{ Error: Couldn't decode incoming json at new RpcError (/Users/ekkis/dev/eos/node_modules/eosjs/dist/eosjs-rpcerror.js:23:28) at JsonRpc. (/Users/ekkis/dev/eos/node_modules/eosjs/dist/eosjs-jsonrpc.js:118:35) at step (/Users/ekkis/dev/eos/node_modules/eosjs/dist/eosjs-jsonrpc.js:36:23) at Object.next (/Users/ekkis/dev/eos/node_modules/eosjs/dist/eosjs-jsonrpc.js:17:53) at fulfilled (/Users/ekkis/dev/eos/node_modules/eosjs/dist/eosjs-jsonrpc.js:8:58) at process.internalTickCallback (internal/process/next_tick.js:77:7) json: { code: 500, message: "Couldn't decode incoming json", error: { code: 3990004, name: 'parse_error_exception_code', what: "Couldn't decode incoming json", details: [Array] } } }

if I look at the object returned by the fetch, the reason becomes more apparent, an internal server error:

Response { size: 0, timeout: 0, [Symbol(Body internals)]: { body: Gunzip { _readableState: [ReadableState], readable: true, _events: [Object], _eventsCount: 7, _maxListeners: undefined, _writableState: [WritableState], writable: true, allowHalfOpen: true, _transformState: [Object], bytesWritten: 0, _handle: [Zlib], _hadError: false, _writeState: [Uint32Array], _outBuffer: , _outOffset: 0, _level: -1, _strategy: 0, _chunkSize: 16384, _defaultFlushFlag: 2, _finishFlushFlag: 2, _nextFlush: -1, _info: undefined }, disturbed: false, error: null }, [Symbol(Response internals)]: { url: 'https://kylin.eos.dfuse.io/v1/chain/push_transaction', status: 500, statusText: 'Internal Server Error', headers: Headers { [Symbol(map)]: [Object] } } }

the error only happens on the call to the https://kylin.eos.dfuse.io/v1/chain/push_transaction endpoint but before that it makes about 6 other calls successfully

can anyone help?

2 Answers 2


The eosjs library when creating the signed transaction that should be pushed to nodeos uses an integer for the compression field:

  "signatures": [
    "SIG_K1_Ka ... fT"
  "compression": 0,
  "packed_context_free_data": "",
  "packed_trx": "f9c9 ... 6e2900"

This was not handled properly in dfuse while still correctly accepted by nodeos. This was leading to a Couldn't decode incoming json being returned to the user (because the JSON received was not decodable correctly).

As of writing (March 11th, 2019), this condition is fixed and dfuse push guaranteed feature is now able to accept signed transaction JSON produced by eosjs.

The https://github.com/dfuse-io/eosjs-push-guaranteed repository can be explored to see how to use eosjs to push a transaction through dfuse push guaranteed endpoint (https://docs.dfuse.io/#rest-api-post-push_transaction).

  • thanks Matt. I should have opened a github issue but I wasn't sure it was a problem with your end
    – ekkis
    Commented Mar 12, 2019 at 22:43

This looks like an error passed directly from nodeos, so it wouldn't be affected by the dfuse pass-through + listener there.

We'd need to inspect the payloads to see if the JSON is indeed well-formed or not. This smells like wonky objects that can't serialize to JSON somewhere within that transaction.

  • the problem only exhibits when I use the customer fetch. if I just pass fetch to the JsonRpc constructor the call works fine. as for the payload, I posted the contents returned by fetch within the custom fetch function. did you have something else in mind?
    – ekkis
    Commented Mar 8, 2019 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.