Cannot find module error [models/availabilities.js]

Hello everyone!

We encountered a random error originating from our userUpdate timer.

Cannot find module ‘/opt/backendless/repo/4a47197b-ae30-fa84-ff56-0071f4010900/files/servercode/CODELESS/default/PRODUCTION/models/availabilities.js’\nRequire stack:\n- /usr/local/lib/node_modules/backendless-coderunner/lib/server-code/api/index.js\n- /usr/local/lib/node_modules/backendless-coderunner/lib/server-code/runners/cloud-worker.js. This issue is caused by [models/availabilities.js]

Upon investigation, we found that the availabilities file still exists in the models.


Here’s our App ID 4A47197B-AE30-FA84-FF56-0071F4010900

Thank you for your assistance in looking into this.

Best regards,
Francis

Hi @Francis_Bagas

I found in the logs the issue happens right after the deploy process:

2025-06-05 18:42:00,232 | SERVER_CODE |  INFO | [278233] [ANALYSE CODE] codePath: /opt/backendless/repo/4a47197b-ae30-fa84-ff56-0071f4010900/files/servercode/CODELESS/default/DRAFT
2025-06-05 18:42:00,234 | SERVER_CODE |  INFO | [278233] Building Model..
2025-06-05 18:42:00,781 | SERVER_CODE |  INFO | [278233] ServerCode Model built in 547ms
2025-06-05 18:42:00,781 | SERVER_CODE |  INFO | [278233] Event handlers (3):
2025-06-05 18:42:00,781 | SERVER_CODE |  INFO | [278233]   persistence.afterCreate (errors) (handlers/persistence/errors/afterCreate.js)
....
2025-06-05 18:42:00,782 | SERVER_CODE |  INFO | [278233] Timers (40):
2025-06-05 18:42:00,782 | SERVER_CODE |  INFO | [278233]   AddPlacementTask_SDR (timers/addplacementtask_sdr.js)
....
2025-06-05 18:42:00,785 | SERVER_CODE |  INFO | [278233]   ZoomRemoveCoHostSession (timers/zoomremovecohostsession.js)
2025-06-05 18:42:00,785 | SERVER_CODE |  INFO | [278233] Custom Types (19):
2025-06-05 18:42:00,785 | SERVER_CODE |  INFO | [278233]   Availabilities (models/availabilities.js)
....
2025-06-05 18:42:00,793 | SERVER_CODE |  INFO | [278233] Processing finished in 680.137ms

------

2025-06-05 18:42:02,883 | SERVER_CODE |  INFO | [277408] Building ServerCode Model for path (/opt/backendless/repo/4a47197b-ae30-fa84-ff56-0071f4010900/files/servercode/CODELESS/default/PRODUCTION)
2025-06-05 18:42:02,898 | SERVER_CODE |  INFO | [277408] ServerCode Model built in 18ms
2025-06-05 18:42:02,900 | SERVER_CODE | ERROR | [277408] Error: Cannot find module '/opt/backendless/repo/4a47197b-ae30-fa84-ff56-0071f4010900/files/servercode/CODELESS/default/PRODUCTION/models/availabilities.js'

So, I assume it appears because of a delay with synchronization FilesSystem:

  • when it’s deploying all files are put in a temp directory
  • then it runs the “analyze” task to make sure the deployment model is valid
  • then the temp folder replaces the prod folder
  • and finally, when both tasks (deploy/timer-invocation) are very close to each other, it can run into the issue when physically there is no required file

I am going to ask our backend team to take a look

Regards,
Vlad

1 Like