{"record":{"id":"477a673ab23a3257","repo":"instructure/canvas-lms","slug":"googledrive-is-not-configured","errorCode":null,"errorMessage":"GoogleDrive is not configured","messagePattern":"GoogleDrive is not configured","errorType":"exception","errorClass":"GoogleDrive::ConnectionException","httpStatus":null,"severity":"error","filePath":"gems/google_drive/lib/google_drive/connection.rb","lineNumber":137,"sourceCode":"      @config.call\n    end\n\n    private\n\n    def exception_message(exception)\n      return \"Google Drive connection timed out\" if exception.cause.is_a?(Faraday::TimeoutError)\n\n      JSON.parse(exception.body).dig(\"error\", \"message\")\n    rescue JSON::ParserError, TypeError\n      exception.message\n    end\n\n    def normalize_document_id(doc_id)\n      doc_id.gsub(/^.+:/, \"\")\n    end\n\n    def drive\n      raise ConnectionException, \"GoogleDrive is not configured\" if GoogleDrive::Connection.config.nil?\n      raise NoTokenError unless @refresh_token && @access_token\n\n      @drive ||= GoogleDrive::Client.create(GoogleDrive::Connection.config, @refresh_token, @access_token).tap do |drive|\n        drive.client_options.open_timeout_sec =\n          drive.client_options.send_timeout_sec =\n            drive.client_options.read_timeout_sec = @timeout\n        drive.request_options.retries = @retries\n      end\n    end\n  end\nend\n","sourceCodeStart":119,"sourceCodeEnd":149,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/gems/google_drive/lib/google_drive/connection.rb#L119-L149","documentation":"GoogleDrive::Connection#drive builds the memoized Google Drive API client, but only when global GoogleDrive config (a Proc set via Connection.config=) exists. If GoogleDrive::Connection.config is nil — the integration was never configured at boot — it raises ConnectionException before touching tokens or the API.","triggerScenarios":"Calling drive (directly or via file/folder methods) on a Canvas instance where the google_drive config Proc was never set (e.g. config/google_drive.yml missing or empty so Connection.config was never assigned).","commonSituations":"Environment without the Google Drive config file; config file present but blank/invalid so initialization skipped; using Google Drive features on a node where config loading failed.","solutions":["Provide config/google_drive.yml (client_id, client_secret, redirect_uri, etc.) so GoogleDrive::Connection.config gets set at boot","Restart the app after adding the config so initializers populate Connection.config","Verify the config file parses and contains the expected keys before deploying","Guard usage: check GoogleDrive::Connection.config before calling drive and surface a friendly 'not configured' message"],"exampleFix":"// before\ndocs = GoogleDrive::Connection.new(refresh_token, user).list\n// after\nif GoogleDrive::Connection.config.nil?\n  docs = []\nelse\n  docs = GoogleDrive::Connection.new(refresh_token, user).list\nend","handlingStrategy":"type-guard","validationCode":"raise 'GoogleDrive not configured' if GoogleDrive::Connection.config.nil?","typeGuard":"def google_drive_ready?\n  !GoogleDrive::Connection.config.nil?\nend","tryCatchPattern":"begin\n  conn.drive\nrescue ConnectionException => e\n  raise unless e.message.include?('not configured')\n  Rails.logger.error('Add config/google_drive.yml')\nend","preventionTips":["Deploy config/google_drive.yml to all environments","Smoke-test Google Drive after provisioning","Fail fast in initializer if config is mandatory"],"tags":["google-drive","configuration","missing-config"],"backgroundTag":"missing-required-config","analyzedSha":"1c9f0bb8013ed69c4f2efe11fd483025469b7e6c","analyzedAt":"2026-09-15T20:33:18.891Z","contentChangedAt":"2026-09-15T20:33:18.891Z","schemaVersion":2},"datasetVersion":"2026-09-23T02:17:17.105Z"}