Search code examples
openwhisk

Openwhisk: Request Entity Too Large


I have a local docker-based setup of Apache Openwhisk (https://github.com/apache/incubator-openwhisk-devtools), and when I'm trying to create an action from of a zip containing a packaged nodejs app with

wsk -i action create test --kind nodejs:6 test.zip -v

I get the following response:

413 Request Entity Too Large

The test.zip is only 5 MB large. What causes this issue? Is there any way to make openwhisk process larger requests?

UPD: the content of the test.zip is generated from a nodejs project, which has only 1 .js, which has a simple kafka topic consumer functionality.

function main(params) {
  var kafka = require('kafka-node');
  var HighLevelConsumer = kafka.HighLevelConsumer;
  var Client = kafka.Client;

  if (!(params && params.host)) {
    return {error: 'host is required'};
  }
  if (!(params && params.port)) {
    return {error: 'port is required'};
  }
  if (!(params && params.topic)) {
    return {error: 'topic is required'};
  }
  var host = params.host;
  var port = params.port;
  var topic = params.topic;
  var client = new Client(`${host}:${port}`);
  var topics = [{
    topic: topic
  }];

  var options = {
    autoCommit: true,
    fetchMaxWaitMs: 1000,
    fetchMaxBytes: 1024 * 1024,
    encoding: 'utf8'
  };
  var consumer = new HighLevelConsumer(client, topics, options);

  consumer.on('message', function(message) {
    console.log(message.value);
  });

  consumer.on('error', function(err) {
    console.log('error', err);
  });

  process.on('SIGINT', function() {
    consumer.close(true, function() {
      process.exit();
    });
  });
}

exports.main = main;

And the package.json is the following:

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "test.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node test.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "kafka-node": "^2.6.1"
  }
}

It works correctly if I simply run it with npm start.


Solution

  • It looks like the NGINX proxy used to expose the API interface for the OpenWhisk platform defaults to a small value for the maximum request body size.

    I have managed to re-produce the issue locally, anything above 512KB returns that error.

    I've opened a ticket to see if the default limit can be increased: https://github.com/apache/incubator-openwhisk-devtools/issues/124