SmartApp with WebHook installation troubleshooting

I am trying to install my first SmartApp with WebHook. Going through the discovery in the Create Routine process I am getting the following events:

  • lifecycle: CONFIRMATION (actually it was during the SmartApp registration process)
  • lifecycle: CONFIGURATION, phase: INITIALIZE
  • lifecycle: CONFIGURATION, phase: PAGE

After accepting the configuration and permission pages in the ST App I am getting the error page with:
Reference ID: dc0b3c6e-f441-4f50-bc92-9c0b41f57b55
Error Time: 2022/10/28 00:07:10

After that I am receiving the “lifecycle: UNINSTALL” event.
I have never got the “lifecycle: INSTALL” event. Should it be before or after the Configuration even?

The SmartThings support that is supposed to help with the error Reference ID (according to the error page :slight_smile: ) is helpless.

Have you ever experienced issues like this? Any ideas how to troubleshoot it?

Thanks, Adam

The INSTALL phase follows the CONFIGURATION.

I am pretty sure I’ve seen this and I suspect @nayelyz will have a fair idea what is going on when she comes along.

About all I can suggest is to compare any app permissions you have configured for the app in the Developer Workspace with any you requested in your INITIALIZE response. The former is a whitelist so you can only select from those in the app.

1 Like

Welcome to the SmartThings Community, @AdamGreen!

Awesome, @orangebucket!
This is something that could cause the issue. @AdamGreen, the referenceID you shared is from the logs, right? In the app we see a “Network error” when this kind of thing happens.

About Graham’s comment, here’s an example:
If we have the SmartApp definition as follows:

app.enableEventLogging(2)
.appId("selectionWithConditions")
.configureI18n() // Language file in ./locales folder
.permissions([
    "r:locations:*",
    "r:devices:*",
    "x:devices:*"
])
//...

But we didn’t select all of those scopes included in the Developer Workspace, we will get an error.

Thank you so much for looking at this.

Right now, the app Scopes have just one “r:devices:*”.

Here are logs:

2022-10-28T19:35:14.434Z f754ea06-2a3b-48db-85ef-8d734709be05 INFO
Request {
“lifecycle”: “CONFIGURATION”,
“executionId”: “76b43252-b1f6-4e36-5ef7-d609b8002c03”,
“appId”: “2d794197-2f75-424d-bf53-d2a82c2c06ac”,
“locale”: “en”,
“version”: “0.1.0”,
“client”: {
“os”: “web”,
“version”: “100.0.0”,
“language”: “en”,
“displayMode”: “LIGHT”,
“timeZoneOffset”: “”,
“supportedTemplates”: ,
“samsungAccountId”: “”,
“mobileDeviceId”: “”
},
“configurationData”: {
“installedAppId”: “a14e7c57-aa29-4bdc-9bdd-7341e82077b6”,
“phase”: “INITIALIZE”,
“pageId”: “”,
“previousPageId”: “”,
“config”: {
“myTextSetting”: [
{
“valueType”: “STRING”,
“stringConfig”: {
“value”: “Test”
}
}
]
}
},
“settings”: {}
}

2022-10-28T19:35:14.654Z f754ea06-2a3b-48db-85ef-8d734709be05 INFO
Response: {
“configurationData”: {
“initialize”: {
“name”: “My Smart Home”,
“description”: “My Home Automation”,
“id”: “app”,
“permissions”: [
“r:devices”
],
“firstPageId”: “1”
}
}
}

2022-10-28T19:35:15.554Z 14f545c9-6cd4-4c2d-8a13-2ce8ec59ea19 INFO
Request {
“lifecycle”: “CONFIGURATION”,
“executionId”: “76b43252-b1f6-4e36-5ef7-d609b8002c03”,
“appId”: “2d794197-2f75-424d-bf53-d2a82c2c06ac”,
“locale”: “en”,
“version”: “0.1.0”,
“client”: {
“os”: “web”,
“version”: “100.0.0”,
“language”: “en”,
“displayMode”: “LIGHT”,
“timeZoneOffset”: “”,
“supportedTemplates”: ,
“samsungAccountId”: “”,
“mobileDeviceId”: “”
},
“configurationData”: {
“installedAppId”: “a14e7c57-aa29-4bdc-9bdd-7341e82077b6”,
“phase”: “PAGE”,
“pageId”: “1”,
“previousPageId”: “”,
“config”: {
“myTextSetting”: [
{
“valueType”: “STRING”,
“stringConfig”: {
“value”: “Test”
}
}
]
}
},
“settings”: {}
}

2022-10-28T19:35:15.557Z 14f545c9-6cd4-4c2d-8a13-2ce8ec59ea19 INFO
Response: {
“configurationData”: {
“page”: {
“pageId”: “1”,
“name”: “My Smart Home”,
“nextPageId”: null,
“previousPageId”: null,
“complete”: true,
“sections”: [
{
“name”: “Text”,
“settings”: [
{
“id”: “myTextSetting”,
“name”: “Text Settings”,
“description”: “This is a test settings”,
“type”: “TEXT”,
“required”: false,
“defaultValue”: “Test”
}
]
}
]
}
}
}

An unexpected error occurred

Sorry about that.

We have logged this error for support. If this error persists, email us at support@smartthings.com with the Reference ID and Error Time included below.

  • Reference ID: 73480c06-1424-4c21-bc76-bfce90b462b8
  • Error Time: 2022/10/28 19:35:33

In the property .permissions(), do you only have r:devices?
The scopes included there must match the format of those that appear in this part of the Developer Workspace according to what you whitelisted, in this case, we can only select r:devices:*, so having r:devices can cause the issue:


If you don’t want to allow permissions for all the devices in the location, you need to omit this property in the definition and setting deviceSettings will provide scopes for each of those selected individually, for example:

section.deviceSetting('switchd').capabilities(['switch']).permissions(['r','w','x']);

Using the setting above, you’ll be able to select a device with the Switch capability and have those permissions only for it.
The SDK has a document section where you can check the properties available:

Yes, I selected only “r:devices:*” in the Developer Workspace that matches { … “permissions” : [ “r:devices” ], …}.

BTW, when I tried to respond with { … “permissions” : [ ], …}, the app installation process falls in an infinite loop without showing the error page.

I wanted to try to install an app without permissions for troubleshooting, but the Developer Workspace requires at least one permission to be defines. When I am trying to cancel it, I an getting the lifecycle:UNINSTALL event.

Is it possible that Developer Workspace adds some hidden permissions by default?
You mentioned “r:locations:*”, but I have never requested locations in my testing. Should I try it?

Could it be something else than permissions? I just followed the documentation. However, there could be undocumented changes. Maybe some information is missing?

Do you have access to the backend portal? Is there any information associated with the Reference ID: 73480c06-1424-4c21-bc76-bfce90b462b8 at 2022/10/28 19:35:33?

Yes, I am using just one r:devices:* in the Developer Workspace.
BTW, when I respond with { … “permissions” : … } , the installation process falls in an infinite loop. If I cancel it, I am getting the lifecycle:UNINSTALL event.

Do you have access to the backend portal? Is there any information in regards with the Reference ID: 73480c06-1424-4c21-bc76-bfce90b462b8 at 2022/10/28 19:35:33?

Thank you so much for helping me.

Just to confirm, does this mean you’re not using the SmartApp Node JS SDK?
I’ll see if the team can check the logs, I personally don’t have access to it, so it can take a while.
In the meantime, I suggest you check the payload you’re sending is correct if you’re not using the SDK. You can make a local test to compare both payloads, one using the SDK and your own implementation.

Hi nayelyz,

I am not using the SmartApp Node JS SDK. The payload associated with the Reference ID: 73480c06-1424-4c21-bc76-bfce90b462b8 is published above. I think it matches the Lifecycles | SmartThings Developers documentation, but maybe I am missing something. I would really appreciate if somebody could take a quick look at it.

There is another thing I would like to share with you. You mentioned about a network error in the previous conversation. It is almost impossible because I am hosting my Smart App on AWS and I am getting SmartThings configuration requests. I noticed that some authorization is required for AWS Lambda functions. But what about WebHooks. Can WebHooks be hosted on AWS?

That means the only permissions you can select in the app is r:devices:* but you certainly used r: devices earlier in the thread.

I don’t know if there is meant to be a difference and intuitively you might assume there isn’t one. Certainly the documentation seems to use them inconsistently and interchangeably. However it does seem that it can cause problems if they don’t match.

Finally, I made it to work. The issue was in the documentation typo.

The document says that “The permission format is r:devices .” However, when I responded with r:devices:* I was able to install the app.

1 Like

Ah, you mean in this section, right? It is for Capability subscriptions, I’ll create a report about this, just as a reference, the scope r:devices:* refers to all the devices. I haven’t seen r:devices used as is, only r:devices:deviceID.
Thank you for making us notice this.

It seems the API reference has the correct info: