nopSolutions/nopCommerce · error · Exception

Azure container name for Blob is not specified

Error message

Azure container name for Blob is not specified

What it means

Thrown by AzureThumbService.Init when AzureBlobSettings.ContainerName is null or empty. It is checked immediately after the connection string, before the container client is created.

Source

Thrown at src/Plugins/Nop.Plugin.Misc.AzureBlob/Services/AzureThumbService.cs:60

    }

    #endregion

    #region Utilities

    /// <summary>
    /// Initialize cloud container
    /// </summary>
    private void Init()
    {
        if (_isInitialized)
            return;

        if (string.IsNullOrEmpty(_azureBlobSettings.ConnectionString))
            throw new Exception("Azure connection string for Blob is not specified");

        if (string.IsNullOrEmpty(_azureBlobSettings.ContainerName))
            throw new Exception("Azure container name for Blob is not specified");

        if (string.IsNullOrEmpty(_azureBlobSettings.EndPoint))
            throw new Exception("Azure end point for Blob is not specified");

        lock (_locker)
        {
            if (_isInitialized)
                return;

            _azureBlobStorageAppendContainerName = _azureBlobSettings.AppendContainerName;
            _azureBlobStorageConnectionString = _azureBlobSettings.ConnectionString;
            _azureBlobStorageContainerName = _azureBlobSettings.ContainerName.Trim().ToLowerInvariant();
            _azureBlobStorageEndPoint = _azureBlobSettings.EndPoint.Trim().ToLowerInvariant().TrimEnd('/');

            _blobServiceClient = new BlobServiceClient(_azureBlobStorageConnectionString);
            _blobContainerClient = _blobServiceClient.GetBlobContainerClient(_azureBlobStorageContainerName);

            _blobContainerClient.CreateIfNotExistsAsync(PublicAccessType.Blob).Wait();

View on GitHub (pinned to 64bdf2ff08)

Solutions

  1. Enter the blob container name in the plugin configuration and save (the container must exist in the storage account).
  2. Confirm the container name uses valid Azure naming (lowercase, etc.) — the code later does .Trim().ToLowerInvariant().
  3. Save settings for the correct store scope.

Example fix

// before: ContainerName = ""
// after:
settings.ContainerName = "media"; // existing container in the storage account
await _settingService.SaveSettingAsync(settings, storeScope);
Defensive patterns

Strategy: validation

Validate before calling

if (string.IsNullOrEmpty(_azureBlobSettings.ContainerName))
    throw new InvalidOperationException("Configure the Azure Blob container name before use.");

Type guard

static bool HasContainerName(AzureBlobSettings s) => !string.IsNullOrWhiteSpace(s.ContainerName);

Try / catch

try { _azureThumbService.GetThumbUrl(...); }
catch (Exception ex) when (ex.Message.Contains("container name for Blob"))
{ logger.Error("Azure Blob container name missing.", ex); }

Prevention

When it happens

Trigger: The Azure Blob plugin is configured with a connection string but the container name field was left blank. Init runs on first picture/thumb operation routed to the Azure service.

Common situations: Admin saved only the connection string; container name typed with only spaces; settings saved to the wrong store scope.

Related errors


AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13). Data as JSON: /api/errors/fd1500abc6dfa2a4. Report an issue: GitHub.