<@ULVA73B9P> we use prefect in self-hosting on top...
# ask-marvin
s
@Marvin we use prefect in self-hosting on top of kuberentes. in slack notification integration we get alert that look like: Prefect flow run notification Flow run weaviate-insert-ludeos-flow/omniscient-dolphin entered state
Crashed
at 2024-07-14T133141.715475+00:00. Flow ID: 7b2f9c08-684e-4cf5-b7c8-d2b933d523f1 Flow run ID: f1d40ae9-fb50-4994-ab0a-e5f9da703473 Flow run URL: http://localhost:4200/flow-runs/flow-run/f1d40ae9-fb50-4994-ab0a-e5f9da703473 the problem is we get this URL link: http://localhost:4200/flow-runs/flow-run/f1d40ae9-fb50-4994-ab0a-e5f9da703473 expected as our prefect_api_url : http://prefect-ui.stg.ludeo.com/api any help on it?
m
The issue you're facing with the URL in Slack notifications seems to be a common problem with URL configurations in self-hosted Prefect setups. Your Slack notification is showing
localhost
instead of your specified
prefect_api_url
. ### Solutions and Workarounds: 1. Configure Base URL with Environment Variables: Ensure that your Prefect deployment configuration has the correct base URL settings. The URL should be set in the environment variables or the configuration file under
PREFECT_API_URL
.
Copy code
yaml
   environment:
     - PREFECT_API_URL: <http://prefect-ui.stg.ludeo.com/api>
2. Update Prefect UI Configuration: Verify that your Prefect UI configuration is also set correctly, as it might be defaulting to
localhost
. 3. Check Prefect Settings: Review the notification settings you have configured on the Notification page within Prefect: - Navigate to the Notifications page - Edit the notification to ensure it isn’t hardcoded with
localhost
4. Custom Notification: Consider customizing your notification messages. Add a way to dynamically construct the URL based on the environment you are working in. This would involve creating a custom Slack notification template that reads from a configuration file or environment variables. Example:
Copy code
python
   import os

   prefect_api_url = os.getenv('PREFECT_API_URL', '<http://default-url.com>')
   flow_run_url = f"{prefect_api_url}/flow-runs/flow-run/{flow_run_id}"
For further details, you can also refer to the Prefect documentation on how to set up and customize notifications: https://docs.prefect.io/latest/guides/host/ Additionally, there are associated GitHub issues that might be relevant: - GitHub issue on page refresh and wrong resource address: (https://github.com/PrefectHQ/prefect/issues/10807) - GitHub issue on customizing notification messages: (https://github.com/PrefectHQ/prefect/issues/9291) I hope this helps solve the problem with your Slack notification URLs.