Skip to content

Parse Server crash on FCM response GOAWAY #340

Closed
@mtrezza

Description

@mtrezza

New Issue Checklist

Issue Description

Parse Server crashes when FCM server responds with GOAWAY:

An uncaught exception occurred:
Error while making requests: GOAWAY - server_shutting_down, Error code: 0
Stack Trace:
  at ClientHttp2Session.<anonymous> (/var/app/current/node_modules/firebase-admin/lib/utils/api-request.js:994:23)
  at ClientHttp2Session.emit (node:events:517:28)
  at ClientHttp2Session.emit (node:domain:489:12)
  at Http2Session.onGoawayData (node:internal/http2/core:677:11)

These errors started to appear end of Nov 2024 without a change in the push adapter version, so there has likely been a change in the FCM server behavior. However, even if the firebase-admin SDK doesn't properly handle that response, the adapter should catch this error.

From a quick look into the adapter sending logic it seems that an error should be caught if the promise is rejected:

const allPromises = Promise.all(
slices.map((slice) => sendToDeviceSlice(slice, this.pushType)),
).catch((err) => {
log.error(LOG_PREFIX, `error sending push: ${err}`);
});

However, it seems that the FCM client has a bug and doesn't handle the GOAWAY response properly, i.e. throwing an error instead of rejecting a promise, so that exception propagates all the way to the server. See also firebase/firebase-admin-node#2789.

Steps to reproduce

This issue occurs on network error events, such as GOAWAY or ECONNRESET.

Actual Outcome

Parse Server crashes.

Expected Outcome

Parse Server should handle the error gracefully, log an error and not crash.

Workaround

Add a general exception handler to the Node process.

Environment

Client

  • Parse Server Push Adapter version: 6.7.0

Server

  • Parse Server version: 7.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions