https://prefect.io logo
k

Kevin Weiler

10/01/2020, 1:26 PM
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

Lukas

10/01/2020, 1:34 PM
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

Kevin Weiler

10/01/2020, 1:36 PM
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

nicholas

10/01/2020, 1:57 PM
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

Kevin Weiler

10/01/2020, 1:58 PM
hah -
0.13.8
yah - that fixed it
n

nicholas

10/01/2020, 2:12 PM
Awesome! 😄
k

Kevin Weiler

10/01/2020, 2:24 PM
@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

nicholas

10/01/2020, 2:26 PM
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

Kevin Weiler

10/01/2020, 2:40 PM
@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

nicholas

10/01/2020, 2:43 PM
Hm ok - let's make sure we've covered our bases. Can you visit the UI?
k

Kevin Weiler

10/01/2020, 2:43 PM
yes
first JS error is:
Copy code
bundle.esm.js:67 POST <http://localhost:4200/graphql> net::ERR_CONNECTION_REFUSED
n

nicholas

10/01/2020, 2:44 PM
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

Kevin Weiler

10/01/2020, 2:45 PM
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

nicholas

10/01/2020, 2:45 PM
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

Kevin Weiler

10/01/2020, 2:47 PM
that indeed seemed to work
n

nicholas

10/01/2020, 2:48 PM
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

Kevin Weiler

10/01/2020, 2:48 PM
yeah - that’s what I’m going to do next
n

nicholas

10/01/2020, 2:49 PM
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

Kevin Weiler

10/01/2020, 2:50 PM
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

nicholas

10/01/2020, 2:50 PM
Hm good question - is it on GitHub or somewhere public already?
k

Kevin Weiler

10/01/2020, 2:58 PM
not yet - but it can be
n

nicholas

10/01/2020, 2:59 PM
I think that'd be great! And then you can show it off with a link in #show-us-what-you-got 😄
upvote 1
k

Kevin Weiler

10/01/2020, 3:00 PM
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

nicholas

10/01/2020, 6:33 PM
Ok that's good to know, that sounds like a bug we can fix, I'll look into it asap and report back 👍
k

Kevin Weiler

10/01/2020, 6:41 PM
thanks! I’d be more than happy to give more details if necessary
or even open the bug ticket
n

nicholas

10/01/2020, 6:46 PM
Ok i may ask you for more as I look into it! Thanks @Kevin Weiler 🙂
k

Kevin Weiler

10/01/2020, 7:44 PM
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

nicholas

10/01/2020, 7:46 PM
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

Kevin Weiler

10/01/2020, 7:50 PM
that’s definitely what it feels like (race condition) considering it only happens sometimes
c

Chris White

10/05/2020, 12:30 AM
@Marvin archive “Prefect UI raises error that it can’t find http://localhost:8080/settings.json
k

Kevin Weiler

10/05/2020, 6:53 PM
@Chris White - want me to open an issue for this?