0

I'm storing images in fabric blockchain as base64 strings. Here, whenever I try to interact(update or add assets including base64 strings) with the blockchain through the composer rest server, it throws below error,

Error: request entity too large

How to increase the request size limit or what are other possible approaches to handle this issue?

LahiruE
  • 65
  • 1
  • 11

1 Answers1

2

I was able to edit the maximum request size of the REST server by editing the server.js located in path_to_rest_server/server/. I edited below code,

// Support JSON encoded bodies.
app.middleware('parse', bodyParser.json());

// Support URL encoded bodies.
app.middleware('parse', bodyParser.urlencoded({
    extended: true,
}));

to,

// Support JSON encoded bodies.
app.middleware('parse', bodyParser.json({
  strict: false,
  limit: "10000kb"
}));

// Support URL encoded bodies.
app.middleware('parse', bodyParser.urlencoded({
  extended: true,
  limit: "10000kb"
}));

10000kb is the size limit.

LahiruE
  • 65
  • 1
  • 11