getDeviceList() hangs indefinitely.

getDeviceList() hangs indefinitely.


Hi, I am trying to use the getDeviceList snippet from here, in the plugin example code but that method never appears to return.
  1. const { core, ServiceModule } = require("@tago-io/tcore-sdk");
  2. const express = require('express');
  3. const app = express();

  4. let server = null;

  5. const service = new ServiceModule({
  6.     id: "getting-started-service",
  7.     name: "Getting Started Service",
  8.     configs: [
  9.         {
  10.             type: "number",
  11.             field: "port",
  12.             name: "Port",
  13.             required: true,
  14.         }
  15.     ],
  16. });

  17. service.onLoad = async (userValues) => {
  18.     if (!userValues.port) {
  19.         throw new Error("Invalid port");
  20.     }

  21.     app.get('/', (req, res) => {
  22.         res.send('Hello World')
  23.     });

  24.     server = app.listen(userValues.port);
  25.     getDeviceList();
  26. };

  27. async function getDeviceList() {
  28.     try {
  29.         console.log("Before getDeviceList()");
  30.         const list = await core.getDeviceList();
  31.         console.log("Retrieved", list.length, "devices"); 
  32.     } catch {
  33.         (error) => { console.log(error) };
  34.     }

  35.     service.onDestroy = () => {
  36.         server.close();
  37.     };
  38. }
I see the "Before getDeviceList()" log message but never the "Retreived" message.

I did add the Device permission in the manifest.

Am I missing something?

Cheers,

Erwin