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?