instructure/canvas-lms · error · Canvas::Migration::Error

A partner key is required to use Academic Benchmarks

Error message

A partner key is required to use Academic Benchmarks

What it means

Canvas::Migration::Error raised in Converter#export when no archive file is supplied and neither a settings partner_key nor the plugin-configured partner key (AcademicBenchmark.ensure_partner_key) is present. The partner key is the API secret paired with the partner ID.

Solutions

  1. Set partner_key in the academic_benchmark plugin settings or pass it in the converter settings.
  2. Verify both partner_id and partner_key are configured together.
  3. Supply an archive_file to skip the API path entirely.
  4. Confirm the environment variable feeding the key is present on the job-running host.

Example fix

// before
settings = { content_migration: cm, partner_id: pid }
converter = AcademicBenchmark::Converter.new(settings)
// after
settings = { content_migration: cm, partner_id: pid, partner_key: ENV['AB_PARTNER_KEY'] }
converter = AcademicBenchmark::Converter.new(settings)
Defensive patterns

Strategy: validation

Validate before calling

cfg = AcademicBenchmark.config || {}
unless settings[:archive_file] || settings[:partner_key].present? || cfg[:partner_key].present?
  raise 'configure partner_key or provide an archive file'
end

Try / catch

begin
  converter.export
rescue Canvas::Migration::Error => e
  Rails.logger.error("AB key missing: #{e.message}")
end

Prevention

When it happens

Trigger: API-based standards export (no archive_file) where partner_id resolves (or its check passed) but @partner_key is blank and AcademicBenchmark.config[:partner_key] is nil.

Common situations: Partner ID configured but key field left blank; key stored only in ENV on a host where the env var is unset; settings hash passing partner_id but not partner_key.

Related errors


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

Appendix: source

Thrown at gems/plugins/academic_benchmark/lib/academic_benchmark/converter.rb:46

      @partner_id = settings[:partner_id]
      @partner_key = settings[:partner_key]
    end

    def export
      unless content_migration
        raise Canvas::Migration::Error,
              "Missing required content_migration settings"
      end
      unless Account.site_admin.grants_right?(content_migration.user, :manage_global_outcomes)
        raise Canvas::Migration::Error,
              "User isn't allowed to edit global outcomes"
      end
      unless @archive_file
        unless @partner_id.present? || AcademicBenchmark.ensure_partner_id.nil?
          raise Canvas::Migration::Error, I18n.t("A partner ID is required to use Academic Benchmarks")
        end
        unless @partner_key.present? || AcademicBenchmark.ensure_partner_key.nil?
          raise Canvas::Migration::Error, I18n.t("A partner key is required to use Academic Benchmarks")
        end
      end
      if outcome_data.present?
        if outcome_data.instance_of? AcademicBenchmarks::Standards::StandardsForest
          outcome_data.trees.each do |t|
            @course[:learning_outcomes] << t.root.build_outcomes(@ratings_overrides)
          end
        else
          @course[:learning_outcomes] << outcome_data.root.build_outcomes(@ratings_overrides)
        end
      end
      save_to_file
      @course
    end

    def post_process; end

    private

View on GitHub (pinned to 1c9f0bb801)