FlowFuse / flowfuse

Connect, collect, transform, visualise, and interact with your Industrial Data in a single platform. Use FlowFuse to manage, scale and secure your Node-RED solutions.
https://flowfuse.com
Other
283 stars 64 forks source link

Device status update when device not found needs error handling #2972

Closed sentry-io[bot] closed 1 year ago

sentry-io[bot] commented 1 year ago

A post to /api/comms/auth/acl with a deviceId that is not found, leads to an exception as we're trying to check device.ownerType but device is undefined.

Seems to have been introduced in https://github.com/FlowFuse/flowfuse/pull/2835

Sentry Issue: FLOWFUSE-BACKEND-T

TypeError: Cannot read properties of null (reading 'ownerType')
  File "/usr/src/forge/app/node_modules/@flowforge/flowforge/forge/comms/devices.js", line 69, in DeviceCommsHandler.handleStatus
    const isApplicationOwned = device.ownerType === 'application' && device.Application?.id
  File "<anonymous>", in runMicrotasks
  File "node:internal/process/task_queues", line 96, in processTicksAndRejections
Pezmc commented 1 year ago

Fixed in https://github.com/FlowFuse/flowfuse/pull/2978