I made some test codes to send transactions with Node.js client library, and received the below error response. I cannot find the cause of this error. Did this happen to anyone before? And can anyone explain what went wrong here?
Error: Request Error: Request too long
at Object.requestError (/var/iota-node/node_modules/iota.lib.js/lib/errors/requestErrors.js:11:12)
at makeRequest.prepareResult (/var/iota-node/node_modules/iota.lib.js/lib/utils/makeRequest.js:293:24)
at exports.XMLHttpRequest.request.onreadystatechange (/var/iota-node/node_modules/iota.lib.js/lib/utils/makeRequest.js:71:25)
at exports.XMLHttpRequest.dispatchEvent (/var/iota-node/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:25)
at setState (/var/iota-node/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:610:14)
at IncomingMessage.<anonymous> (/var/iota-node/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:447:13)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
Codes I used to make transactions
const IOTA = require('iota.lib.js');
const fs=require("fs");
const iota = new IOTA({ provider: 'http://iota.node.com:14265' })
var content = fs.readFileSync("site.pdf", "base64");
const trytes = 'MYADDRESS';
var messageToSend = {
'name': 'Test',
'message': 'test message',
'file_content': content
}
var messageStringified = JSON.stringify(messageToSend);
var message = iota.utils.toTrytes(messageStringified);
var tag = iota.utils.toTrytes('testtag');
const transfers = [
{
value: 0,
address: trytes,
message: message,
tag: tag
}
];
iota.api.sendTransfer(trytes, 3, 14, transfers, (error, success) => {
if (error) {
console.log(error)
} else {
console.log(success)
}
});