Open Closed

Minio System.NullReferenceException : 'Object reference not set to an instance of an object.' #3267


0
berly created
  • ABP Framework version: v5.3
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace: System.NullReferenceException : 'Object reference not set to an instance of an object.'

I do the same in my 5.2 project and work. I dont understand.


5 Answer(s)
  • 0
    berly created

    I tried with a new project, exactly the same error.

  • 0
    EngincanV created
    Support Team

    Hi @berly, thanks for reporting. I'll check and write you back asap.

  • 1
    maliming created
    Support Team

    hi

    Use the below code to fix the problem, We will fix it in abp framework.

    Configure<AbpBlobStoringOptions>(options =>
    {
        options.Containers.Configure<PhotoContainer>(container =>
        {
            container.UseMinio(minio =>
            {
                minio.EndPoint = "localhost:9000"; // your minio endPoint
                minio.AccessKey = "minioadmin"; // your minio accessKey
                minio.SecretKey = "minioadmin"; // your minio secretKey
                minio.BucketName = "photo";
    
                minio.CreateBucketIfNotExists = true;
            });
    
            container.ProviderType = typeof(MyMinioBlobProvider);
        });
    }
    
    using Minio;
    using Volo.Abp.BlobStoring;
    using Volo.Abp.BlobStoring.Minio;
    
    namespace KlicKlac;
    
    public class MyMinioBlobProvider : MinioBlobProvider
    {
    
        public MyMinioBlobProvider(
            IMinioBlobNameCalculator minioBlobNameCalculator,
            IBlobNormalizeNamingService blobNormalizeNamingService)
            : base(minioBlobNameCalculator, blobNormalizeNamingService)
        {
        }
    
        protected override MinioClient GetMinioClient(BlobProviderArgs args)
        {
            var configuration = args.Configuration.GetMinioConfiguration();
    
            var client = new MinioClient()
                .WithEndpoint(configuration.EndPoint)
                .WithCredentials(configuration.AccessKey, configuration.SecretKey);
    
            if (configuration.WithSSL)
            {
                client.WithSSL();
            }
    
            return client.Build();;
        }
    }
    
    
  • 0
    berly created

    It works good, can you close the ticket? Are you refunding the issue as it is a bug?

  • 1
    maliming created
    Support Team

    Question Credits Refunded