dotnet/orleans · error · ArgumentNullException

dataConnectionString

Error message

dataConnectionString

What it means

Thrown by SQSAdapterReceiver.Create when dataConnectionString is null or empty. The receiver needs AWS connectivity info (region/credentials) to construct its underlying SQSStorage; an empty string cannot be parsed into access key, secret key, or service region.

Source

Thrown at src/AWS/Orleans.Streaming.SQS/Streams/SQSAdapterReceiver.cs:31

{
    /// <summary>
    /// Receives batches of messages from a single partition of a message queue.
    /// </summary>
    internal partial class SQSAdapterReceiver : IQueueAdapterReceiver
    {
        private SQSStorage? queue;
        private long lastReadMessage;
        private Task? outstandingTask;
        private readonly ILogger logger;
        private readonly Serializer<SQSBatchContainer> serializer;


        public QueueId Id { get; private set; }

        public static IQueueAdapterReceiver Create(Serializer<SQSBatchContainer> serializer, ILoggerFactory loggerFactory, QueueId queueId, string dataConnectionString, string serviceId)
        {
            if (queueId.IsDefault) throw new ArgumentNullException(nameof(queueId));
            if (string.IsNullOrEmpty(dataConnectionString)) throw new ArgumentNullException(nameof(dataConnectionString));
            if (string.IsNullOrEmpty(serviceId)) throw new ArgumentNullException(nameof(serviceId));

            var queue = new SQSStorage(loggerFactory, queueId.ToString(), dataConnectionString, serviceId);
            return new SQSAdapterReceiver(serializer, loggerFactory, queueId, queue);
        }

        private SQSAdapterReceiver(Serializer<SQSBatchContainer> serializer, ILoggerFactory loggerFactory, QueueId queueId, SQSStorage queue)
        {
            if (queueId.IsDefault) throw new ArgumentNullException(nameof(queueId));
            if (queue == null) throw new ArgumentNullException(nameof(queue));

            Id = queueId;
            this.queue = queue;
            logger = loggerFactory.CreateLogger<SQSAdapterReceiver>();
            this.serializer = serializer;
        }

        public Task Initialize(TimeSpan timeout)

View on GitHub (pinned to fca799fa70)

Solutions

  1. Provide a valid DataConnectionString in SQSOptions before the receiver is created.
  2. Verify the stream provider configuration section is bound correctly at silo startup.
  3. Add an IConfigurationValidator that checks DataConnectionString is non-empty.
  4. Confirm secrets/env vars are resolved into the connection string before hosting builds the receiver.

Example fix

// before
var rcv = SQSAdapterReceiver.Create(serializer, lf, queueId, "", svc); // throws

// after
var rcv = SQSAdapterReceiver.Create(serializer, lf, queueId, connStr, svc);
Defensive patterns

Strategy: validation

Validate before calling

if (string.IsNullOrEmpty(dataConnectionString))
    throw new ArgumentException("SQS DataConnectionString is required.", nameof(dataConnectionString));

Type guard

static bool IsValidSqsConnectionString(string? s) => !string.IsNullOrWhiteSpace(s);

Try / catch

try { /* create receiver */ }
catch (ArgumentNullException ex) when (ex.ParamName == "dataConnectionString")
{
    logger.LogCritical("SQS receiver missing DataConnectionString.");
    throw;
}

Prevention

When it happens

Trigger: Creating an SQSAdapterReceiver without passing a valid connection string, usually because the adapter forwarded a null/empty DataConnectionString from misconfigured SQSOptions.

Common situations: Missing DataConnectionString in stream provider config; the adapter's DataConnectionString field was never set; config binding silently produced an empty string; environment-specific config not loaded.

Related errors


AI-assisted analysis of dotnet/orleans@fca799fa70 (2026-08-13). Data as JSON: /api/errors/b2c01de0b71492ec. Report an issue: GitHub.