Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'colorId' of null #3612

Closed
ddeenniiss opened this issue May 31, 2019 · 4 comments
Labels
async-migration Migration from callback-style programming to async functions Minor Bug

Comments

@ddeenniiss
Copy link

We have a lot of error like this.

[2019-05-31 14:51:16.994] [ERROR] console - (node:10107) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'colorId' of null
at p.then.authorInfo (/home/etherpad/public/etherpad/src/node/handler/PadMessageHandler.js:1199:37)
at process._tickCallback (internal/process/next_tick.js:68:7)
[2019-05-31 14:51:16.995] [ERROR] console - (node:10107) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
[2019-05-31 14:51:16.996] [ERROR] console - (node:10107) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@mixotroph
Copy link

[2019-07-11 20:40:05.168] [ERROR] console - (node:194) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 39)

@muxator muxator changed the title UnhandledPromiseRejectionWarning UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'colorId' of null Nov 26, 2019
@muxator muxator added the async-migration Migration from callback-style programming to async functions label Nov 26, 2019
@muxator
Copy link
Contributor

muxator commented Nov 26, 2019

Not working on it right now, but confirmed.

@xshadow
Copy link

xshadow commented Dec 12, 2019

I can confirm this is still a bug in 1.8.0, which is occurring a lot.

muxator pushed a commit to JohnMcLear/etherpad-lite that referenced this issue Mar 20, 2020
…not defined

For some reason authorInfo is sometimes null, and therefore it is not possible
to get colorId from it.

This resulted in the following stack trace:
    [2020-03-16 09:27:17.291] [ERROR] console - (node:1746) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'colorId' of null
    at <BASEDIR>/src/node/handler/PadMessageHandler.js:1199:37
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Promise.all (index 0)
    at async handleClientReady (<BASEDIR>/src/node/handler/PadMessageHandler.js:1171:5)
    [2020-03-16 09:27:17.291] [ERROR] console - (node:1746) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 76)
    [2020-03-16 09:27:19.034] [WARN] message - Dropped message, USERINFO_UPDATE Session not ready.[object Object]

Which is due to a bug in Etherpad that we are not going to solve now.

As a workaround, when this happens, let's set the username to "Anonymous" (if
it is not already set), and colorId to the fixed value "#daf0b2". Warning
messages are written in the logs to signal this condition.

This is no definitive solution, but fixes ether#3612 (via a workaround).
@muxator
Copy link
Contributor

muxator commented Mar 20, 2020

Fixed via a workaround in #3719.

The underlying bug still remains, but instead of a unhandled promise rejection, we'll get clear warning messages and a fallback to predefined values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
async-migration Migration from callback-style programming to async functions Minor Bug
Projects
None yet
Development

No branches or pull requests

4 participants