Skip to content

Conversation

@d-gubert
Copy link
Member

@d-gubert d-gubert commented Aug 26, 2025

Proposed changes (including videos or screenshots)

Fixes an unhandled promise rejection crash that would happen during server startup if any of the apps installed had a compile error.

Issue(s)

Error while compiling the App "Poll (c33fa1a6-68a7-491e-bf49-9d7b99671c48)":
MongoRuntimeError: FileNotFound: file 68ae1211d4fb1c07f2a25c7e was not found
    at handleReadResult (/home/douglas-gubert/.meteor/packages/npm-mongo/.6.10.2.1c1ehc0jglx++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/mongodb/src/gridfs/download.ts:318:19)
    at processTicksAndRejections (node:internal/process/task_queues:105:5) {
  code: 'ENOENT',
  [Symbol(errorLabels)]: Set(0) {}
}
=== UnHandledPromiseRejection ===
TypeError: this.appRuntime.on is not a function
    at new ProxiedApp (/work/RocketChat/Rocket.Chat/packages/apps-engine/src/server/ProxiedApp.ts:27:19)
    at AppManager.<anonymous> (/work/RocketChat/Rocket.Chat/packages/apps-engine/src/server/AppManager.ts:279:17)
    at Generator.throw (<anonymous>)
    at rejected (/work/RocketChat/Rocket.Chat/packages/apps-engine/server/AppManager.js:6:65)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
---------------------------------
Errors like this can cause oplog processing errors.
Setting EXIT_UNHANDLEDPROMISEREJECTION will cause the process to exit allowing your service to automatically restart the process
Future node.js versions will automatically exit the process
=================================

Steps to test or reproduce

Further comments

CORE-1255

This PR keeps the solution simple in order to be "backportable". A proper refactor is implemented in #36803

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Aug 26, 2025

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Aug 26, 2025

🦋 Changeset detected

Latest commit: 85dcd23

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 40 packages
Name Type
@rocket.chat/apps-engine Patch
@rocket.chat/meteor Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/core-typings Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/rest-typings Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/gazzodown Patch
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/license Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/ui-voip Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link

codecov bot commented Aug 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.11%. Comparing base (a6bb80e) to head (85dcd23).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #36802      +/-   ##
===========================================
- Coverage    66.12%   66.11%   -0.01%     
===========================================
  Files         3302     3302              
  Lines       110951   110951              
  Branches     21044    21042       -2     
===========================================
- Hits         73364    73359       -5     
- Misses       34916    34918       +2     
- Partials      2671     2674       +3     
Flag Coverage Δ
e2e 57.28% <ø> (+0.01%) ⬆️
unit 71.44% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@d-gubert d-gubert marked this pull request as ready for review August 26, 2025 21:39
@d-gubert d-gubert requested a review from a team as a code owner August 26, 2025 21:39
@d-gubert d-gubert changed the title fix: unhandled promise rejection if app has compiler error on startup fix: prevent unhandled promise rejection if app has compiler error on startup Aug 27, 2025
@ggazzo ggazzo added the stat: QA assured Means it has been tested and approved by a company insider label Aug 27, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Aug 27, 2025
@ggazzo ggazzo merged commit e497d94 into develop Aug 27, 2025
54 checks passed
@ggazzo ggazzo deleted the fix/app-missing-package-crash branch August 27, 2025 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants