2

When running foreman start, I see the following message

> foreman start
20:38:55 web.1  | started with pid 3896
20:38:55 web.1  | Development
20:38:56 web.1  | connect.multipart() will be removed in connect 3.0
20:38:56 web.1  | exited with code 1
20:38:56 system | sending SIGKILL to all processes

I was wondering why this was the case, since running node server.js does not appear to terminate the server.

Here is the segment of code that appears to cause the app to terminate with exit code 1:

var app = express();
app.configure(function()
{
    // More config things above
    app.use(express.bodyParser());   // This line is causing the issue
    // More config things below
}

The above is code using the Express.js framework. Removing the above call to express.bodyParser() allows the server to run (via foreman). The problem is, I'll need the body parser module in order to parse my incoming get/posts requests.

Any help on this issue would be much appreciated.

funseiki
  • 9,167
  • 9
  • 36
  • 59

1 Answers1

5

I have no idea why foreman exits when deprecation warning is reported in express, but you can eliminate this behavior replacing app.use(express.bodyParser()); with

app.use(express.json());
app.use(express.urlencoded());

connect.multipart() will be removed from bodyParserin next version of Connect and this is probably the issue. You can find more info in Connect documenattion and/or in this StackOverflow Q&A.

Community
  • 1
  • 1
ivoszz
  • 4,370
  • 2
  • 27
  • 27
  • 2
    `bodyParser() = json() + urlencoded() + multipart()`. if you're not using file uploads, no need to include `multipart()` middleware. Even if you use file uploads you can use `formidable` or any other module to handle file uploads. – vmx Dec 06 '13 at 16:08
  • @vmx, do you know of any examples that utilize formidable explicitly as an express/connect module (it's used in bodyParser, I believe) – funseiki Dec 06 '13 at 19:55
  • multipart() is considered a security issue when used as a general middleware, it is better to use formidable to explicitly handle file upload as @vmx pointed out – ivoszz Dec 06 '13 at 20:51