SharePoint App upgrade fails with an error

This post is a contribution from Pavan Kumar, an engineer with the SharePoint Developer Support team

I worked on a very interesting issue where in upgrade of Sharepoint App failed consistently on OnPremise Sharepoint 2013 installation. While I was reviewing the ULS logs I could find that there was an AppLifeCycleError_TimeOut. Portion of ULS is given below

<SPAppInstanceErrorDetails xmlns="https://schemas.datacontract.org/2004/07/Microsoft.SharePoint.Administration" xmlns:i="https://www.w3.org/2001/XMLSchema-instance"><CorrelationId>510b97ff-212d-45ec-ba23-20b13c68a243</CorrelationId><ErrorDetailToken>AppLifecycleError_Timeout</ErrorDetailToken><ErrorType>Transient</ErrorType><Source>Common</Source><exceptionDetailedMessage i:nil="true"/><exceptionMessage i:nil="true"/></SPAppInstanceErrorDetails>

Digging further I could find that the reason for this behavior was that the time taken for the App to get upgraded was exceeding the default limit as the number of files to be upgraded were huge.

To overcome this we will need to add a new property “ExtendedAppWebTimeout” to SPFarm object’s property collection.

Below are the steps which were followed to resolve the issue

To add this property, close all instances of PowerShell and SharePoint 2013 Management Shell and open a new instance of SharePoint 2013 Management Shell in admin mode. Then execute the following commands.

$farm = Get-SPFarm

$farm.Properties.Add("ExtendedAppWebTimeout",20)

$farm.Update()

Write-Host "ExtendedAppWebTimeout property added successfully"

To remove this property, close all instances of PowerShell and SharePoint 2013 Management Shell and open a new instance of SharePoint 2013 Management Shell in admin mode. Then execute the following

$farm = Get-SPFarm

$farm.Properties.Remove("ExtendedAppWebTimeout")

$farm.Update()

Write-Host "ExtendedAppWebTimeout property removed successfully"

NOTE : This is applicable only for Sharepoint 2013 OnPremise installation