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

Error connecting to MSSQL database with clustering enabled #1200

Open
nick-w-nick opened this issue Oct 30, 2024 · 2 comments
Open

Error connecting to MSSQL database with clustering enabled #1200

nick-w-nick opened this issue Oct 30, 2024 · 2 comments
Labels
built-in dialect Related to a built-in dialect mssql Related to MS SQL Server (MSSQL) question Further information is requested

Comments

@nick-w-nick
Copy link
Contributor

After connecting to a MSSQL database that has clustering/availability zones enabled, I am getting this error message after making a query:

UnexpectedTokenError: Unexpected token `ENVCHANGE` in `RequestTokenHandler`
    at RequestTokenHandler.onDatabaseMirroringPartner (/Users/user/Documents/GitHub/service-name/node_modules/tedious/src/token/handler.ts:140:11)

This error is not present in our other identical MSSQL databases where clustering is disabled.

I realize this seems to be an error stemming from tedious, but I thought this repo would be more suitable to ask for help, as we are also using tedious with Sequelize and have no issues connecting to the exact same database.

We have also verified that we don't seem to have database mirroring enabled, but are somehow still getting sent a DatabaseMirroringPartner event, which is causing the unhandled exception to be thrown.

Any help or insight would be much appreciated.

Thank you!

@igalklebanov igalklebanov added question Further information is requested mssql Related to MS SQL Server (MSSQL) labels Oct 30, 2024
@igalklebanov
Copy link
Member

igalklebanov commented Oct 31, 2024

Hey 👋

I think asking this in the tedious repository is best. These are some undocumented internals I have no clue about.

It seems unrelated to kysely and MssqlDialect, but historically, we already had some issues with tedious that were caused by MssqlDialect not handling some undocumented tedious event. Leaving this open for visibility.

@igalklebanov igalklebanov added the built-in dialect Related to a built-in dialect label Oct 31, 2024
@nick-w-nick
Copy link
Contributor Author

@igalklebanov From my research, it seems like the tarn resource pool may be causing the DatabaseMirroringPartner events to be sent due to how it handles the resource pool, since Sequelize uses a custom resource pool and does not have this issue. It may be worth looking into making the tarn property of the MssqlDialect class accept a generic resource pool that implements the tarn methods rather than forcing the usage of tarn.

Regardless, I have a PR open in the tedious repo to fix this issue, FYI. If that gets merged, it should solve the incompatibility issue at the root rather than requiring changes to how pooling works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
built-in dialect Related to a built-in dialect mssql Related to MS SQL Server (MSSQL) question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants