You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Calling await context.api.subscriptions.delete() is giving 500
To Reproduce
import {Page, SmartApp, SmartAppContext} from '@smartthings/smartapp';
import{ InstalledAppConfiguration } from "@smartthings/core-sdk"
import express from 'express';
import { AppEvent } from '@smartthings/smartapp/lib/lifecycle-events';
const server = express();
const PORT = 3000;
const appID = "c0c4806c-d6cb-4966-b1c2-21a2b883b01b"
/* Define the SmartApp */
const smartapp = new SmartApp()
.enableEventLogging(2) // logs all lifecycle event requests and responses as pretty-printed JSON. Omit in production
.appId(appID)
.permissions(['r:devices:*'])
.page('mainPage', (context:SmartAppContext, page:Page, configData?:InstalledAppConfiguration ) => {
page.section('settings', section => {
section
.deviceSetting('lock')
.capabilities(['lock'])
.permissions('rwxi')
console.log("settings",section);
});
})
// Called for both INSTALLED and UPDATED lifecycle events if there is no separate installed() handler
.updated(async (context:SmartAppContext, updateData:AppEvent.UpdateData) => {
// console.log(context.api.subscriptions.delete())
console.log(JSON.stringify(context.config))
// let currentTemp = await context.api.devices.getCapabilityStatus(context.config.lock[0].deviceConfig.deviceId,'main','lock')
// console.log(currentTemp.coolingSetpoint.value)
await context.api.subscriptions.delete() // clear any existing configuration
// await context.api.subscriptions.unsubscribeAll();
await context.api.subscriptions.subscribeToDevices(context.config.lock, '*', '*', 'myDeviceEventHandler');
await context.api.devices.sendCommands(context.config.lock, 'perfectnumber12833.lock', "lock");
// await context.api.devices.sendCommands(context.config.lock, 'perfectnumber12833.lock', "unlock");
console.log("updated data",JSON.stringify(updateData));
console.log(context.config,"req sent1")
})
.subscribedEventHandler('myDeviceEventHandler', async (context, event) => {
// await context.api.devices.sendCommands(context.config.main, 'lock', "locked");
});
server.use(express.json());
/* Handle POST requests */
server.post('/', function (req, res, next) {
console.log(req.body)
smartapp.handleHttpCallback(req, res);
});
/* Start listening at your defined PORT */
server.listen(PORT, () => console.log(`Server is up and running on port ${PORT}`));
When i use below code await context.api.subscriptions.delete() // clear any existing configuration
I get this error
2024-04-22T10:47:20.392Z error: AxiosError: options must be an object
at Object.assertOptions (D:\Work\krishworks\smartlock\node_modules\@smartthings\core-sdk\node_modules\axios\lib\helpers\validator.js:62:11)
at Axios.request (D:\Work\krishworks\smartlock\node_modules\@smartthings\core-sdk\node_modules\axios\lib\core\Axios.js:65:15)
at Function.wrap [as request] (D:\Work\krishworks\smartlock\node_modules\@smartthings\core-sdk\node_modules\axios\lib\helpers\bind.js:5:15)
at EndpointClient.<anonymous> (D:\Work\krishworks\smartlock\node_modules\@smartthings\core-sdk\dist\endpoint-client.js:136:56)
at Generator.next (<anonymous>)
at fulfilled (D:\Work\krishworks\smartlock\node_modules\@smartthings\core-sdk\dist\endpoint-client.js:5:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
2024-04-22T10:47:20.393Z debug: RESPONSE: {
"statusCode": 500,
"message": "Server error: 'AxiosError: options must be an object'"
}
Expected behavior
It should delete the subscriptions
Actual behavior
It gives throws a 500 error
The text was updated successfully, but these errors were encountered:
This issue was introduced with a new version of Axis 0.x that is not really backward compatible despite its version number. We are working on a solution.
Describe the bug
Calling await context.api.subscriptions.delete() is giving 500
To Reproduce
When i use below code
await context.api.subscriptions.delete() // clear any existing configuration
I get this error
Expected behavior
It should delete the subscriptions
Actual behavior
It gives throws a 500 error
The text was updated successfully, but these errors were encountered: