pico-engine icon indicating copy to clipboard operation
pico-engine copied to clipboard

Deleting a pico with a scheduled task causes the pico-engine to crash upon running the task.

Open iso2013 opened this issue 3 years ago • 1 comments

Steps to reproduce:

  • Create a pico with a scheduled recurring task (I used io.picolabs.wovyn.emitter
  • Delete the pico
  • Wait for the next time the task will run
  • Pico engine crashes with this error:
/home/user/.nvm/versions/node/v16.13.1/lib/node_modules/pico-engine/node_modules/pico-framework/dist/src/PicoFramework.js:193
        throw new Error(`ECI not found ${eci}`);
              ^

Error: ECI not found ckxyw1shs00145bx90rwc9889
    at PicoFramework.getPico (/home/user/.nvm/versions/node/v16.13.1/lib/node_modules/pico-engine/node_modules/pico-framework/dist/src/PicoFramework.js:193:15)
    at Job.job (/home/user/.nvm/versions/node/v16.13.1/lib/node_modules/pico-engine/node_modules/pico-engine-core/dist/modules/schedule.js:87:33)
    at Job.invoke (/home/user/.nvm/versions/node/v16.13.1/lib/node_modules/pico-engine/node_modules/node-schedule/lib/schedule.js:175:17)
    at /home/user/.nvm/versions/node/v16.13.1/lib/node_modules/pico-engine/node_modules/node-schedule/lib/schedule.js:555:26
    at Timeout._onTimeout (/home/user/.nvm/versions/node/v16.13.1/lib/node_modules/pico-engine/node_modules/node-schedule/lib/schedule.js:512:7)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7)
Emitted 'error' event on Job instance at:
    at /home/user/.nvm/versions/node/v16.13.1/lib/node_modules/pico-engine/node_modules/node-schedule/lib/schedule.js:560:17

iso2013 avatar Jan 03 '22 16:01 iso2013

Looks like the pico-framework package throws an error from getPico if it's not found, while the code for schedule.js expects an undefined or null return value instead of an error if the pico isn't found.

iso2013 avatar Jan 03 '22 16:01 iso2013