Creating/reading runtime objects when offline


I’m trying to design an app for offline data handling. I have tried following the documentation, but the issue I’m running into now is that these two actions both trigger a ConnectionNotReady error:

  • Reading from one runtime data source (single cardinality) to another (multi-cardinality)
  • Creating in a multi-cardinality runtime data source

It seems the only option then is to only allow the user to create one object while offline? Would it be possible to enable several objects created offline, only to persist once online?

There should be no issues using multi-cardinality data sources offline. Can you check that you have no generated data sources using the command appfarmDebug.toggleGeneratedDataInDevTools() in the console? This is usually what triggers ConnectionNotReady errors.
If the case is that you have generated data sources, you can get rid of these by setting up reference data sources for the data sources that trigger the errors.

1 Like

Thanks for the response! After adding the reference data sources as you suggested, the generated data sources seem to still be persisting in our database even after refreshing, thereby triggering the same error. Is there a way to delete these generated data sources?

We do quite a lot of caching on the client, so that might be why the generated data sources are not disappearing. A hacky solution to this is to add a new runtime property on a data source, use it in the UI and then change its nodename. That forces Create to load the whole model anew and parse everything.
Hope that helps!

Hello again! Are there any other possible reasons for a ConnectionNotReady error? I am getting this same error now even though I do not have any generated data sources.


Do you have the same action connected to both “On App Load” and “On Online” event handlers in App Settings? I believe I got that ConnectionNotReady error when I had the same action on both these events. An Offline app only need an “On Online”, since that event is triggered on app refresh (when online).


I don’t actually. I only have one action which is connected to “On Online”, as suggested in the documentation…

If it helps, the error is triggered by an action reading from a single cardinality data source to a multi-cardinality data source, where I am trying to add to the existing data.


First off: Could you try a hard refresh of that app in the client, and also try another browser just to remove any caching issues.

Then: If you reading from a single cardinality datasource into a “many” data source: How does the single cardinality get it’s objects? From another read objects?

I just set up for following case:

  1. Read all “Tasks” on online into “Tasks (all)” runtime only datasource
  2. An action that loops “Tasks (all)” and reads into a single cardinality “Task” datasource, and then reads the single “Task” into a third data source “Tasks (add to)” (cardinality many).

If somewhere in your App you try to reference Task.Project.Title, or Tasks (add to).Project.Title, I get the connectionNotReady error. But also, I get secondardy data sources. It makes sense, since when the read of data in 1) is performed, there is no references in the App using “Tasks (all).Project.Title”, so these data are not read. So when these other data sources use the “project.title” reference, Appfarm tries to read these (secondary data) upon the “read from”.

If, however, you also make sure that “Tasks (all).Project.Title” is in use in the App, then these data are alread read “on online” and you get no such secondary data sources, and no connectionNotReady error.

Hope that might help you in right direction.

Hi Kristian, I have tried hard refreshing, using another browser and have checked that Reference Data Sources are used where deep data bindings are used.

However, I am still getting the same error message.

It seems strange that I don’t have any generated data sources even though I am getting this error?

I had this same issue (error ConnectionNotReady) while testing the offline mode.
I figured out that it was due to the “Created by” flag on my object class.
By removing it, it’s now working fine.
I don’t know if this could be related ?