hey all! Does anyone know how to specify these two...
# ask-community
k
hey all! Does anyone know how to specify these two configuration parameters as environment variables? https://github.com/PrefectHQ/prefect/blob/master/src/prefect/config.toml#L44-L45
l
Hey @Kevin Weiler check this out https://docs.prefect.io/core/concepts/configuration.html#environment-variables Something like
PREFECT__SERVER__UI__HOST
should work I think
k
thanks @Lukas! I tried that and it didn’t fix my issue. Maybe I should start there… I’m running prefect server (in Nomad, kinda like k8s). When the UI comes up - i get a JS error that it can’t find:
<http://localhost:8080/settings.json>
when it should be going to
<http://prefect/settings.json>
should I make a new thread?
yeah - this is a completely different issue
n
Hi @Kevin Hill - which version of Prefect are you on? 0.13.9 removed the UI
base_url
variable in favor of a root
/
which should fix this
k
hah -
0.13.8
yah - that fixed it
n
Awesome! 😄
k
@nicholas - to be clear this fixes the JS error - but the site is still trying to connect to
<http://localhostL4200/graphql>
even though I’ve configured the correct api url in
PREFECT_SERVER__APOLLO_URL
I know I can set it manually on the page - will each user of this server UI need to set this manually?
n
They shouldn’t need to, but the application does some caching of the Apollo url which is probably why it’s still looking for that. Can you open the JS console and type
localStorage.clear()
?
k
@nicholas yeah - that doesn’t fix it, I have these 2 ENV variables set:
Copy code
PREFECT_SRVER__UI__HOST = "<http://prefect-test.aq.tc>"
PREFECT_SERVER__APOLLO_URL = "<http://prefect-test-api.aq.tc/graphql>"
look right?
wait
LOL - SRVER
ok, no that didn’t work either - here’s the current config for the UI
Copy code
PREFECT_SERVER__UI__HOST = "<http://prefect-test.aq.tc>"
PREFECT_SERVER__APOLLO_URL = "<http://prefect-test-api.aq.tc/graphql>"
n
Hm ok - let's make sure we've covered our bases. Can you visit the UI?
k
yes
first JS error is:
Copy code
bundle.esm.js:67 POST <http://localhost:4200/graphql> net::ERR_CONNECTION_REFUSED
n
Great, what's returned when you request the
settings.json
file? I.e. try to visit http://localhost:8080/settings.json
(replacing localhost:8080 with your endpoint/port)
k
so, in our case it will be
<http://prefect-test.aq.tc/settings.json>
and the contents are:
Copy code
{
  "server_url": "<http://prefect-test-api.aq.tc/graphql>"
}
n
Ok perfect
Let's try 2 things then to make sure everything is configured correctly
Open that http://prefect-test.aq.tc in an incognito window in your browser, open the JS console (
cmd + option + i
is the shortcut for mac), type
localStorage.clear()
and press enter in the console
then refresh the page
k
that indeed seemed to work
n
ok so that tells me you've configured everything correctly (nice!) and that this is just a local cache issue
are you testing this with anyone else? we can check to see if a fresh user runs into any issues
k
yeah - that’s what I’m going to do next
n
Ok great - let me know if you run into issues. This is still a workflow we're tweaking so I appreciate you working through it with me
k
absolutely - glad to be of help - incidentally, I’d like to share our nomad configuration for server with the community - any idea where the right place to do that is?
and thanks for your help too!
😄 1
n
Hm good question - is it on GitHub or somewhere public already?
k
not yet - but it can be
n
I think that'd be great! And then you can show it off with a link in #CL09KTZPX 😄
upvote 1
k
perfect thanks!
so @nicholas - unfortunately - this issue continues to arise. It’s quite interesting. When I open a new tab and go to the UI, the issue arises. The
localStorage
variable has a length of zero, so I don’t think it’s that. However, when I do a hard refresh, then it starts working. And it will continue to work until I open a new tab
n
Ok that's good to know, that sounds like a bug we can fix, I'll look into it asap and report back 👍
k
thanks! I’d be more than happy to give more details if necessary
or even open the bug ticket
n
Ok i may ask you for more as I look into it! Thanks @Kevin Weiler 🙂
k
here’s my state JS object:
Copy code
state: {
    backend: localStorage.getItem("backend") || "SERVER",
    connected: !0,
    connectionMessage: null,
    connectionTimeout: null,
    releaseTimestamp: null,
    apiMode: null,
    cloudUrl: "<https://api.prefect.io/graphql>",
    retries: 0,
    serverUrl: localStorage.getItem("server_url") || (null === (m = window.prefect_ui_settings) || void 0 === m ? void 0 : m.server_url) || "<http://localhost:4200/graphql>",
    version: null
},
I think that
serverUrl
is the offending line - but I’m not a JS dev, so I don’t know what it does 🙂
n
Yup, that's part of the
api
store and is definitely where it's coming from, I think the problem is in the head script where the settings are pulled, it's possible there's a race condition that's not properly resolved on load
k
that’s definitely what it feels like (race condition) considering it only happens sometimes
c
@Marvin archive “Prefect UI raises error that it can’t find http://localhost:8080/settings.json
k
@Chris White - want me to open an issue for this?