I can login with Github for example, but when I am using Google account, it throws an error below. I tried different adapters, but could not find the right, if Sequelize is not compatible? I can see there is a truncated value, but I am unsure how to prevent this, and if this is the issue causer? Any help will be much appreciated.
[next-auth][error][adapter_error_linkAccount]
https://next-auth.js.org/errors#adapter_error_linkaccount String or binary data would be truncated in table 'database_massage.dbo.accounts', column 'id_token'. Truncated value: 'eyJhbGciOiJSUzI1NiIsImtpZCI6Ijg2MTY0OWU0NTAzMTUzODNmNmI5ZDUxMGI3Y2Q0ZTkyMjZjM2NkODgiLCJ0eXAiOiJKV1Qi'. {
message: "String or binary data would be truncated in table 'databasenextauth.dbo.accounts', column 'id_token'. Truncated value: 'eyJhSGciKiJSUzI1NiIsIxtpZCI6Ijg2MTY0OOU0NTAzMTOzODNmOmI5ZDUxMGI3Y2Q0ZTkyBjZjN2NkODgiLSJ0eXAiOiJKV1Qi'.",
stack: 'Error\n' +
' at Query.run (/Users/user_rr/Desktop/testnextauth/node_modules/sequelize/lib/dialects/mssql/query.js:99:25)\n' +
' at /Users/user_rr/Desktop/testnextauth/node_modules/sequelize/lib/sequelize.js:313:28\n' +
' at processTicksAndRejections (node:internal/process/task_queues:96:5)\n' +
' at async MSSqlQueryInterface.insert (/Users/user_rr/Desktop/testnextauth/node_modules/sequelize/lib/dialects/abstract/query-interface.js:297:21)\n' +
' at async model.save (/Users/user_rr/Desktop/testnextauth/node_modules/sequelize/lib/model.js:2424:35)\n' +
' at async Function.create (/Users/user_rr/Desktop/testnextauth/node_modules/sequelize/lib/model.js:1336:12)\n' +
' at async linkAccount (/Users/user_rr/Desktop/testnextauth/node_modules/@next-auth/sequelize-adapter/dist/index.js:96:13)',
name: 'SequelizeDatabaseError'
}
[next-auth][error][OAUTH_CALLBACK_HANDLER_ERROR]
https://next-auth.js.org/errors#oauth_callback_handler_error String or binary data would be truncated in table 'database_massage.dbo.accounts', column 'id_token'. Truncated value: 'eyJhbGciOiJSUzI1NiIsImtpZCI6Ijg2MTY0OWU0NTAzMTUzODNmNmI5ZDUxMGI3Y2Q0ZTkyMjZjM2NkODgiLCJ0eXAiOiJKV1Qi'. Error
at Query.run (/Users/user_rr/Desktop/testnextauth/node_modules/sequelize/lib/dialects/mssql/query.js:99:25)
at /Users/user_rr/Desktop/testnextauth/node_modules/sequelize/lib/sequelize.js:313:28
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async MSSqlQueryInterface.insert (/Users/user_rr/Desktop/testnextauth/node_modules/sequelize/lib/dialects/abstract/query-interface.js:297:21)
at async model.save (/Users/user_rr/Desktop/testnextauth/node_modules/sequelize/lib/model.js:2424:35)
at async Function.create (/Users/user_rr/Desktop/testnextauth/node_modules/sequelize/lib/model.js:1336:12)
at async linkAccount (/Users/user_rr/Desktop/testnextauth/node_modules/@next-auth/sequelize-adapter/dist/index.js:96:13) {
name: 'LinkAccountError',
code: undefined
}
My code is below:
import SequelizeAdapter from "@next-auth/sequelize-adapter"
import { Sequelize } from "sequelize"
import NextAuth from "next-auth"
import GoogleProvider from "next-auth/providers/google";
import GitHubProvider from "next-auth/providers/github";
const sequelize = new Sequelize(process.env.DB_NAME, process.env.DB_USERNAME, process.env.DB_PASSWORD, {
host: process.env.DB_HOST,
dialect: 'mssql',
})
export default NextAuth({
providers: [
GitHubProvider({
clientId: process.env.GITHUB_CLIENT_ID,
clientSecret: process.env.GITHUB_CLIENT_SECRET
}),
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET
})
],
adapter: SequelizeAdapter(sequelize)
})