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

fix: unhandledRejection types are looser than assumed #18286

Merged
merged 3 commits into from
Oct 31, 2023

Conversation

pauldambra
Copy link
Member

We had a period of c 90 minutes where blob ingestion was failing to start

See https://posthog.slack.com/archives/C0185UNBSJZ/p1698707508193559?thread_ts=1698684867.238139&cid=C0185UNBSJZ

The errors that were (maybe) causing this were hidden because a top level handler for unhandledRejection assumed that it always received an Error from which it could read stack

Slightly ridiculously the error being received was undefined https://posthog.sentry.io/issues/4410219272/?query=is%3Aunresolved+PLUGIN_SERVER_MODE%3Arecordings-blob-ingestion&referrer=issue-stream&statsPeriod=1h&stream_index=2

Looking at https://nodejs.org/docs/latest-v18.x/api/process.html#event-unhandledrejection the signature for the handler is

Event: 'unhandledRejection'
reason <Error> | <any> The object with which the promise was rejected (typically an Error object).
promise <Promise> The rejected promise.

This changes the handler to log the error without trying to read its properties, bringing the log message to almost match the example from the docs

@pauldambra pauldambra merged commit ad0e61d into master Oct 31, 2023
68 checks passed
@pauldambra pauldambra deleted the fix/no-bueno-to-throw-undefined branch October 31, 2023 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants