Field 'email' doesn't have a default with connection pool in MySQL
[next-auth][error][adapter_error_createUser] https://next-auth.js.org/errors#adapter_error_createuser Field 'email' doesn't have a default value { message: "Field 'email' doesn't have a default value", stack: "Error: Field 'email' doesn't have a default value\n" + ' at PromisePool.query (/app/node_modules/.pnpm/[email protected]/node_modules/mysql2/promise.js:356:22)\n' + ' at MySql2PreparedQuery.execute (file:///app/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/drizzle-orm/mysql2/session.js:48:21)\n' + ' at QueryPromise.execute (file:///app/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/drizzle-orm/mysql-core/query-builders/insert.js:90:27)\n' + ' at QueryPromise.then (file:///app/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/drizzle-orm/query-promise.js:21:17)\n' + ' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)', name: 'Error'}
[next-auth][error][adapter_error_createUser] https://next-auth.js.org/errors#adapter_error_createuser Field 'email' doesn't have a default value { message: "Field 'email' doesn't have a default value", stack: "Error: Field 'email' doesn't have a default value\n" + ' at PromisePool.query (/app/node_modules/.pnpm/[email protected]/node_modules/mysql2/promise.js:356:22)\n' + ' at MySql2PreparedQuery.execute (file:///app/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/drizzle-orm/mysql2/session.js:48:21)\n' + ' at QueryPromise.execute (file:///app/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/drizzle-orm/mysql-core/query-builders/insert.js:90:27)\n' + ' at QueryPromise.then (file:///app/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/drizzle-orm/query-promise.js:21:17)\n' + ' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)', name: 'Error'}
Im getting this error since switching to a connection pool from single connection. This happens when creating a new user in my app with next-auth.
I tried changing to connection pool because I kept getting the " Can't add new command when connection is in closed state. " when leaving the app open for a while, as others mentioned before.
Using normal Mysql (despite the logs mentioning planetscale -Im not using planetscale)
For some reason this is not happening when running locally, only on prod.