ms-iot / azure-client-tools

Azure Client Tools
Other
43 stars 37 forks source link

Installing app with uwp application management plugin fails with Version not Found error #30

Closed MickeyH71 closed 5 years ago

MickeyH71 commented 5 years ago

Attempting to install a package using the uwp application management plugin fails with exception code 183 version not found.

This appears to be related to https://github.com/ms-iot/azure-client-tools/issues/21 involving setting versioning on a direct method. However, installing an app package uses a desired property and not a direct method. No instructions exist for how to set the serviceInterfaceVersion on a property.

The plugin runs normally when initialized and can execute the direct methods successfully:

GetInstalledUwpAppsCmd
{
    "__meta": {
          "serviceInterfaceVersion": "1.0.0"
    }
}

However when the DesiredProperty is set, the package does not download and the 183 error appears in the log file (see below).

There is a broken link in the documentation that is supposed to explain how to link to Azure Blob Storage https://github.com/ms-iot/azure-client-tools/blob/master/docs/device-agent/schema/configuration-groups/uwpapplication-management.md "The access to the blob storage is performed as described here"...

Here is our twin segment:

"desired": {
      "uwpApps": {
        "connectionString": "<<Azure storage connection string>>",
        "apps": {
          "<<PackageName>>": {
            "pkgFamilyName": "<<PackageFamilyName>>",
            "version": "1.9.3.1",
            "appxSource": "downloads\\iotcore\\myapp.appx",
            "depsSources": "downloads\\lnl\\Microsoft.NET.CoreRuntime.2.1.appx;downloads\\lnl\\Microsoft.VCLibs.ARM.Debug.14.00.appx",
            "startup": "foreground",
            "launchAfterInstall": true
          }
        }
      },

From DM.Core log:

08-45-23 PM [00000688] [00001240] {
    "__summary" : 
    {
        "deployments" : "",
        "failedCount" : 1,
        "failedGroups" : "uwpApps",
        "pendingCount" : 0,
        "pendingGroups" : "",
        "time" : "2019-05-08T20:45:23"
    },
    "uwpApps" : 
    {
        "__errors" : 
        {
            "uwpApps" : 
            {
                "code" : 183,
                "context" : "uwpApps",
                "message" : "Version not found",
                "parameters" : {},
                "subsystem" : "DeviceAgentPlugin"
            }
        },
        "__meta" : 
        {
            "deploymentId" : "unspecified",
            "deploymentStatus" : "failed",
            "deviceInterfaceVersion" : "",
            "time" : "2019-05-08T20:45:23"
        }
    }
}

From the uwpApps log: 07-44-22 PM [00001996] [00001932] Logging configured. 07-44-22 PM [00001996] [00001932] Microsoft::Azure::DeviceManagement::UwpAppManagementPlugin::UwpAppManagementHandler::OnConnectionStatusChanged 07-44-22 PM [00001996] [00001932] Connection Status: Online. 07-44-23 PM [00001996] [00001932] Microsoft::Azure::DeviceManagement::UwpAppManagementPlugin::UwpAppManagementHandler::Invoke 07-44-23 PM [00001996] [00001932] Microsoft::Azure::DeviceManagement::Common::Operation::RunOperation 07-44-23 PM [00001996] [00001932] Sub-Group: uwpApps 07-44-23 PM [00001996] [00001932] SubSystem : DeviceAgentPlugin 07-44-23 PM [00001996] [00001932] Exception code : 183 07-44-23 PM [00001996] [00001932] Exception debug message: Version not found 07-44-23 PM [00001996] [00001932] Error: [DeviceAgentPlugin] Code: 183, Message: Version not found 07-44-23 PM [00001996] [00001932] Microsoft::Azure::DeviceManagement::Common::ReportedErrorList::AddError 07-44-23 PM [00001996] [00001932] Microsoft::Azure::DeviceManagement::Common::ReportedErrorList::ToJsonObject 07-44-23 PM [00001996] [00001932] Microsoft::Azure::DeviceManagement::Common::ReportedError::ToJsonObject

thj-dk commented 5 years ago

I've had success using the twin's desired property, by defining the serviceInterfaceVersion in the meta object like this, for scheduling reboots:

{
  "properties": {
    "desired": {
      "rebootInfo": {
        "singleRebootTime": "2019-05-09T18:25:00Z",
        "__meta": {
          "serviceInterfaceVersion": "1.0.0"
        }
      }
    }
  }
}

Maybe it's the same for uwpApps?

MickeyH71 commented 5 years ago

Thanks, thj-dk, it was successful with this format:

"properties": {
    "desired": {
      "uwpApps": {
        "connectionString": "...",
        "apps": {
          "myapp": {
            "pkgFamilyName": "mypackagefamilyname",
            "version": "1.9.3.1",
            "appxSource": "downloads\\myapp.appx",
            "depsSources": "downloads\\Microsoft.NET.CoreRuntime.2.1.appx;downloads\\lnl\\Microsoft.VCLibs.ARM.Debug.14.00.appx",
            "startup": "foreground",
            "launchAfterInstall": true
          }
        },
        "__meta": {
          "serviceInterfaceVersion": "1.0.0"
        }
      },

I've had success using the twin's desired property, by defining the serviceInterfaceVersion in the meta object like this, for scheduling reboots:

{
  "properties": {
    "desired": {
      "rebootInfo": {
        "singleRebootTime": "2019-05-09T18:25:00Z",
        "__meta": {
          "serviceInterfaceVersion": "1.0.0"
        }
      }
    }
  }
}

Maybe it's the same for uwpApps?

gmileka commented 5 years ago

MickeyH71, this is a doc issue on our side. thj-dk is correct - and that's the right fix. We'll updating the docs in the next couple of days.

gmileka commented 5 years ago

Fixed the docs with commit 906df93111bb2c27e93a04c5914f53b12a522d0e.