Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack + MySQL async/await => Error: Received packet in the wrong sequence #96

Closed
rcbyron opened this issue Mar 4, 2021 · 1 comment

Comments

@rcbyron
Copy link

rcbyron commented Mar 4, 2021

Using Webpack minimization causes an error when running an "await query"

Error: Received packet in the wrong sequence

(This is mentioned under the npm mysql module issues: mysqljs/mysql#1655)

It has a workaround (disable mangling of function names):

optimization: {
    minimizer: [new TerserPlugin({ terserOptions: { mangle: false } })] // false otherwise mysql promises blow up with "PROTOCOL_INCORRECT_PACKET_SEQUENCE"
}

However it seems like mysql2 might support promises/async/await and mangled names?
https://www.npmjs.com/package/mysql2

Might be good to add a configuration option to use mysql2 instead, since it looks to be backwards compatible.

@rcbyron
Copy link
Author

rcbyron commented May 12, 2021

Looks like switching to mysql2 in the config solved the problem.

const sql = require('serverless-mysql')({
  library: require('mysql2'), // better performance and support for promises
  ...
}

Closing this issue.

@rcbyron rcbyron closed this as completed May 12, 2021
bherila pushed a commit to bherila/2020-website that referenced this issue Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant