Error calling luna://com.webos.service.tv.systemproperty from JS services

I’m implementing a JS service to be used by web apps. The service works well, and I can successfully call each of the commands defined in the services.json file from a web app.

However, I am facing an issue when trying to call the getSystemInfo method of the luna://com.webos.service.tv.systemproperty service from within one of the registered commands. When I add this call to the command function handler, the service seems to terminate immediately.

Here is the code causing the issue:

service.call("luna://com.webos.service.tv.systemproperty/getSystemInfo", {
    keys: ['modelName', 'firmwareVersion', 'UHD', 'sdkVersion']
}, function (response) {
    console.log(JSON.stringify(response));
});

I can see logs before this call, which confirms that the service is created and handles the command properly. However, as soon as service.call is executed, the service terminates unexpectedly, and I can no longer see it running. If I remove the call, the service continues running normally (since it has an active subscription).

My question is: Is there any restriction on calling the systemproperty service from a JS service?

When I call the same service directly from a web app (as shown in this example: webOS TV Device Information), it works without any issues.

Luna Service does not allow minus signs (-) in JS service names. To add a JS service to your app, please do not include a minus sign in your app ID. For more information, please refer to JS Service Usage. Thank you.

I’m not using minus signs in the JS service name. As I said, my service works well. Still, if I make a call to the systemproperty service within the function handler of one of the registered commands, the service gets terminated immediately.

Please share a sample app that we can reproduce the issue and check the source code at developer@lge.com. Thank you.

The issue was fixed. It was caused by invalid access to variables in the outer scope of the function callback. Thanks for the support.

2 Likes