cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MOSAIC
Regular Visitor

Help! Powerapp Offline Error

New Power App for Offline use on mobile devices.

 

When there is no connection and offline, the loading always generates an error: "the request was net sent..." 

 

The App OnStartup Code:

If( Connection.Connected,
   Set( varStartStatus, "Online");
,
   Set( varStartStatus, "Offline");
);

 

If( Connection.Connected,
   ClearCollect( col_Locations, NOW_1st_Locations);
   SaveData( col_Locations, "Local_1st_Locations" );
,
   LoadData( col_Locations, "NOW_Locations", true );
);

 

I have tried every combination of:

- Delayed Load (On and Off)

- Adding a Timer to delay the startup

- Moving the Code from OnStartup to buttons or sub-screens

 

and the error persists. I have removed the Gallery and every form using any data from the Collection or SharePoint list and I still get the error when the phone is no connected to wifi. After the initial error, the app appears to work correctly. The error is always on startup. 

 

To confirm it was not Connection.Connected retruning an invalid result, I set and display variable varStartStatus and it displays accurately. 

 

What am I missing? 

5 REPLIES 5
v-albai-msft
Community Support
Community Support

Hi @MOSAIC ,

Seems the formula your provided have no issue, so I would suggest you check the OnVisible property of all your Screens, make sure if you refer to your DataSource there. Formulas like below:

v-albai-msft_0-1618565266834.png

 

v-albai-msft_1-1618565266835.png

Best regards,

Allen

Allen,

 

Thank you for the feedback. All formulas and screens use only the collection. Nothing references the SharePoint list directly.

 

In my testing, I even removed all formulas and the only reference to the SharePoint list or collection is in the OnStart section in the "If(Connection.Connected" section and it still produces the error.

 

On a different note, the code in the original post had a mistake.

 

I created a new blank test Canvass app:

- Add a Data Connection via the PowerApp Studio to SharePoint List NOW_1st_Locations

- the OnStartup Code listed below (One variable, one collection, and one local saved file)

- Screen1 with two text labels

Nothing else is included and the error still occurs.

 

The complete OnStartup code is:

 

If( Connection.Connected,
   Set( varStartStatus, "Online");
,
   Set( varStartStatus, "Offline");
);

 

If( Connection.Connected,
   ClearCollect( col_Locations, NOW_1st_Locations);
   SaveData( col_Locations, "Local_1st_Locations" );
,
   LoadData( col_Locations, "Local_1st_Locations", true );
);

 

navigate(Screen1);

 

On Screen1, there are two labels each with a single line:

Label1:

Text( "Start: "& varStartStatus)

 

Label2:

Text( "Current: "& If( Connection.Connected, "Online","Offline") )

 

Running the app displays the correct Connection status on Startup and as I use the app and the connection is enabled or disabled before the app is started and after the app is started, however the error persists. The only way to get the error to stop is to remove the one reference to the Sharepoint list, however, the data would then not be available.

 

In SharePoint, I made myself the owner and have full access to the site and the individual list. The list was created directly in sharepoint -> New List and I added five columns and even left a column for Title as I know there is bug with PowerApps always looking for a Title column. 

 

To prove the collection was being saved locally, I displayed the data table pointed to the collection and it displayed correctly connected and then when it was disconnected. I then removed the data table and still the error persists with and without the table. Yes the table when it was added referenced the collection col_locations and nothing other then the startup code above referenced the SharePointlist.

Hi @MOSAIC ,

So strange, I never meet this error when deploy off line app.

Anyway, currently I have two thoughts you may have a try:

 

1. From your reply, do you mean you meet this error no matter with connection or without connection?

If yes, I would suggest you check if your Company's  firewall blocks some requests. There are some Required services in PowerApps, please make sure your Company's Network does not block these services:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/limits-and-config#required-services

 

2. There is a common issue about Connection.Connected mentioned in this article:

Connection.Connected returns the wrong value during OnStart in Power Apps for Windows (July 21, 2020) While offline, Connection.Connected may wrongly return true immediately after starting an app in the Windows app. As a workaround, delay when the logic depending on it is executed by using a Timer control.

So try to add a Timer and set it duration property with 10000 as 10 seconds. Check the result after adding the Timer.

Best regards,

Allen

So to clarify, the error only occurs when offline. I tried every variation placement of the if(connection.connected, ...

 

I tried it in Onstartup, Onvisible, OnSelect, OnTimer End, etc. When connected and online, everything works and there is no error. As soon as there is no connection the error return. Depending on how the app is written, I can get an app to work with only one occurrence of the error on startup, however, the one error is misleading users.

 

I can also confirm it is not a network firewall issue. If it were it would always exhibit the error. It only occurs when the device is disconnected/offline. I have tested this on private networks and on public networks with open firewalls to the same result.

 

Hi @MOSAIC ,

Not sure why you meet this error since I have limited information about your configuration.

I would suggest you submit a Microsoft Support Ticket at:

https://admin.powerplatform.microsoft.com/support .

Hopefully the support team will be able to give you more details on the issue with their telemetry and logs.

Best regards,

Allen

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,917)