Rocket.Chat.Apps-engine
Rocket.Chat.Apps-engine copied to clipboard
[FIX] Set message editor prop by default on updates
What? :boat:
When calling the method modify.getUpdater().message(messageId, user), the user property wasn't being used.
Why? :thinking:
As the property is needed when updating a message, the server throws an error and crashes.
Example app code that raises the issue
async function updateMessage(modify: IModify, user: IUser, messageId: string): Promise<void> {
const messageBuilder = await modify.getUpdater().message(messageId, user);
const oldMessageText = messageBuilder.getText();
const newMessageText = `${oldMessageText}\nUPDATE: this message got updated at ${new Date()}`;
messageBuilder.setText(newMessageText);
await modify.getUpdater().finish(messageBuilder);
}
Error messages
W20220825-17:19:06.265(-3)? (STDERR) === UnHandledPromiseRejection ===
W20220825-17:19:06.267(-3)? (STDERR) Error: Invalid editor assigned to the message for the update.
W20220825-17:19:06.267(-3)? (STDERR) at app/apps/server/bridges/messages.ts:43:10
W20220825-17:19:06.267(-3)? (STDERR) at /<REDACTED>/.meteor/packages/promise/.0.12.0.awlna7.wkccv++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/meteor-promise/fiber_pool.js:43:40
W20220825-17:19:06.267(-3)? (STDERR) at Object.pe [as messagesBridgeUsageSimulation] (evalmachine.<anonymous>:2:556)
W20220825-17:19:06.267(-3)? (STDERR) ---------------------------------
W20220825-17:19:06.267(-3)? (STDERR) Errors like this can cause oplog processing errors.
W20220825-17:19:06.268(-3)? (STDERR) Setting EXIT_UNHANDLEDPROMISEREJECTION will cause the process to exit allowing your service to automatically restart the process
W20220825-17:19:06.268(-3)? (STDERR) Future node.js versions will automatically exit the process
W20220825-17:19:06.268(-3)? (STDERR) =================================
Followed by:
W20220825-17:19:19.741(-3)? (STDERR) Error: the worker has exited
W20220825-17:19:19.743(-3)? (STDERR) at ThreadStream.write (/REDACTED/apps/meteor/node_modules/thread-stream/index.js:214:13)
W20220825-17:19:19.743(-3)? (STDERR) at Pino.write (/REDACTED/apps/meteor/node_modules/pino/lib/proto.js:208:10)
W20220825-17:19:19.744(-3)? (STDERR) at Pino.LOG (/REDACTED/apps/meteor/node_modules/pino/lib/tools.js:58:21)
W20220825-17:19:19.745(-3)? (STDERR) at Pino.logMethod (server/lib/logger/getPino.ts:13:16)
W20220825-17:19:19.746(-3)? (STDERR) at Pino.hookWrappedLog [as http] (/REDACTED/apps/meteor/node_modules/pino/lib/tools.js:38:10)
W20220825-17:19:19.746(-3)? (STDERR) at Object._internalRouteActionHandler [as action] (app/api/server/api.js:478:11)
W20220825-17:19:19.746(-3)? (STDERR) at Route._callEndpoint (packages/rocketchat_restivus/lib/route.coffee:150:32)
W20220825-17:19:19.746(-3)? (STDERR) at packages/rocketchat_restivus/lib/route.coffee:59:33
W20220825-17:19:19.747(-3)? (STDERR) at packages/simple_json-routes.js:100:9
W20220825-17:19:20.830(-3)? (STDERR) Error: the worker has exited
W20220825-17:19:20.831(-3)? (STDERR) at ThreadStream.write (/REDACTED/apps/meteor/node_modules/thread-stream/index.js:214:13)
W20220825-17:19:20.832(-3)? (STDERR) at Pino.write (/REDACTED/apps/meteor/node_modules/pino/lib/proto.js:208:10)
W20220825-17:19:20.832(-3)? (STDERR) at Pino.LOG (/REDACTED/apps/meteor/node_modules/pino/lib/tools.js:58:21)
W20220825-17:19:20.833(-3)? (STDERR) at Pino.logMethod (server/lib/logger/getPino.ts:13:16)
W20220825-17:19:20.833(-3)? (STDERR) at Pino.hookWrappedLog [as http] (/REDACTED/apps/meteor/node_modules/pino/lib/tools.js:38:10)
W20220825-17:19:20.833(-3)? (STDERR) at Object._internalRouteActionHandler [as action] (app/api/server/api.js:478:11)
W20220825-17:19:20.834(-3)? (STDERR) at Route._callEndpoint (packages/rocketchat_restivus/lib/route.coffee:150:32)
W20220825-17:19:20.834(-3)? (STDERR) at packages/rocketchat_restivus/lib/route.coffee:59:33
W20220825-17:19:20.835(-3)? (STDERR) at packages/simple_json-routes.js:100:9
W20220825-17:19:22.870(-3)? (STDERR) Error: the worker has exited
W20220825-17:19:22.872(-3)? (STDERR) at ThreadStream.write (/REDACTED/apps/meteor/node_modules/thread-stream/index.js:214:13)
W20220825-17:19:22.872(-3)? (STDERR) at Pino.write (/REDACTED/apps/meteor/node_modules/pino/lib/proto.js:208:10)
W20220825-17:19:22.873(-3)? (STDERR) at Pino.LOG (/REDACTED/apps/meteor/node_modules/pino/lib/tools.js:58:21)
W20220825-17:19:22.873(-3)? (STDERR) at Pino.logMethod (server/lib/logger/getPino.ts:13:16)
W20220825-17:19:22.873(-3)? (STDERR) at Pino.hookWrappedLog [as http] (/REDACTED/apps/meteor/node_modules/pino/lib/tools.js:38:10)
W20220825-17:19:22.874(-3)? (STDERR) at Object._internalRouteActionHandler [as action] (app/api/server/api.js:478:11)
W20220825-17:19:22.874(-3)? (STDERR) at Route._callEndpoint (packages/rocketchat_restivus/lib/route.coffee:150:32)
W20220825-17:19:22.875(-3)? (STDERR) at packages/rocketchat_restivus/lib/route.coffee:59:33
W20220825-17:19:22.875(-3)? (STDERR) at packages/simple_json-routes.js:100:9
W20220825-17:19:26.921(-3)? (STDERR) Error: the worker has exited
W20220825-17:19:26.922(-3)? (STDERR) at ThreadStream.write (/REDACTED/apps/meteor/node_modules/thread-stream/index.js:214:13)
W20220825-17:19:26.923(-3)? (STDERR) at Pino.write (/REDACTED/apps/meteor/node_modules/pino/lib/proto.js:208:10)
W20220825-17:19:26.923(-3)? (STDERR) at Pino.LOG (/REDACTED/apps/meteor/node_modules/pino/lib/tools.js:58:21)
W20220825-17:19:26.924(-3)? (STDERR) at Pino.logMethod (server/lib/logger/getPino.ts:13:16)
W20220825-17:19:26.924(-3)? (STDERR) at Pino.hookWrappedLog [as http] (/REDACTED/apps/meteor/node_modules/pino/lib/tools.js:38:10)
W20220825-17:19:26.924(-3)? (STDERR) at Object._internalRouteActionHandler [as action] (app/api/server/api.js:478:11)
W20220825-17:19:26.925(-3)? (STDERR) at Route._callEndpoint (packages/rocketchat_restivus/lib/route.coffee:150:32)
W20220825-17:19:26.925(-3)? (STDERR) at packages/rocketchat_restivus/lib/route.coffee:59:33
W20220825-17:19:26.925(-3)? (STDERR) at packages/simple_json-routes.js:100:9
W20220825-17:19:36.957(-3)? (STDERR) Error: the worker has exited
W20220825-17:19:36.957(-3)? (STDERR) at ThreadStream.write (/REDACTED/apps/meteor/node_modules/thread-stream/index.js:214:13)
W20220825-17:19:36.958(-3)? (STDERR) at Pino.write (/REDACTED/apps/meteor/node_modules/pino/lib/proto.js:208:10)
W20220825-17:19:36.958(-3)? (STDERR) at Pino.LOG (/REDACTED/apps/meteor/node_modules/pino/lib/tools.js:58:21)
W20220825-17:19:36.958(-3)? (STDERR) at Pino.logMethod (server/lib/logger/getPino.ts:13:16)
W20220825-17:19:36.958(-3)? (STDERR) at Pino.hookWrappedLog [as http] (/REDACTED/apps/meteor/node_modules/pino/lib/tools.js:38:10)
W20220825-17:19:36.959(-3)? (STDERR) at Object._internalRouteActionHandler [as action] (app/api/server/api.js:478:11)
W20220825-17:19:36.959(-3)? (STDERR) at Route._callEndpoint (packages/rocketchat_restivus/lib/route.coffee:150:32)
W20220825-17:19:36.959(-3)? (STDERR) at packages/rocketchat_restivus/lib/route.coffee:59:33
W20220825-17:19:36.959(-3)? (STDERR) at packages/simple_json-routes.js:100:9