transloadit/uppy · critical · TypeError

[s3mini] endpoint must be a non-empty string

Error message

[s3mini] endpoint must be a non-empty string

What it means

When configuring S3mini with getCredentials (client-side SigV4 signing), a non-empty endpoint string is mandatory because the client must know the bucket URL to presign requests against. The constructor throws ERROR_ENDPOINT_REQUIRED if endpoint is missing, empty, or whitespace-only.

Source

Thrown at packages/@uppy/aws-s3/src/s3-client/S3mini.ts:72

  }: IT.S3Config) {
    super({ requestAbortTimeout })
    if ('signRequest' in rest) {
      const { signRequest } = rest
      if (!signRequest) {
        throw new TypeError(
          'Either signRequest or getCredentials must be provided',
        )
      }

      if (signRequest && typeof signRequest !== 'function') {
        throw new TypeError('signRequest must be a function')
      }

      this.signRequest = signRequest
    } else if ('getCredentials' in rest) {
      const { getCredentials, endpoint } = rest
      if (typeof endpoint !== 'string' || endpoint.trim().length === 0) {
        throw new TypeError(C.ERROR_ENDPOINT_REQUIRED)
      }
      if (getCredentials && typeof getCredentials !== 'function') {
        throw new TypeError('getCredentials must be a function')
      }
      this.endpoint = new URL(this._ensureValidUrl(endpoint))

      this.getCredentials = getCredentials
      this.signRequest = this._createCredentialBasedSigner()
    } else {
      throw new TypeError(
        'Either signRequest or getCredentials must be provided',
      )
    }

    this.region = region
    this.requestSizeInBytes = requestSizeInBytes
  }

View on GitHub (pinned to 5d4dedd02a)

Solutions

  1. Pass a full bucket endpoint like 'https://s3.us-east-1.amazonaws.com/my-bucket' or your S3-compatible host (e.g. MinIO, R2)
  2. Validate/trim the endpoint at app startup and fail fast with a clear message
  3. If you can't expose an endpoint, switch to the signRequest strategy, which needs no endpoint

Example fix

// before
new S3mini({ getCredentials }) // throws: endpoint must be a non-empty string

// after
new S3mini({
  endpoint: 'https://s3.us-east-1.amazonaws.com/my-bucket',
  getCredentials: async () => (await fetch('/api/s3/credentials')).json(),
})
Defensive patterns

Strategy: validation

Validate before calling

if (typeof endpoint !== 'string' || endpoint.trim().length === 0) {
  throw new Error('Missing S3 endpoint; set S3_ENDPOINT or equivalent')
}

Type guard

const isValidEndpoint = (e: unknown): e is string => typeof e === 'string' && e.trim().length > 0

Prevention

When it happens

Trigger: new S3mini({ getCredentials }) with no endpoint, or endpoint: ''/' ', or endpoint: undefined from a failed env read.

Common situations: Endpoint stored in an env var that isn't set locally; endpoint only configured in the signRequest flow and forgotten when switching to getCredentials; trailing/empty values from a config service.

Understand the failure class

Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.

Related errors


AI-assisted analysis of transloadit/uppy@5d4dedd02a (2026-08-28). Data as JSON: /api/errors/ecd1ac89a80312e1. Report an issue: GitHub.