visionmedia/connect-form — Issue #22: Error: parser error, IncomingForm.write 
Author: felixchan
Created: 2011-10-22 03:34:50+00:00
State: open

Hi TJ,

I'm getting this error:

```
Error: parser error, 0 of 1448 bytes parsed
at IncomingForm.write (/home/myuser/myproject/node_modules/connect-form/node_modules/formidable/lib/incoming_form.js:141:17)
at IncomingMessage. (/home/myuser/myproject/node_modules/connect-form/node_modules/formidable/lib/incoming_form.js:91:12)
at IncomingMessage.emit (events.js:64:17)
at HTTPParser.onBody (http.js:121:23)
at Socket.ondata (http.js:1008:22)
at Socket._onReadable (net.js:682:27)
at IOWatcher.onReadable [as callback] (net.js:177:10)
```

```
app.post('/upload',function(req,res){
req.form.complete(function(err, fields, files){
if (err) {
next(err);
} else {
console.log('\nuploaded %s to %s'
, files.image.filename
, files.image.path);

res.redirect('back');
}
});

req.form.on('progress', function(bytesReceived, bytesExpected){
var percent = (bytesReceived / bytesExpected * 100) | 0;
process.stdout.write('Uploading: %' + percent + '\r');
});
});
```

I'm sure you've seen this before (https://github.com/felixge/node-formidable/issues/34). People are saying that it's because mongodb got accessed before hitting the code.

I use Everyauth and MongooseAuth (https://github.com/bnoguchi/everyauth) , and it probably accesses mongodb before hitting the code.

What should I do?

Thanks!