Error when uploading an icon for a thing

I have written a webthing and have tried to upload an icon for it from the web UI which does not seem to work and in the log I get:

2021-02-06 11:34:36.256 ERROR : Failed to write icon: Error: template option must be relative to “/tmp”, found “/etc/webthings-gateway/uploads/XXXXXX.png”.
at _assertIsRelative (/opt/webthings-gateway/node_modules/tmp/lib/tmp.js:599:13)
at _assertAndSanitizeOptions (/opt/webthings-gateway/node_modules/tmp/lib/tmp.js:516:5)
at tmpNameSync (/opt/webthings-gateway/node_modules/tmp/lib/tmp.js:105:3)
at Object.fileSync (/opt/webthings-gateway/node_modules/tmp/lib/tmp.js:170:16)
at Thing.setIcon (/opt/webthings-gateway/build/webpack:/src/models/thing.js:290:1)
at ./src/controllers/things_controller.js.ThingsController.put (/opt/webthings-gateway/build/webpack:/src/controllers/things_controller.js:361:1)
2021-02-06 11:34:36.260 ERROR : macrozilla: Unknown message from device function () {
2021-02-06 11:34:36.262 ERROR : macrozilla: return this.href().substr(this.href().lastIndexOf(’/’) + 1);
2021-02-06 11:34:36.263 ERROR : macrozilla: } : thingModified ( {} )
2021-02-06 11:34:36.269 ERROR : macrozilla: Unknown message from device function () {
2021-02-06 11:34:36.279 ERROR : macrozilla: return this.href().substr(this.href().lastIndexOf(’/’) + 1);
2021-02-06 11:34:36.281 ERROR : macrozilla: } : thingModified ( {} )
2021-02-06 11:34:37.046 INFO : zigbee-adapter: Looked frame.remote64 00158d0004fd0a25 from cd95

Is this a problem caused by me not using the Pi image but installing the package or a more general bug?

–chris

It’s a known issue that was fixed after 1.0.0 was released.

2 Likes

The follow up for this question would be is it possible for a webthing to provide it’s own icon?

No, that’s not currently possible.

Cool idea though. Maybe you could suggest it to the Thing Description task force of the Web of Things Working Group.

The icons member of a web app manifest could be re-used for this purpose.

1 Like