instructure/canvas-lms · error · InvalidConfig

No region specified for: #

Error message

No region specified for: #{category.inspect}

What it means

Canvas::DynamoDB::DatabaseBuilder.validate_config checks that a DynamoDB table configuration for a given category includes a table prefix and an AWS region. This error is raised as Canvas::DynamoDB::InvalidConfig when config[:region] is blank, meaning Canvas cannot determine which AWS region to create/connect to tables in.

Solutions

  1. Add a region key (e.g. us-east-1) to the category's config in config/dynamodb.yml for the active Rails environment
  2. Inherit region from the defaults section of dynamodb.yml so all environments/categories get it
  3. Verify the config actually loaded: check Canvas::DynamoDB.config for the category before booting jobs
  4. If using DynamicSettings/consul overrides, ensure the merged value includes region

Example fix

# before (config/dynamodb.yml)
production:
  live_events:
    table_prefix: canvas-live-events
// after
production:
  live_events:
    table_prefix: canvas-live-events
    region: us-east-1
Defensive patterns

Strategy: validation

Validate before calling

cfg = Canvas::DynamoDB.config_for(category) rescue nil
raise 'region missing' unless cfg && cfg[:region].present?

Type guard

valid = cfg.respond_to?(:[]) && cfg[:region].present?

Try / catch

begin
  Canvas::DynamoDB::DatabaseBuilder.read_table_config(category)
rescue Canvas::DynamoDB::InvalidConfig => e
  Rails.logger.fatal(e.message)
  raise
end

Prevention

When it happens

Trigger: Calling Canvas::DynamoDB::DatabaseBuilder.configure/validate_config with a config hash lacking :region, typically from dynamodb.yml environment entries missing a region key for the current Rails environment or a category.

Common situations: Incomplete dynamodb.yml after upgrade, environment-specific overrides omitting region, per-category config with only table_name/table_prefix set, AWS region not set in defaults block.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15). Data as JSON: /api/errors/16abb1e01de1de65. Report an issue: GitHub.

Appendix: source

Thrown at lib/canvas/dynamo_db/database_builder.rb:71

            @clients[key] = CanvasDynamoDB::Database.new(
              fingerprint,
              prefix: config[:table_prefix],
              client_opts: opts,
              logger: Rails.logger
            )
          rescue => e
            Rails.logger.error "Failed to create DynamoDB client for #{key}: #{e}"
            nil # don't save this nil into @clients[key], so we can retry later
          end
        end
      end

      def self.validate_config(config)
        unless config[:table_prefix].present?
          raise InvalidConfig, "No table prefix specified for: #{category.inspect}"
        end
        unless config[:region].present?
          raise InvalidConfig, "No region specified for: #{category.inspect}"
        end
      end

      def self.default_environment
        Rails.env
      end

      def self.configs(environment = default_environment)
        ConfigFile.load("dynamodb", environment) || {}
      end

      def self.categories
        configs.keys
      end
    end
  end
end

View on GitHub (pinned to 1c9f0bb801)