Warnings and errors

There are a range of warnings and errors that you may encounter in the developer tools while debugging your apps.

Warnings

Warnings are notices which you should review. You should potentially take action if your app is suffering from degraded performance.

Running full formula recalculation on Self after just recalculated all formulas

This warning occurs when an Update/Create/Delete or Set Selection action node has been run, forcing another data source to recalculate one of its runtime properties (function properties), a short time after it was last done.

Example: Data source Order has a runtime property Is transferred (a function, returning trueif the property Transferred Date has value). An action updates Transferred Date twice. This warning will appear.

This warning can be ignored in most cases. It might be worth investigating if you notice a performance issue when recalculating formulas (runtime properties as functions) on large data sources.

Replaced data in dataSource, but did not recalculate dependencies

This warning is typically seen when performing web requests and a mapped data source is populated with data. The populated data source is runtime only, and when this is populated using a web request, an optimization is in place to ensure that potential dependencies are not recalculated. A dependency in this case is a deep data binding.

Example: A web request populates data source Orders (runtime). If you try to display Orders (runtime).Customer.Name in a view, Customer.Name will not be updated when Orders (runtime) is repopulated. However, if you add Customer as a reference data source on the Orders (runtime), you can safely reference Orders (runtime).Customer.Name.

This warning could be ignored in most cases. If you are using deep data bindings on the populated data source, make sure to utilize reference data sources.

The created object does not match the filter of the Data Source it was created in

This warning appears when you have a Filter on a Database Connected Data Source, and you perform a Create Object into it - but the created object does not match the filter of the Data Source. The object is successfully created, but is then immediately removed from the Data Source.

Example: A Data Source Open Tickets with filter Ticket.Status = Open. A Create Object creates a new Ticket into this Data Source, but the Status is set to Completed. Thus, a Completed ticket is created into the database, but that completed Ticket does not exist in the Data Source Open Tickets.

Errors

Create object failed - Cannot create object in non-empty dataSource with cardinality one

This error occurs when you have a runtime-only data source with cardinality one. You try to create a new object in the data source, but an object already exists in the data source.

Example: You have an action Create project creating a new Project in the data source Project (runtime). It works the first time, but fails the second time.

There are two ways to solve this issue:

Option 1 (recommended): In the Create Objects action node, select the Replace Existing Object checkbox.

Option 2: Use a Delete Objects action node on the runtime data source before running the Create Objects action node.

AuthorizationError: Missing required permissions to...

The following errors may occur when creating or updating user accounts from an app.

  • AuthorizationError: Missing required permissions to assign roles

  • AuthorizationError: Missing required permissions to delete roles

  • AuthorizationError: Missing required permissions to update account

  • AuthorizationError: Missing required permissions to create account

These errors indicate that the logged-in user's role(s) do not have sufficient privileges to perform the operation. When performing user account operations in an app, Owners, Maintainers, and Developers role privileges are not valid.

Go to Permissions > Accounts/Roles to verify that you have the correct permissions in place. Note that your own user must be member of a custom role in order to create, update or delete users from an app - even in the Development environment. Also, verify that create, update or delete users is enabled for the environment under Environments. Read more here.

EnvironmentAuthorizationError - User Accounts accounts cannot be updated from current environment - Check Environment settings

The same cause also applies to the following error messages:

  • User Accounts accounts cannot be created from current environment - Check Environment settings

  • User Accounts accounts cannot be deleted from current environment - Check Environment settings.

These errors can occur in the Development, Test or Staging environments.

User accounts are global resources and changes to user accounts in any environment will affect production. To prevent unintended user changes, user account manipulation operations are disabled by default in Development, Test, and Staging. Additionally, the settings are automatically reset every night.

Verify that create, update or delete users is enabled for the environment under Environments.

ForEach: Unable to find dataSource for iteration

A Foreach action node is missing a value for the Selection property. This error can also be seen in Appfarm Create with a red dot on the property.

Set a valid value in the Selection property of the Foreach action node such as All objects, Selected object(s) or Filtered selection.

InvalidEmailError: Email for validation is Nil

A Send email action node has an invalid Recipient property.

Example: You read data into a User (runtime) data source, resulting in 0 objects. You try to run Send email with the recipient User (runtime).Email.

Your business logic is not set up correctly. Make sure the data source selected in the Recipient property contains an object, and that the email property of this object has a value.

No objects found for deletion

A Delete objects action node results in no objects being deleted, since either the data source is empty, or the filter expression results in no objects for deletion.

It might also be that you have a Delete objects action node using Selected object(s), and the data source has no selected objects.

Your business logic is not set up correctly. Make sure the Delete objects action node has a valid filter or selection.

Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource

This error occurs when you have a Web request action node with Send from Client selected. When using send from client, the browser's CORS (Cross-Origin Resource Sharing) policies are triggered.

The recipient of the web request (the other application) needs to add *.appfarm.app (or your custom domain, if applicable) to their list of accepted domains in their 'Access-Control-Allow-Origin' settings.

SimpleWebRequest Error: Invalid mapping - non-integer path for Array

A Web request action node returns an array of objects, and the result mapping is not set up correctly.

In Result Mapping, to map all objects from the response, make sure to set the Data Source property to a runtime-only data source with cardinality Many. If you receive an array of objects and only want to map the first item, you can use dot notation to access the first object, for example Orders.0.OrderNumber to only map the order number of the first order. See Web request for more information.

Invariant failed

This error message is related to drag-and-drop.

Make sure any drag-and-drop functionality is configured correctly.

Error running function: Cannot read properties of undefined (reading 'length')

Functions may exist in Runtime Properties in App Data, inside an Action (e.g a Condition) or in User Interfaces.

If this error message e.g. appears in a Persist Action Node, it's probably caused by a Runtime Only Property (Function) on a Data Source. If it appears just when navigating to a View, it's caused by a function (calculated text, visible condition etc.) inside that View.

Example: A function return companies[0].name can give this error message: What if companies is an empty list? Then this function will fail with this error message. The function should handle this scenario and be set up such as this: if (companies.length>0) return ...

Go through Runtime Properties (Functions) on your Data Sources. If this message occurs when the App loads, it's probably related to a Database Connected Data Source. Check for functions which could result in errors, and handle this by adding IFs as in the above example.

Object or array was returned in function value. Expected primitive type

This error occurs when a Function returns a data type which is not a simple data type. A simple data type is an Integer, Boolean, String, Float, ID etc. Typically, this occurs when the function returns an Object or an Array.

Example: An Update Object Action Node updates a Datetime property using the following function:

let myDate = moment().add(2,'days')
return myDate

myDate is an Object of type moment, and not a simple data type. In the example above, the Function should return a Datetime data type.

Solution: The return value needs to be changed to a simple data type. In this case, the moment.js library has a toJSON() method that converts it to a Datetime.

let myDate = moment().add(2,'days')
return myDate.toJSON()

This issue is solved by converting the return value of the function to a simple data type. In many cases, the issue is that you are returning an object, and you may often apply .toJSON() to the return value.

Proxy error / ECONNREFUSED

This error message may occur when trying to access an App, the GraphQL Editor (https://<yoursolution>.appfarm.app/api/graphql/) or Swagger (the Services tool found in https://<yoursolution>.appfarm.app/api/services/).

The most frequent occurrence of this error is in the Dev-client for your Apps (when testing your App in Develop environment), and you have a large solution. In this case, the auto-deploy may cause a minor delay for the Dev-client to reload. The issue should only last for a few seconds. The exact same issue may occur for the Swagger client when testing your Services in the Dev environment.

This issue normally resolves itself after 5-30 seconds

This error may also occur in a Prod environment when not sufficient resources are available. For example, if one or more performance-heavy services are running, and the auto-scaling has reached its limit. A solution to this may be to improve the performance of the Service (optimize it) or to adjust the Schedule (if more Services are running in parallel). It might be that the limits should be adjusted as well if there is nothing to optimize (Appfarm needs to be contacted).

Example error messages:

  • Proxy error (only): This may occur when the client is suspended or disabled. For example, if your solution has been suspended and the Dev client is disabled.

  • {"code":503, "message":"Proxy error - service", "err":{"errno":-111, "code":"ECONNREFUSED","syscall":"connect","address":"NN.NN.NNN.NN", "port":5000}}

  • {"code":503, "message":"Proxy error - client unavailable", "err":{"errno":-111, "code":"ECONNREFUSED","syscall":"connect","address":"NN.NN.NNN.NN", "port":5000}}

Proxy error - api-service unavailable

This error occurs if you have not enabled API Services from Environment Config, and you try to access Service Developer Tools, or try to execute a Service Endpoint from a third-party tool or schedule.

Go to Environment Config and tich Enable API Services.

These errors are usually caused by one of these reasons.

  • The action tries to open a view that does not exist. This can be caused by a typo in a data bound viewId or an inconsistency between actual views and the navigate action node.

  • The View exists, but is not loaded since it is corrupt and contains an error causing the parsing and inflation of the view to fail. These parsing errors should be shown in Dev Tools from the App Validation menu.

  • The navigate is run in an On App Load event handler, and is run prior to the client receiveing all metadata. Note that the On App Load event is run after the App has loaded app description, data model, actions, functions and initial data, but prior to loading all layout / views.

Eval timeout - function took too long to execute (FunctionEvalTimeoutError)

This error may be seen in Apps, but is more typical in Services.

Evaluation and calculation of functions has a execution limit of 2000 milliseconds. That applies to e.g. a Result Parser in a Web Request, an If-statement using the Function Editor, or a Runtime Property or Object Class Property of type Function.

If you have a single function or result parser consuming more than 2000 ms, you need to optimize the function, or process smaller amounts of data inside it.

Error - At least one object for modification is not in the datasource

This error typically occurs in Development environments when performing Update Object on Database connected data sources, and there is an inconsistency between the data source content on the client ("in the App") and on the server. When developing in Appfarm Create, the client tries automatically updates on all "UI releated changes". But whenever a change is done on the data level (a new data source, a new object class property put in use in your UI), you will need to manually refresh your development client to get new data. Otherwise, errors such as this may occur.

Last updated