server icon indicating copy to clipboard operation
server copied to clipboard

Cloud Hooks - wrong url in Slack

Open semcha opened this issue 3 years ago • 2 comments

Description

In Slack notification from Cloud Hooks URL always like http://localhost:4200 /default/flow-run/1c4340de-b1df-442d-832e-9d5687ce431b regardless of settings.

Expected Behavior

URL in notification like http://<my_ui_host>:<my_ui_port>

Reproduction

config.toml:

[server]
  host="http://myhost"
  [server.ui]
  host="http://myhost"
  apollo_url="http://myhost:4200/graphql"

Environment

  "config_overrides": {
    "server": {
      "host": true,
      "ui": {
        "apollo_url": true,
        "host": true
      }
    }
  },
  "env_vars": [],
  "system_information": {
    "platform": "Linux-5.4.0-70-generic-x86_64-with-glibc2.29",
    "prefect_backend": "server",
    "prefect_version": "0.14.14",
    "python_version": "3.8.5"
  }
}

semcha avatar Apr 05 '21 15:04 semcha

prefect config output:

{
   "debug":false,
   "home_dir":"/home/admin/.prefect",
   "backend":"server",
   "server":{
      "host":"http://myhost",
      "port":4200,
      "host_port":4200,
      "endpoint":"http://myhost:4200",
      "database":{
         "host":"localhost",
         "port":5432,
         "host_port":5432,
         "name":"prefect_server",
         "username":"prefect",
         "password":"test-password",
         "connection_url":"postgresql://prefect:pwd@localhost:5432/prefect_server",
         "volume_path":"/home/admin/.prefect/pg_data"
      },
      "graphql":{
         "host":"0.0.0.0",
         "port":4201,
         "host_port":4201,
         "debug":false,
         "path":"/graphql/"
      },
      "hasura":{
         "host":"localhost",
         "port":3000,
         "host_port":3000,
         "admin_secret":"",
         "claims_namespace":"hasura-claims",
         "graphql_url":"http://localhost:3000/v1alpha1/graphql",
         "ws_url":"ws://localhost:3000/v1alpha1/graphql",
         "execute_retry_seconds":10
      },
      "ui":{
         "host":"http://myhost",
         "port":8080,
         "host_port":8080,
         "endpoint":"http://myhost:8080",
         "apollo_url":"http://myhost:4200/graphql"
      },
      "telemetry":{
         "enabled":true
      }
   },
   "cloud":{
      "api":"http://myhost:4200",
      "endpoint":"https://api.prefect.io",
      "graphql":"http://myhost:4200/graphql",
      "use_local_secrets":true,
      "heartbeat_interval":30.0,
      "check_cancellation_interval":15.0,
      "diagnostics":false,
      "request_timeout":15,
      "logging_heartbeat":5,
      "queue_interval":30.0,
      "agent":{
         "name":"agent",
         "labels":[
            
         ],
         "level":"INFO",
         "auth_token":"",
         "agent_address":"",
         "resource_manager":{
            "loop_interval":60
         }
      }
   },
   "logging":{
      "level":"INFO",
      "format":"[%(asctime)s] %(levelname)s - %(name)s | %(message)s",
      "log_attributes":[
         
      ],
      "datefmt":"%Y-%m-%d %H:%M:%S%z",
      "log_to_cloud":false,
      "extra_loggers":[
         
      ]
   },
   "flows":{
      "eager_edge_validation":false,
      "run_on_schedule":true,
      "checkpointing":false,
      "defaults":{
         "storage":{
            "add_default_labels":true,
            "default_class":"prefect.storage.Local"
         }
      }
   },
   "tasks":{
      "defaults":{
         "max_retries":0,
         "retry_delay":null,
         "timeout":null
      }
   },
   "engine":{
      "executor":{
         "default_class":"prefect.executors.LocalExecutor",
         "dask":{
            "address":"",
            "cluster_class":"distributed.deploy.local.LocalCluster"
         }
      },
      "flow_runner":{
         "default_class":"prefect.engine.flow_runner.FlowRunner"
      },
      "task_runner":{
         "default_class":"prefect.engine.task_runner.TaskRunner"
      }
   }
}

semcha avatar Apr 05 '21 15:04 semcha

Hi, this appears to be set to the value of https://github.com/PrefectHQ/server/blob/master/src/prefect_server/config.toml#L21-L22

per

https://github.com/PrefectHQ/server/blob/7e059924939458b91536ab43799987bbb4b42b11/src/prefect_server/api/cloud_hooks.py#L260-L263

which does indeed appear to be incorrect.

You could override it with PREFECT_SERVER__API__URL=foo but that may break other things. This ought to be pulling the UI url from the Prefect Core config rather than the Server config.

I'll transfer this issue to the Server repo.

zanieb avatar Apr 05 '21 16:04 zanieb