diff --git a/server/src/plugin/plugin-host-api.ts b/server/src/plugin/plugin-host-api.ts index c2305fadd..7e16b838a 100644 --- a/server/src/plugin/plugin-host-api.ts +++ b/server/src/plugin/plugin-host-api.ts @@ -146,7 +146,9 @@ export class PluginHostAPI extends PluginAPIManagedListeners implements PluginAP throw new Error(`providerId state not found for device ${p._id}`); return state.value === provider._id; }); - const devices = deviceManifest.devices || []; + if (!deviceManifest.devices) + throw new Error(`onDevicesChanged called without devices for provider ${deviceManifest.providerNativeId}`); + const devices = deviceManifest.devices; const newIds = devices.map(device => device.nativeId); const toRemove = existing.filter(e => e.nativeId && !newIds.includes(e.nativeId)); diff --git a/server/src/services/cluster-fork.ts b/server/src/services/cluster-fork.ts index 0773d15cb..7847bcb37 100644 --- a/server/src/services/cluster-fork.ts +++ b/server/src/services/cluster-fork.ts @@ -82,7 +82,7 @@ export class ClusterForkService { const fork: ClusterForkParam = await worker.fork; const forkResultPromise = fork(options.runtime!, runtimeWorkerOptions, peerLiveness, getZip); - options.id! ||= this.runtime.findPluginDevice(runtimeWorkerOptions.packageJson.name)!._id; + options.id! ||= this.runtime.findPluginDevice(runtimeWorkerOptions.packageJson.name)?._id; // the server is responsible for killing the forked process when the requestor is killed. // minimizes lifecycle management duplication in python and node.