You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Dapper to connect to a MySQL database for data queries. The project runs fine locally, but when I deploy it to AWS EKS, the service starts up normally. However, when I start making requests to the service's gRPC interface for data queries, I get a NullReferenceException on the first request to the same interface, but subsequent requests are fine.
When I wait for a longer period of time and then make a request to the same interface again, I occasionally get the NullReferenceException again.
System.NullReferenceException: Object reference not set to an instance of an object.
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReaderAsync(CommandBehavior behavior, Boolean execAsync, CancellationToken cancellationToken)
at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQueryAsync(Boolean execAsync, CancellationToken cancellationToken)
at Dapper.SqlMapper.ExecuteMultiImplAsync(IDbConnection cnn, CommandDefinition command, IEnumerable multiExec) in /_/Dapper/SqlMapper.Async.cs:line 640
System.NullReferenceException: Object reference not set to an instance of an object.
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReaderAsync(CommandBehavior behavior, Boolean execAsync, CancellationToken cancellationToken)
at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQueryAsync(Boolean execAsync, CancellationToken cancellationToken)
at Dapper.SqlMapper.ExecuteImplAsync(IDbConnection cnn, CommandDefinition command, Object param) in /_/Dapper/SqlMapper.Async.cs:line 662
at Dapper.DapperExtensions.ExecuteAsync(IDbConnection conn, ExCommand[] cmdJoined) in /src/TradingApp.Data/Extensions/Dapper/DapperExtensions.cs:line 75
Any suggestion here?
The text was updated successfully, but these errors were encountered:
While the information shared here is helpful, this looks like an implementation detail issue. If the application works fine locally and doesn't work when deployed, one of the following may be causing it:
The databases you have locally and remote might be different. If you are referring to a stored procedure, a view or a table it might not exist.
Some issue with GetConnection() method, which provides incorrect connection parameters to it.
Without further information, it's impossible to dig deeper into this.
I'm using Dapper to connect to a MySQL database for data queries. The project runs fine locally, but when I deploy it to AWS EKS, the service starts up normally. However, when I start making requests to the service's gRPC interface for data queries, I get a NullReferenceException on the first request to the same interface, but subsequent requests are fine.
When I wait for a longer period of time and then make a request to the same interface again, I occasionally get the NullReferenceException again.
Here are some information of env:
Mysql: 8.0.35
connectionString: Server=xxx;port=3306;user=xx;password=xxx;database=xxx;CharSet=utf8mb4;pooling=true;
At first, I suspected that it was an issue with the connection pool initialization, so I tried the following methods, but they didn't work:
The exception log is below:
Any suggestion here?
The text was updated successfully, but these errors were encountered: