AppOfflineError: App is offline

I’ve been getting a bunch of random “AppOfflineError: App is offline” errors the past couple of days when running my app in the IDE.

It seemed to only happen after I would make code changes and would stop throwing these errors a couple minutes after the change.

Now every time I try to run my app in the IDE, I get this error in various locations in my code.

Has anyone else seen this issue?

I believe that has to do with your internet connection:

Doe this not pop up in the published version?

I found a fix to this but I’m still not sure what was going on. I cleared all my Chrome browsing data and now it works properly: running in the IDE, going to the private link, etc.

4 Likes

I spoke too soon.

Now whenever I open the IDE in a new Chrome window I can run the app one time and then afterwards, it throws the App is offline error.

If I log in to an Incognito window, I can seemingly run the app an unlimited amount of times without the error.

Thanks @jlatta23,

It’s likely a browser extension doing something unusual.

If you could disable all your chrome extensions and add them back one by one you might find the culprit. Then we can try to replicate our end.

2 Likes

I believe I have figured out the issue.

I am using a Javascript module that depends on ThreeJS and had hard-coded the URL of my public Anvil app to pull in some stored asset files. This was throwing a CORS error when running the app in the IDE or the private link to my development branch.

I have been running it this way for over a month without seeing the AppOfflineError issue so I might have hit some sort of limit and the server started blocking me?

Regardless, after setting the URL based on the python call: anvil.server.get_app_origin(), everything works as expected.

The confusing part here was that a CORS problem with a javascript library used by the app was causing the app to raise an AppOfflineError.

Is AppOfflineError the correct exception?

Perhaps ExternalError would be more appropriate?

@jlatta23 - Thanks for the update - could you be a little more specific about the url you were using and how you were fetching the asset? That way we can reproduce this behaviour.

(A clone link would be :+1:)

:zombie:

I had this today in an app using the tracking SaaS Hotjar, which needs a JS script like this in Native Libraries (apologies for the image rather than text lol)

image

So based on this thread, I removed this from Native libraries and it’s working now. Not a big deal as Hotjar wasn’t really that necessary in this case. Weird though.

3 Likes

Hello,

I have been trying to make a reproducible case to this App is offline error. However I still could not pinpoint what causes the issue.

I am working on chrome, with couple of extensions, however even if I go to incognito mode, with disabled extensions, the error still occurs.

As for the error I can confirm, that it is due to a “failed to fetch” issue. I am not sure if this is helpful, but here it goes.

Uncaught (in promise) TypeError: Failed to fetch
    at service-worker:1:48976
    at o (service-worker:1:22421)
    at Generator._invoke (service-worker:1:23484)
    at Generator.next (service-worker:1:22601)
    at c (service-worker:1:46610)
    at i (service-worker:1:46793)

Python exception: AppOfflineError: App is offline

Edit: added error source
The error message points here:

case 13:
     return t.prev = 13, t.next = 16, fetch(r.request.clone());

Let me know if you need any additional info regarding this.