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

partner_id & partner_key are required

Error message

partner_id & partner_key are required

What it means

Canvas::Migration::Error raised in OutcomeData::FromApi#initialize when, after merging AcademicBenchmark.config into the options, partner_id or partner_key is blank. The API client cannot authenticate against the Academic Benchmarks service without both credentials.

Solutions

  1. Configure both partner_id and partner_key in the academic_benchmark plugin settings.
  2. Pass them explicitly: OutcomeData.load_data(authority: x, partner_id: pid, partner_key: key).
  3. Verify AcademicBenchmark.config returns non-blank values in the environment where the job runs.
  4. If data is available locally, use the archive_file path to avoid the API entirely.

Example fix

// before
OutcomeData::FromApi.new(authority: 'XYZ')
// after
OutcomeData::FromApi.new(authority: 'XYZ', partner_id: config[:partner_id], partner_key: config[:partner_key])
Defensive patterns

Strategy: validation

Validate before calling

merged = options.merge(AcademicBenchmark.config || {})
unless merged[:partner_id].present? && merged[:partner_key].present?
  raise 'partner_id & partner_key must be configured'
end

Try / catch

begin
  data = OutcomeData::FromApi.new(options).data
rescue Canvas::Migration::Error => e
  Rails.logger.error("AB API unavailable: #{e.message}")
end

Prevention

When it happens

Trigger: Constructing OutcomeData::FromApi (via load_data with authority/publication options) where options lack partner_id/partner_key and the academic_benchmark plugin config does not supply them.

Common situations: Unconfigured plugin in a new environment; config present but keys empty strings; passing options that don't include credentials and expecting config to fill them when it can't.

Related errors


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

Appendix: source

Thrown at gems/plugins/academic_benchmark/lib/academic_benchmark/outcome_data/from_api.rb:26

# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.

module AcademicBenchmark
  module OutcomeData
    class FromApi < Base
      def initialize(options = {})
        super(options.merge(AcademicBenchmark.config))
        unless partner_id.present? && partner_key.present?
          raise Canvas::Migration::Error,
                "partner_id & partner_key are required"
        end
      end
      delegate :authority, :publication, :partner_id, :partner_key, to: :@options

      def data
        @data ||= api.standards.send(api_method, guid, include_obsolete_standards: false, exclude_examples: true)
      end

      def error_message
        "Couldn't update standards for guid '#{guid}'"
      end

      private

      def api
        @_api ||= AcademicBenchmarks::Api::Handle.new(
          partner_id:,

View on GitHub (pinned to 1c9f0bb801)