@@ -945,19 +945,24 @@ def incident_create_flow(*, organization_slug: str, incident_id: int, db_session
945945
946946 # we page the incident commander based on incident priority
947947 if incident .incident_priority .page_commander :
948- service_id = incident .commander .service .external_id
949- oncall_plugin = plugin_service .get_active_instance (
950- db_session = db_session , project_id = incident .project .id , plugin_type = "oncall"
951- )
952- if oncall_plugin :
953- oncall_plugin .instance .page (
954- service_id = service_id ,
955- incident_name = incident .name ,
956- incident_title = incident .title ,
957- incident_description = incident .description ,
948+ if incident .commander .service :
949+ service_id = incident .commander .service .external_id
950+ oncall_plugin = plugin_service .get_active_instance (
951+ db_session = db_session , project_id = incident .project .id , plugin_type = "oncall"
958952 )
953+ if oncall_plugin :
954+ oncall_plugin .instance .page (
955+ service_id = service_id ,
956+ incident_name = incident .name ,
957+ incident_title = incident .title ,
958+ incident_description = incident .description ,
959+ )
960+ else :
961+ log .warning ("Incident commander not paged. No plugin of type oncall enabled." )
959962 else :
960- log .warning ("Incident commander not paged. No plugin of type oncall enabled." )
963+ log .warning (
964+ "Incident commander not paged. No relationship between commander and an oncall service."
965+ )
961966
962967 # we send a message to the incident commander with tips on how to manage the incident
963968 send_incident_management_help_tips_message (incident , db_session )
0 commit comments