Hello
does anyone know what would be the possible causes for this error while starting up a dotnet core application within a container? Locally it works fine.
I have a c# project (dotnet core), where my Program.cs crashes on CreateHostBuilder(args).Build().Run(); and here are the docker logs:
[ERROR ] Unhandled exception. MongoDB.Driver.MongoCommandException: Command delete failed: not authorized on MY_HANGFIRE_DATABASE to execute command { delete: "hangfire.migrationLock", ordered: true, deletes: [ { q: { _id: ObjectId('5c351d07197a9bcdba4832fc') }, limit: 1 } ] }.
[ERROR ] at MongoDB.Driver.Core.WireProtocol.CommandUsingQueryMessageWireProtocol`1.ProcessReply(ConnectionId connectionId, ReplyMessage`1 reply)
[ERROR ] at MongoDB.Driver.Core.WireProtocol.CommandUsingQueryMessageWireProtocol`1.Execute(IConnection connection, CancellationToken cancellationToken)
[ERROR ] at MongoDB.Driver.Core.WireProtocol.CommandWireProtocol`1.Execute(IConnection connection, CancellationToken cancellationToken)
[ERROR ] at MongoDB.Driver.Core.Servers.Server.ServerChannel.ExecuteProtocol[TResult](IWireProtocol`1 protocol, ICoreSession session, CancellationToken cancellationToken)
[ERROR ] at MongoDB.Driver.Core.Servers.Server.ServerChannel.Command[TResult](ICoreSession session, ReadPreference readPreference, DatabaseNamespace databaseNamespace, BsonDocument command, IEnumerable`1 commandPayloads, IElementNameValidator commandValidator, BsonDocument additionalOptions, Action`1 postWriteAction, CommandResponseHandling responseHandling, IBsonSerializer`1 resultSerializer, MessageEncoderSettings messageEncoderSettings, CancellationToken cancellationToken)
[ERROR ] at MongoDB.Driver.Core.Operations.RetryableWriteCommandOperationBase.ExecuteAttempt(RetryableWriteContext context, Int32 attempt, Nullable`1 transactionNumber, CancellationToken cancellationToken)
[ERROR ] at MongoDB.Driver.Core.Operations.RetryableWriteOperationExecutor.Execute[TResult](IRetryableWriteOperation`1 operation, RetryableWriteContext context, CancellationToken cancellationToken)
[ERROR ] at MongoDB.Driver.Core.Operations.BulkUnmixedWriteOperationBase`1.ExecuteBatch(RetryableWriteContext context, Batch batch, CancellationToken cancellationToken)
[ERROR ] at MongoDB.Driver.Core.Operations.BulkUnmixedWriteOperationBase`1.ExecuteBatches(RetryableWriteContext context, CancellationToken cancellationToken)
[ERROR ] at MongoDB.Driver.Core.Operations.BulkUnmixedWriteOperationBase`1.Execute(RetryableWriteContext context, CancellationToken cancellationToken)
[ERROR ] at MongoDB.Driver.Core.Operations.BulkMixedWriteOperation.ExecuteBatch(RetryableWriteContext context, Batch batch, CancellationToken cancellationToken)
[ERROR ] at MongoDB.Driver.Core.Operations.BulkMixedWriteOperation.Execute(IWriteBinding binding, CancellationToken cancellationToken)
[ERROR ] at MongoDB.Driver.OperationExecutor.ExecuteWriteOperation[TResult](IWriteBinding binding, IWriteOperation`1 operation, CancellationToken cancellationToken)
[ERROR ] at MongoDB.Driver.MongoCollectionImpl`1.ExecuteWriteOperation[TResult](IClientSessionHandle session, IWriteOperation`1 operation, CancellationToken cancellationToken)
[ERROR ] at MongoDB.Driver.MongoCollectionImpl`1.BulkWrite(IClientSessionHandle session, IEnumerable`1 requests, BulkWriteOptions options, CancellationToken cancellationToken)
[ERROR ] at MongoDB.Driver.MongoCollectionImpl`1.UsingImplicitSession[TResult](Func`2 func, CancellationToken cancellationToken)
[ERROR ] at MongoDB.Driver.MongoCollectionImpl`1.BulkWrite(IEnumerable`1 requests, BulkWriteOptions options, CancellationToken cancellationToken)
[ERROR ] at MongoDB.Driver.MongoCollectionBase`1.DeleteOne(FilterDefinition`1 filter, DeleteOptions options, Func`2 bulkWrite)
[ERROR ] at MongoDB.Driver.MongoCollectionBase`1.DeleteOne(FilterDefinition`1 filter, DeleteOptions options, CancellationToken cancellationToken)
[ERROR ] at MongoDB.Driver.MongoCollectionBase`1.DeleteOne(FilterDefinition`1 filter, CancellationToken cancellationToken)
[ERROR ] at Hangfire.Mongo.Migration.MigrationLock.DeleteMigrationLock()
[ERROR ] at Hangfire.Mongo.Migration.MongoMigrationManager.MigrateIfNeeded(MongoStorageOptions storageOptions, IMongoDatabase database)
[ERROR ] at Hangfire.Mongo.MongoStorage..ctor(MongoClient mongoClient, String databaseName, MongoStorageOptions storageOptions)
[ERROR ] at Hangfire.Mongo.MongoBootstrapperConfigurationExtensions.UseMongoStorage(IGlobalConfiguration configuration, String connectionString, MongoStorageOptions storageOptions)
I guess it could be related to Hangfire.Mongo.Migration.MigrationLock.DeleteMigrationLock()
method, but I am not aware of Hangfire.Mongo package internals. I opened the same issue there to check if there is any insight of how to overcome this problems.
Is this totally related to user permissions?
Thanks