When trying to run migrations today I received the following error:
kysely migrate up
◐ Starting migration up
✖ Migration failed with AggregateError
This provides no information that could help with debugging the issue. Manually adding console.log(error) directly above the current Migration failed with logging code, reveals the following details.
kysely migrate up
◐ Starting migration up
AggregateError
at internalConnectMultiple (node:net:1114:18)
at afterConnectMultiple (node:net:1667:5) {
code: 'ECONNREFUSED',
fatal: true,
[errors]: [
Error: connect ECONNREFUSED ::1:3306
at createConnectionError (node:net:1634:14)
at afterConnectMultiple (node:net:1664:40) {
errno: -61,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '::1',
port: 3306
},
Error: connect ECONNREFUSED 127.0.0.1:3306
at createConnectionError (node:net:1634:14)
at afterConnectMultiple (node:net:1664:40) {
errno: -61,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 3306
}
]
}
✖ Migration failed with AggregateError
So the kysely-ctl has access to all the details, but the current error message parsing - basically calling toString on the object by putting it as a part of the string template - is not sufficient to show them.
Not sure what is the best solution here, since errors can come from various libraries depending on the connection type. However, I've seen the same error message when running migrations on a postgres database, so it's definitely not limited just to mysql connection. I haven't had this issue with other error types, so maybe checking if an error that is thrown is an AggregateError, and adding a custom formatting for it, would be sufficient?
When trying to run migrations today I received the following error:
This provides no information that could help with debugging the issue. Manually adding
console.log(error)
directly above the currentMigration failed with
logging code, reveals the following details.So the kysely-ctl has access to all the details, but the current error message parsing - basically calling toString on the object by putting it as a part of the string template - is not sufficient to show them.
Not sure what is the best solution here, since errors can come from various libraries depending on the connection type. However, I've seen the same error message when running migrations on a postgres database, so it's definitely not limited just to mysql connection. I haven't had this issue with other error types, so maybe checking if an error that is thrown is an AggregateError, and adding a custom formatting for it, would be sufficient?