-
-
Notifications
You must be signed in to change notification settings - Fork 107
Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest versions of Parse Server and the Parse Server Push Adapter.
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:
parse-server-push-adapter/src/FCM.js
Lines 141 to 145 in 5409e48
| 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