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.

Uncaught Error: Received packet in the wrong sequence if config.devtool = ''

See original GitHub issue

Hi ,

I were using for quite some time the mysql node driver in my Electron projects which works fine. But now while using Webpack, my production builds throw:

Uncaught Error: Received packet in the wrong sequence.

After some testing I have realised that the error goes away if I keep config.devtool = ‘eval’ in my webpack.conf.js file, otherwise it crashes:

if (process.env.NODE_ENV === 'production') {
  config.devtool = '' // <----- this will throw Uncaught Error if I omit 'eval'

  config.plugins.push(
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': '"production"'
    }),
    new webpack.optimize.OccurenceOrderPlugin(),
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false
      }
    })
  )
}

home.js:

<script>
  var mysql = require('mysql')
  var connection = mysql.createConnection({
    host: 'localhost',
    user: 'root',
    password: 'password',
    database: 'EONIC'
  })

  connection.connect()
  connection.query('SELECT * from products', function (err, rows, fields) {
    if (err) throw err <---- here will the error happen
    console.log(rows)
  })

  connection.end()

</script>

error happening in mysql/lib/protocol/Protocol.js at line 272:

 if (!sequence[packetName]) {
    var err   = new Error('Received packet in the wrong sequence.');
    err.code  = 'PROTOCOL_INCORRECT_PACKET_SEQUENCE';
    err.fatal = true;

    this._delegateError(err);
    return;
  }

I understand that the error is reflected on the mysql driver’s side, but this happens only in the projects in which I use Webpack. Why does it crashes without eval??

Keeping config.devtool = ‘eval’ solves the problem but this way my project slows down and increases in size…

Webpack version: webpack: 1.13.0 webpack-dev-server: 1.14.1

Please tell us about your environment: OSX 10.11 / Windows 7

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
bluepetercommented, Jul 12, 2017

I haven’t looked deeply into this but fixed it in my situation by UglifyJsPlugin setting mangle to false. Not ideal, but works in a pinch.

1reaction
kuldeepkeshwarcommented, Jun 1, 2017

Hi, I’m also facing the same issue with webpack 2

@vedtam do you know any workaround ? I’m using sequelize

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Uncaught Error: Received packet in the wrong sequence ...
When I set up a new project using Electron + Webpack + node MySQL my production build is throwing: Uncaught Error: Received packet...
Read more >
"Uncaught Error: Received packet in the wrong sequence ...
The error goes away only if I keep: config.devtools = 'eval' in my production builds, apparently this will result in a larger file...
Read more >
Received packet in the wrong sequence" with devtools off ...
"Uncaught Error: Received packet in the wrong sequence" with devtools off - Electron + MySQL node driver + Webpack.
Read more >
Received packet in the wrong sequence - Support
Hi, *I was using a lambda function to connect to MySQL database code here var connection ... Error connecting: Error: Received packet in...
Read more >
export/import javascript class like module node into electron ...
It seems that you mix commonjs modules with ES modules by the wrong way. ... "Uncaught Error: Received packet in the wrong sequence"...
Read more >

github_iconTop Related Medium Post

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