App not loading: AppOfflineError: Connection to server failed (error)

What I’m trying to do:
Load my app

What I’ve tried and what’s not working:
Going to my app’s website

I’m getting the following error (as are all of my colleagues):

AppOfflineError: Connection to server failed (error)

This does not happen when I run the app in the development environment. Also, these failed attempts to load the app do not show up in the app’s logs.

Getting the error message to the (server) logs when the app is offline seems to me a complicated thing by nature, but it is a feature that has been requested:

Thanks, @hugetim. I’m not inherently interested in having the logs for when the app is offline; I just mentioned that because the fact that nothing is showing up in the logs prevents me from debugging further. I’m mostly just interested in having the app up and running, which it currently is not (and I’m not sure why).

Clicked through to your profile; Go Badgers!

1 Like

Just a brief update here: When I switch to a private link and change nothing else, the app works. Does that give anyone a clue about what might be going wrong?

I haven’t changed anything in the DNS settings and I assume that if it were a DNS problem then it wouldn’t get to the Anvil app at all.

Going through the history of the forum, it seems that these errors are often seen during Anvil outages. Are there any such known outages at the moment?

If the links are associated to different environment, they may be running different code.

If that is the case, I would clone the app to my pc and compare the two commits associated with the two environments.

A difference in the code is unlikely to explain an AppOfflineError, but that’s the first thing I would try.

For anyone who is interested or encounters this themselves, I (apparently) resolved this by switching to a private link and then switching back to a custom domain and waiting for Anvil to do its thing.

Any idea how I could have prevented this from happening?

Did you link an environment to a custom url, then you unliked it, then linked it again?

If yes, then that’s the problem. Assigning a custom domain to an app is a slow process and it should never be undone. If you need to temporarily put the app offline, you can just create a form with a label that says “The app is offline” and set that form as startup form.

Thanks for helping me to debug @stefano.menci. I think that I was not clear enough about what happened. I never intended to put the app offline. Yesterday, my app just suddenly and inexplicably started getting the AppOfflineError. I had not made any changes to the code or any configuration. I tried various things including running the app in the IDE (worked fine) and accessing a different version of the app (with the same code, because the master and development branches were in sync) using a private link (also worked fine). So, at that point, my app, which had been working the day before and for which I made no changes to the code or the configuration was suddenly not working, but only for the custom domain. It was only then that I decided trying to switch it back to a private link to see if that helped, and indeed it did. And then, when I reapplied the custom domain, it started working again as expected.

This definitely feels like some kind of bug or outage on the Anvil side. I don’t see how it could have been anything that I did if all I changed was to switch to a private link and then switch back to a custom domain. I am wondering whether anyone knows what, if anything, I can do to prevent this from happening again because, as @stefano.menci noted, switching between a private link and a custom domain takes time, which would result in significant downtime for any users of the app.

I’m not an expert on the custom domain configuration, that there are many moving parts and I don’t know all of them.

It could have been a temporary problem on the Anvil side, but it’s weird that it only affected you.
It could have been a temporary problem on your side, but I have no clue what to point at.

I’m glad you got it working.