Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

SQL Exception during initial migration on Azure SQL Database #5273

Closed
borczeangelovbasenetch opened this issue Jun 19, 2024 · 0 comments
Closed

Comments

@borczeangelovbasenetch
Copy link

borczeangelovbasenetch commented Jun 19, 2024

Version

8.2.2

Using which broker(s) did you encounter the issue?

MassTransit.SqlTransport.SqlServer

What are the steps required to reproduce the issue?

This issue occurs during the first migration.

What is the expected behavior?

Works as expected with on-premises SQL Server, but throws an exception during the initial migration on Azure SQL Database.

What actually happened?

Hello,

I'm encountering an issue with MassTransit.SqlTransport.SqlServer (v8.2.2) and connecting with Azure SQL Database. The library works as expected with on-premises SQL Server, but throws an exception during the initial migration on Azure SQL Database.

The error message is: "Invalid object name 'sys.syslogins'".
See logs for more info.

Any help would be appreciated.
Thank you!
Borcze Angelov

Related log output, including any exceptions

image

16:04:15:415 INF MassTransit DbTransport creating database "XXXXX-backend-db" <Module: XXXXXBackend> <App: XXXX>                                                                                                                                                                                                                                            ││ 16:04:15:415 ERR Hosting failed to start <Module: XXXXBackend> <App: XXXXX>                                                                                                                                                                                                                                                                                     ││ Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'sys.syslogins'.                                                                                                                                                                                                                                                                                  ││    at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)                                                                                                                                                                                                                                         ││    at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)                                                                                                                                                                                                                                 ││    at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, SqlCommand command, Boolean callerHasConnectionLock, Boolean asyncClose)                                                                                                                                                                                                 ││    at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)                                                                                                                                                     ││    at Microsoft.Data.SqlClient.SqlDataReader.TryConsumeMetaData()                                                                                                                                                                                                                                                                                                         ││    at Microsoft.Data.SqlClient.SqlDataReader.get_MetaData()                                                                                                                                                                                                                                                                                                               ││    at Microsoft.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)                                                                                                                                    ││    at Microsoft.Data.SqlClient.SqlCommand.CompleteAsyncExecuteReader(Boolean isInternal, Boolean forDescribeParameterEncryption)                                                                                                                                                                                                                                          ││    at Microsoft.Data.SqlClient.SqlCommand.InternalEndExecuteReader(IAsyncResult asyncResult, Boolean isInternal, String endMethod)                                                                                                                                                                                                                                        ││    at Microsoft.Data.SqlClient.SqlCommand.EndExecuteReaderInternal(IAsyncResult asyncResult)                                                                                                                                                                                                                                                                              ││    at Microsoft.Data.SqlClient.SqlCommand.EndExecuteReaderAsync(IAsyncResult asyncResult)                                                                                                                                                                                                                                                                                 ││    at Microsoft.Data.SqlClient.SqlCommand.<>c.<InternalExecuteReaderAsync>b__201_1(IAsyncResult asyncResult)                                                                                                                                                                                                                                                              ││    at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)                                                                                                                                                                                                  ││ --- End of stack trace from previous location ---                                                                                                                                                                                                                                                                                                                         ││    at Dapper.SqlMapper.ExecuteScalarImplAsync[T](IDbConnection cnn, CommandDefinition command) in /_/Dapper/SqlMapper.Async.cs:line 1241                                                                                                                                                                                                                                  ││    at MassTransit.SqlTransport.SqlServer.SqlServerDatabaseMigrator.GrantAccess(ISqlServerSqlTransportConnection connection, SqlTransportOptions options) in /_/src/Transports/MassTransit.SqlTransport.SqlServer/SqlTransport/SqlServer/SqlServerDatabaseMigrator.cs:line 1447                                                                                            ││    at MassTransit.SqlTransport.SqlServer.SqlServerDatabaseMigrator.CreateSchemaIfNotExist(SqlTransportOptions options, CancellationToken cancellationToken) in /_/src/Transports/MassTransit.SqlTransport.SqlServer/SqlTransport/SqlServer/SqlServerDatabaseMigrator.cs:line 1391                                                                                         ││    at MassTransit.SqlTransport.SqlServer.SqlServerDatabaseMigrator.CreateSchemaIfNotExist(SqlTransportOptions options, CancellationToken cancellationToken) in /_/src/Transports/MassTransit.SqlTransport.SqlServer/SqlTransport/SqlServer/SqlServerDatabaseMigrator.cs:line 1395                                                                                         ││    at MassTransit.SqlTransport.SqlServer.SqlServerDatabaseMigrator.CreateSchemaIfNotExist(SqlTransportOptions options, CancellationToken cancellationToken) in /_/src/Transports/MassTransit.SqlTransport.SqlServer/SqlTransport/SqlServer/SqlServerDatabaseMigrator.cs:line 1395                                                                                         ││    at MassTransit.SqlTransport.SqlServer.SqlServerDatabaseMigrator.CreateDatabase(SqlTransportOptions options, CancellationToken cancellationToken) in /_/src/Transports/MassTransit.SqlTransport.SqlServer/SqlTransport/SqlServer/SqlServerDatabaseMigrator.cs:line 1340                                                                                                 ││    at MassTransit.SqlTransport.SqlTransportMigrationHostedService.StartAsync(CancellationToken cancellationToken) in /_/src/MassTransit/SqlTransport/SqlTransport/SqlTransportMigrationHostedService.cs:line 34                                                                                                                                                           ││    at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)                                                                                                                                                                                                                                                     ││    at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)                                                                                                                                                               ││ ClientConnectionId:XXXXX                                                                                                                                                                                                                                                                                                                   ││ Error Number:208,State:1,Class:16                                                                                                                                                                                                                                                                                                                                         ││ 16:04:15:415 WRN Failed to stop bus: db://XXXX-mssql.database.windows.net/XXXXX?autodelete=300 ("Not Started") <Module: XXXXXBackend> <App: XXXXX>                                                                                                                                          ││ Unhandled exception. Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'sys.syslogins'.                                                                                                                                                                                                                                                             ││    at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)                                                                                                                                                                                                                                         ││    at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)                                                                                                                                                                                                                                 ││    at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, SqlCommand command, Boolean callerHasConnectionLock, Boolean asyncClose)                                                                                                                                                                                                 ││    at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)                                                                                                                                                     ││    at Microsoft.Data.SqlClient.SqlDataReader.TryConsumeMetaData()                                                                                                                                                                                                                                                                                                         ││    at Microsoft.Data.SqlClient.SqlDataReader.get_MetaData()                                                                                                                                                                                                                                                                                                               ││    at Microsoft.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)                                                                                                                                    ││    at Microsoft.Data.SqlClient.SqlCommand.CompleteAsyncExecuteReader(Boolean isInternal, Boolean forDescribeParameterEncryption)                                                                                                                                                                                                                                          ││    at Microsoft.Data.SqlClient.SqlCommand.InternalEndExecuteReader(IAsyncResult asyncResult, Boolean isInternal, String endMethod)                                                                                                                                                                                                                                        ││    at Microsoft.Data.SqlClient.SqlCommand.EndExecuteReaderInternal(IAsyncResult asyncResult)                                                                                                                                                                                                                                                                              ││    at Microsoft.Data.SqlClient.SqlCommand.EndExecuteReaderAsync(IAsyncResult asyncResult)                                                                                                                                                                                                                                                                                 ││    at Microsoft.Data.SqlClient.SqlCommand.<>c.<InternalExecuteReaderAsync>b__201_1(IAsyncResult asyncResult)                                                                                                                                                                                                                                                              ││    at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)                                                                                                                                                                                                  ││ --- End of stack trace from previous location ---                                                                                                                                                                                                                                                                                                                         ││    at Dapper.SqlMapper.ExecuteScalarImplAsync[T](IDbConnection cnn, CommandDefinition command) in /_/Dapper/SqlMapper.Async.cs:line 1241                                                                                                                                                                                                                                  ││    at MassTransit.SqlTransport.SqlServer.SqlServerDatabaseMigrator.GrantAccess(ISqlServerSqlTransportConnection connection, SqlTransportOptions options) in /_/src/Transports/MassTransit.SqlTransport.SqlServer/SqlTransport/SqlServer/SqlServerDatabaseMigrator.cs:line 1447                                                                                            ││    at MassTransit.SqlTransport.SqlServer.SqlServerDatabaseMigrator.CreateSchemaIfNotExist(SqlTransportOptions options, CancellationToken cancellationToken) in /_/src/Transports/MassTransit.SqlTransport.SqlServer/SqlTransport/SqlServer/SqlServerDatabaseMigrator.cs:line 1391                                                                                         ││    at MassTransit.SqlTransport.SqlServer.SqlServerDatabaseMigrator.CreateSchemaIfNotExist(SqlTransportOptions options, CancellationToken cancellationToken) in /_/src/Transports/MassTransit.SqlTransport.SqlServer/SqlTransport/SqlServer/SqlServerDatabaseMigrator.cs:line 1395                                                                                         ││    at MassTransit.SqlTransport.SqlServer.SqlServerDatabaseMigrator.CreateSchemaIfNotExist(SqlTransportOptions options, CancellationToken cancellationToken) in /_/src/Transports/MassTransit.SqlTransport.SqlServer/SqlTransport/SqlServer/SqlServerDatabaseMigrator.cs:line 1395                                                                                         ││    at MassTransit.SqlTransport.SqlServer.SqlServerDatabaseMigrator.CreateDatabase(SqlTransportOptions options, CancellationToken cancellationToken) in /_/src/Transports/MassTransit.SqlTransport.SqlServer/SqlTransport/SqlServer/SqlServerDatabaseMigrator.cs:line 1340                                                                                                 ││    at MassTransit.SqlTransport.SqlTransportMigrationHostedService.StartAsync(CancellationToken cancellationToken) in /_/src/MassTransit/SqlTransport/SqlTransport/SqlTransportMigrationHostedService.cs:line 34                                                                                                                                                           ││    at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)                                                                                                                                                                                                                                                     ││    at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)                                                                                                                                                               ││    at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)                                                                                                                                                                                                                                                                          ││    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)                                                                                                                                                                                                                                                        ││    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)                                                                                                                                                                                                                                                        ││    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)                                                                                                                                                                                                                                                                                      ││    at Program.<Main>$(String[] args) in ......

Link to repository that demonstrates/reproduces the issue

No response

@MassTransit MassTransit locked and limited conversation to collaborators Jun 19, 2024
@phatboyg phatboyg converted this issue into discussion #5274 Jun 19, 2024
phatboyg added a commit that referenced this issue Jun 27, 2024
…stead of the create database, since it's required to exist.

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant