Hello community ,
I am trying to setup a SmartApp using an AWS Lambda using the nodeJS SDK. I’ll keep aside the logic of the app, since I face the issue using a very basic sample application. I’ve already spent a few hours trying to figure out what is happening, but no luck.
The SmartApp:
The code is taken from this sample: Simple Smartapp
It is inserted into the Lambda IDE, the SDK is loaded, the locales/
folder and its content exist, all the express related code was removed and replaced by the Lambda handler:
export const handler = async (event, context, callback) => {
app.handleLambdaCallback(event, context, callback);
};
The SmartApphas been successfully registered through the developer portal and is deployed to “Test”.
Symptoms:
Whenever I try to install the SmartApp using the iOS mobile app, the following error appears: Something went wrong. Please try to install the SmartApp again.
Steps I already took to try to fix the issue:
- I’ve tried to execute the very same application on Glitch. It worked like a charm. That is why I am thinking of a Lambda related issue
- I increased the timeout/memory of the Lambda, did not have any effect
- I tried to check on the Live Logging feature, but all I can see is a set of
CONTROL_EVENT
triggered every minute. Whenever I try to (un)install the SmartApp, there is no activity at all - I checked on CloudWatch, to see the activity from the Lambda point of view. I can see all the requests/responses. Which leads me to the following conclusions:
- Smartthings is allowed to reach and invoke the Lambda (excludes some permissions issues?)
- The last response sent by the lambda is strictly identical to the one sent by the Glitch version (see below). Yet, it doesn’t work with the Lambda.
{
"statusCode": 200,
"configurationData": {
"page": {
"name": "Lights Open/Close",
"complete": true,
"pageId": "mainPage",
"nextPageId": null,
"previousPageId": null,
"sections": [
{
"name": "When something opens or closes",
"settings": [
{
"id": "sensor",
"required": true,
"type": "DEVICE",
"name": "Select an open/close sensor",
"description": "Tap to set",
"multiple": false,
"capabilities": [
"contactSensor"
],
"permissions": [
"r"
]
}
]
},
{
"name": "Turn on and off these lights",
"settings": [
{
"id": "lights",
"required": false,
"type": "DEVICE",
"name": "Select lights & switches",
"description": "Tap to set",
"multiple": true,
"capabilities": [
"switch"
],
"permissions": [
"r",
"x"
]
}
]
}
]
}
}
}
I am a bit lost with this one. Any help would be really appreciated
Thanks!