I'm running the prefect service (v.2.8.3) in a con...
# prefect-community
w
I'm running the prefect service (v.2.8.3) in a container and I'm getting this error when trying to access the web service from another domain. I found this issue reporting the same error but no solution. I've also tried setting the
PREFECT_API_URL
variable to `0.0.0.0:4200/ap`i , but it's simply ignored. Is there any solution for this? issue: https://github.com/PrefectHQ/prefect/issues/5648
z
w
even passing the
--host
flag or declaring the
PREFECT_SERVER_API_HOST
setting to
0.0.0.0
the error persists
z
The API URL should not be
0.0.0.0
You’ll want that to be an actual URL that the API can be reached at from the UI user’s machine
w
sure, but even changing to mydomain.com it returns:
Copy code
Can't connect to Server API at <http://127.0.0.1:4200/api>. Check that it's accessible from your machine.
apparently no variable is changing this value as anything I change keeps showing the IP 127.0.0.1
Remembering that I'm running the service inside a container
resolved by setting in Dockerfile
Copy code
ENV PREFECT_SERVER_API_HOST=<http://mydomain.com|mydomain.com>"
instead of directly inside the container
Copy code
prefect config PREFECT_SERVER_API_HOST="<http://mydomain.com|mydomain.com>"
1
z
Copy code
PREFECT_UI_API_URL = Setting(
    str,
    default=None,
    value_callback=default_ui_api_url,
)
"""The connection url for communication from the UI to the API.
Defaults to `PREFECT_API_URL` if set. Otherwise, the default URL is generated from
`PREFECT_SERVER_API_HOST` and `PREFECT_SERVER_API_PORT`. If providing a custom value,
the aforementioned settings may be templated into the given string.
"""
gratitude thank you 1