Skip to content

Having trouble with some UI extensions #3302

@flatsiedatsie

Description

@flatsiedatsie

As an experiment, today I created a 100% pure Webthings Gateway disk image using the Candle disk image creation script.

curl -H 'Cache-Control: no-cache' -sSl https://raw.githubusercontent.com/createcandle/install-scripts/main/create_latest_candle_dev.sh -o create_latest_candle_dev.sh; sudo chmod +x create_latest_candle_dev.sh; sudo CUTTING_EDGE=yes CREATE_DISK_IMAGE=yes SKIP_WEBTHINGS_GATEWAY=no bash ./create_latest_candle_dev.sh

Oddly, it seemed my UI extension addons weren't loading with the latest Github version. The HTML, CSS and JS loads, but the JS in unable to connect with the backend. It always returns a 404 error.

So then I updated the script to use the official 2.0.0 release. And then ensuring the original versions of gateway-addon-node and gateway-addon-python were loaded. But still no luck.

I added some debugging console.log lines, and it seemed like the api handlers list remained empty.

I assumed I must be doing something wrong.

My next step was to try running the official Docker image on my Mac, just to eliminate all Candle influences.

But here the result is the same: the addon is visible, but all requests end in 404.

Image

.

(http or https makes no difference)

It's probably something in my addons that is out of spec. Are there any UI extension addons that I can test that you know work OK?

I checked that the api_handlers list was even supposed to be populated. But it seemed so. Here's what an API handler looks like in Candle:

  'photo-frame' => APIHandlerProxy {
    packageName: 'photo-frame',
    verbose: false,
    gatewayVersion: '',
    userProfile: {},
    preferences: {},
    plugin: Plugin {
      pluginId: 'photo-frame',
      addonManager: [AddonManager],
      pluginServer: [PluginServer],
      forceEnable: false,
      adapters: [Map],
      notifiers: Map(0) {},
      apiHandlers: [Map],
      exec: 'python3 {path}/main.py',
      execPath: '/home/pi/.webthings/addons/photo-frame',
      process: [Object],
      restart: true,
      restartDelay: 0,
      lastRestart: 0,
      pendingRestart: null,
      unloadCompletedPromise: null,
      nextId: 3,
      requestActionPromises: Map(0) {},
      removeActionPromises: Map(0) {},
      setPinPromises: Map(0) {},
      setCredentialsPromises: Map(0) {},
      notifyPromises: Map(0) {},
      apiRequestPromises: Map(0) {},
      unloding: false,
      logPrefix: 'photo-frame',
      startPromise: [Promise],
      stdoutReadline: [Interface],
      stderrReadline: [Interface],
      ws: [WebSocket]
    },
    unloadCompletedPromise: null
  },

(I've created a pull request to fix the "unloding" typo)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions