question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot call method 'push' of undefined

See original GitHub issue

I’m guessing that this is actually a dicer bug, but I’m seeing this in my logs (causing server restarts):

  TypeError: Cannot call method 'push' of undefined
      at Dicer._write (/home/app/dojo/node_modules/busboy/node_modules/dicer/lib/Dicer.js:103:17)
      at doWrite (_stream_writable.js:221:10)
      at writeOrBuffer (_stream_writable.js:211:5)
      at Dicer.Writable.write (_stream_writable.js:180:11)
      at Multipart.write (/home/app/dojo/node_modules/busboy/lib/types/multipart.js:227:24)
      at Busboy._write (/home/app/dojo/node_modules/busboy/lib/main.js:67:16)
      at doWrite (_stream_writable.js:221:10)
      at writeOrBuffer (_stream_writable.js:211:5)
      at Busboy.Writable.write (_stream_writable.js:180:11)
      at write (_stream_readable.js:583:24)
      at flow (_stream_readable.js:592:7)
      at _stream_readable.js:560:7
      at process._tickDomainCallback (node.js:459:13)

I can’t reproduce this in tests though.

Here are the headers:

{ host: '[redacted]',
    accept: '*/*',
    'accept-encoding': 'gzip, deflate',
    'accept-language': 'en-us',
    'content-type': 'multipart/form-data; charset=utf-8; boundary=0xKhTmLbOuNdArY',
    cookie: '[redacted]',
    'user-agent': '[redacted]/122 CFNetwork/672.0.8 Darwin/14.0.0',
    'x-client-build': '122',
    'x-client-identifier': 'iOS',
    'x-client-version': '2.4',
    'x-forwarded-for': '[redacted]',
    'x-forwarded-port': '80',
    'x-forwarded-proto': 'http',
    'content-length': '1449',
    connection: 'close' }

These don’t seem to be sufficient to reproduce the error in tests though. I don’t have an example body either, unfortunately.

Using busboy 0.2.1.

Thanks!

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dmitrig01commented, Feb 26, 2014

I’m getting this occasionally too. Here’s the code I’m using:

    var busboy = new Busboy({ headers: req.headers }), data = {}, buffer;
    busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
        var bufs = [];
        file.on('data', function(d) { bufs.push(d); });
        file.on('end', function() {
            buffer = Buffer.concat(bufs);
        });
    });
    busboy.on('field', function(name, val) {
        data[name] = val;
    });
    busboy.on('end', function() {
        // use buffer
    });
    req.pipe(busboy);
0reactions
cainuscommented, Feb 28, 2014

Thanks for this! it’s been running in production for me for a couple of days now (under pretty heavy load), and everything looks great.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Cannot call method 'push' of undefined" while it IS defined
Since it's possible to push an undefined variable into an array without error, the problem must be that input isn't defined when you...
Read more >
TypeError: Cannot read Property 'push' of Undefined in JS
The "Cannot read property push of undefined" error occurs when trying to call the push() method on an undefined value. Make sure the...
Read more >
Console error “Cannot call method 'push' of undefined” when ...
This is caused by custom code for tracking user activity that cannot be executed during page edit. Resolution. Wrap the custom code in ......
Read more >
How to Fix TypeError: Cannot read Property 'push' of ...
You call the method on a variable previously set to undefined . · You call the method on a variable before it has...
Read more >
.push() - TypeError: Cannot call method 'call' of undefined
All my code is on github where its nicer to look at so i've just linked to their. I am trying to fully...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found