zeyneloz / onesignal-node

A Node.js Library for OneSignal push notification service
MIT License
207 stars 48 forks source link

Hitting a lot of HTTP 524 errors and other upstream errors. #82

Open cocotton opened 2 years ago

cocotton commented 2 years ago

We're receiving quite a lot of errors suggesting OneSignal is down, but I'm not sure if it's actually the case or if we're rather being rate limited. Here's an example of the different errors we're receiving:

Error: upstream connect error or disconnect/reset before headers. reset reason: overflow at Request._callback (/app/backend/node_modules/onesignal-node/src/utils.ts:56:23) at Request.self.callback (/app/backend/node_modules/request/request.js:185:22) at Request.emit (node:events:390:28) at Request.emit (node:domain:475:12) at Request.<anonymous> (/app/backend/node_modules/request/request.js:1154:10) at Request.emit (node:events:390:28) at Request.emit (node:domain:475:12) at IncomingMessage.<anonymous> (/app/backend/node_modules/request/request.js:1076:12) at Object.onceWrapper (node:events:509:28) at IncomingMessage.emit (node:events:402:35) at IncomingMessage.emit (node:domain:475:12) at endReadableNT (node:internal/streams/readable:1343:12) at processTicksAndRejections (node:internal/process/task_queues:83:21) 
Error: upstream connect error or disconnect/reset before headers. reset reason: connection failure at Request._callback (/app/backend/node_modules/onesignal-node/src/utils.ts:56:23) at Request.self.callback (/app/backend/node_modules/request/request.js:185:22) at Request.emit (node:events:390:28) at Request.emit (node:domain:475:12) at Request.<anonymous> (/app/backend/node_modules/request/request.js:1154:10) at Request.emit (node:events:390:28) at Request.emit (node:domain:475:12) at IncomingMessage.<anonymous> (/app/backend/node_modules/request/request.js:1076:12) at Object.onceWrapper (node:events:509:28) at IncomingMessage.emit (node:events:402:35) at IncomingMessage.emit (node:domain:475:12) at endReadableNT (node:internal/streams/readable:1343:12) at processTicksAndRejections (node:internal/process/task_queues:83:21) 
Error: <html> <head><title>524 Origin Time-out</title></head> <body bgcolor="white"> <center><h1>524 Origin Time-out</h1></center> <hr><center>cloudflare-nginx</center> </body> </html> at Request._callback (/app/backend/node_modules/onesignal-node/src/utils.ts:56:23) at Request.self.callback (/app/backend/node_modules/request/request.js:185:22) at Request.emit (node:events:390:28) at Request.emit (node:domain:475:12) at Request.<anonymous> (/app/backend/node_modules/request/request.js:1154:10) at Request.emit (node:events:390:28) at Request.emit (node:domain:475:12) at IncomingMessage.<anonymous> (/app/backend/node_modules/request/request.js:1076:12) at Object.onceWrapper (node:events:509:28) at IncomingMessage.emit (node:events:402:35) at IncomingMessage.emit (node:domain:475:12) at endReadableNT (node:internal/streams/readable:1343:12) at processTicksAndRejections (node:internal/process/task_queues:83:21) 
Error: at Request._callback (/app/backend/node_modules/onesignal-node/src/utils.ts:56:23) at Request.self.callback (/app/backend/node_modules/request/request.js:185:22) at Request.emit (node:events:390:28) at Request.emit (node:domain:475:12) at Request.<anonymous> (/app/backend/node_modules/request/request.js:1154:10) at Request.emit (node:events:390:28) at Request.emit (node:domain:475:12) at IncomingMessage.<anonymous> (/app/backend/node_modules/request/request.js:1076:12) at Object.onceWrapper (node:events:509:28) at IncomingMessage.emit (node:events:402:35) at IncomingMessage.emit (node:domain:475:12) at endReadableNT (node:internal/streams/readable:1343:12) at processTicksAndRejections (node:internal/process/task_queues:83:21) 

Have you ever had these kinds of errors before? Trying to figure out how I could prevent them from happening.

max-sv-ma commented 2 years ago

@cocotton

TL;DR: Its a OneSignal issue and not a package issue

Full explanation: I've also encountered such an issue while trying to create push notifications. After some investigation - it appears to be a problem from the OneSignal side, the error code is being thrown from AWS Cloudflare and the status code usually means timeout from that service.

After some investigation, it appears that my target segments were "too large", so large that even on the OneSignal dashboard, the segment couldn't be loaded (and even when using the chrome network inspector, there were 524 errors on those segments).

cocotton commented 2 years ago

@max-sv-ma oh that's very interesting, thanks for the update! I'll try to reproduce the error with large segments then.