1

I want to use the mysql package with webpack, and I always get the error

Error: Received packet in the wrong sequence.

I have read these posts:

But in my case nothing helped. I am using nuxt.js and I have tried the mangle trick UglifyjsWebpackPlugin and also tried to switch between modes, but nothing helped.

Is there anyone who has experienced something similar and knows how to solve it?

Cheers

Merc
  • 4,241
  • 8
  • 52
  • 81

1 Answers1

1

I just found out what was the problem: I was actually using netlify-lambda (https://www.npmjs.com/package/netlify-lambda) to write a lambda function where I needed the mysql. This all resides within a project where I have nuxt and a webpack config.

What I did not realize was that the netlify lambda uses it's own webpack config to build and serve my node function. So I was always adding the config stuff into the wrong webpack config. Now that I disabled minification at the right place it worked.

Merc
  • 4,241
  • 8
  • 52
  • 81
  • I am in this same predicament. Can you elaborate on what you did to remedy this issue? – Ju66ernaut Feb 05 '20 at 23:11
  • I added a new `webpack-config.functions.js` just for my functions. And then when starting `$ yarn netlify-lambda serve ./netlify-lambda-src --config webpack-config.functions.js` I indicated which webpack config the lambda should run. Of course that webpack contained the minification stuff: `module.exports = { // mysql and webpack minification don't like each other: // https://github.com/mysqljs/mysql/issues/1548 optimization: { minimize: false } }` – Merc Feb 07 '20 at 09:01
  • I hope you see what I mean without the linebreaks (there is one important one starting before the word `optimization`... – Merc Feb 07 '20 at 09:02