instructure/canvas-lms · error · Common::ConfigurationError
PV5 is not configured for this environment
Error message
PV5 is not configured for this environment
What it means
PageViews::Configuration loads the 'pv5' config file (config/page_views.yml via ConfigFile). Its constructor raises Common::ConfigurationError with 'PV5 is not configured for this environment' when no pv5 config is present, because the service cannot know where to send page view events.
Solutions
- Add a pv5 config (config/page_views.yml or environment config store) with at least a 'uri' key for the current Rails env.
- Confirm ConfigFile can load the file: check RAILS_ENV section naming in the YAML.
- If PV5 is intentionally off, guard callers with PageViews::Configuration.configured? before constructing.
- Deploy the pv4->pv5 config migration to the environment if this is a rollout issue.
Example fix
# before PageViews::Configuration.new # raises: PV5 is not configured # after PageViews::Configuration.new if PageViews::Configuration.configured? # and add config/page_views.yml: # production: # uri: https://pageviews.example.com/notifications
Defensive patterns
Strategy: fallback
Validate before calling
raise 'pv5 not configured' unless PageViews::Configuration.configured?
Try / catch
begin PageViews::Configuration.new(region: region) rescue Common::ConfigurationError => e Rails.logger.warn(e.message) fall_back_to_no_op_page_view_logger end
Prevention
- Check PageViews::Configuration.configured? before constructing
- Ship config/page_views.yml with a uri for every Rails env
- Add a boot-time check that pv5 config loads in environments where PV5 is required
- Coordinate pv5 config deployment with the code rollout
When it happens
Trigger: Instantiating PageViews::Configuration.new (directly or via addInstance/removeInstance) in an environment where ConfigFile.load('pv5') returns nil — no pv5 config file loaded, empty config, or the environment's Rails env has no pv5 key.
Common situations: Local/dev or test environments without config/page_views.yml; pv5 config not deployed to the environment via config store; YAML key mismatch (wrong env section); PV5 feature disabled intentionally but code still constructs the client.
Understand the failure class
Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.
Related errors
- Invalid URI in pv5 config: #
- an object with an interface for loading settings must be…
- an object with an interface for loading settings must be…
- Invalid mode: #
- invalid request
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/62da7e19d6d6d007.
Report an issue: GitHub.
Appendix: source
Thrown at app/services/page_views/configuration.rb:30
# 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 PageViews
class Configuration
attr_reader :uri
def self.configured?
ConfigFile.load("pv5").present?
end
def initialize(region: nil)
config = ConfigFile.load("pv5")
raise Common::ConfigurationError, "PV5 is not configured for this environment" unless config.present?
regional_config = get_regional_config(config, region) || {}
@uri = URI.parse(regional_config["uri"] || config["uri"])
rescue URI::InvalidURIError => e
raise Common::ConfigurationError, "Invalid URI in pv5 config: #{e.message}"
end
private
def get_regional_config(config, region)
return unless config["regions"].is_a?(Hash)
regional_config = config["regions"][region]
return unless regional_config.is_a?(Hash)
regional_config
end
endView on GitHub (pinned to 1c9f0bb801)