instructure/canvas-lms · warning

Could not send slack message without configured key

Error message

Could not send slack message without configured key

What it means

Message#deliver determines the path_type (email, sms, slack, ...). For slack messages, the root account must have an encrypted_slack_key in its settings; if absent, it logs this warning and returns nil, so the notification is silently never sent. It is a guard against dispatching Slack messages with no configured credential.

Solutions

  1. Configure the Slack integration on the root account so settings[:encrypted_slack_key] is set (complete the Slack app setup in account settings)
  2. If Slack should not be used, remove/disable the Slack contact-channel/notification policy for affected users
  3. Check which account the message's context resolves to — the key must exist on that root account, not just the default
  4. Re-queue/resend the affected notification after configuring the key

Example fix

// before
# account.settings has no :encrypted_slack_key; message dropped
// after
acct.settings[:encrypted_slack_key] = Canvas::Security.encrypt_text(slack_signing_secret)
acct.save!
Defensive patterns

Strategy: validation

Validate before calling

def slack_configured?(message)
  message.context_root_account.settings[:encrypted_slack_key].present?
end
# gate Slack notification policies on this check

Try / catch

begin
  message.deliver
rescue => e
  Canvas::Errors.capture(e, message_id: message.id)
end

Prevention

When it happens

Trigger: A notification policy routes a message to a Slack path while context_root_account.settings[:encrypted_slack_key] is unset — Slack notification type enabled without completing Slack integration setup on the account.

Common situations: Admin turned on Slack notifications but skipped key configuration; account settings cloned/exported without the encrypted key; multi-tenant setups where only some accounts have Slack configured; keys removed during secret rotation.

Related errors


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

Appendix: source

Thrown at app/models/message.rb:735

    @i18n_scope = nil
  end
  # rubocop:enable Security/Eval

  # Public: Deliver this message.
  #
  # Returns nothing.
  def deliver
    # don't dispatch canceled or already-sent messages.
    return nil unless dispatch

    unless path_type.present?
      logger.warn "Could not find a path type for #{inspect}"
      return nil
    end

    if path_type == "slack" && !context_root_account.settings[:encrypted_slack_key]
      logger.warn("Could not send slack message without configured key")
      return nil
    end

    check_acct = infer_feature_account

    return skip_and_cancel if path_type == "sms"

    if path_type == "push" &&
       (Notification.types_to_send_in_push.exclude?(notification_name) || !check_acct.enable_push_notifications?)
      return skip_and_cancel
    end

    InstStatsd::Statsd.distributed_increment("message.deliver.#{path_type}.#{notification_name}",
                                             short_stat: "message.deliver",
                                             tags: { path_type:, notification_name: })

    global_account_id = Shard.global_id_for(root_account_id, shard)
    InstStatsd::Statsd.increment("message.deliver.#{path_type}.#{global_account_id}",

View on GitHub (pinned to 1c9f0bb801)