onesignal-node
onesignal-node copied to clipboard
ETIMEDOUT issue
I am getting below error {"errno":"ETIMEDOUT","code":"ETIMEDOUT","syscall":"connect","address":"104.18.225.52","port":443}
Is something wrong
ETIMEDOUT
means that connection to onesignal server is timed out. The default timeout value is 2 minutes for the requests but might vary depending on the kernel. Regardless, I don't think increasing timeout value will solve the problem. There might be many reasons for this error (problems with internet connection, firewall or onesignal server etc..). I would suspect that somehow you cant access to OneSignal servers from the conection you are trying on. Can you please try to visit this page: https://onesignal.com/api/v1/apps
and leave a comment if you get any response and what is the response (trying with both curl, wget etc.
and a webbrowser would provide more information).
{ errors: [ "Please include a case-sensitive header of Authorization: Basic <YOUR-USER-AUTH-KEY-HERE> with a valid User Auth key." ], reference: [ "https://documentation.onesignal.com/docs/accounts-and-keys#section-user-auth-key" ] } I get above response but l am trying to access this from AWS BeanStalk/lambda function and both have an issue
You need to debug the problem inside of your lambda function. OneSignal client is using request library underneath. It is just making http calls to OneSignal REST API (i.e: https://onesignal.com/api/v1/app). You can try to make http requests to different endpoints or even different websites (https://github.com/) using request
library, and check if they work. I am suspecting that there are some misconfigurations with your AWS VPC or Internet Gateway.
I am also facing the same issue for past few days. on the same server. { "name": "RequestError", "message": "Error: connect ETIMEDOUT 104.18.225.52:443", "cause": { "errno": "ETIMEDOUT", "code": "ETIMEDOUT", "syscall": "connect", "address": "104.18.225.52", "port": 443 }, "error": { "errno": "ETIMEDOUT", "code": "ETIMEDOUT", "syscall": "connect", "address": "104.18.225.52", "port": 443 },
Since multiple users are getting this error, it is probably an issue with OneSignal server. Please contact to OneSignal team and describe the issue you have. You can find the contact details at the bottom of this page. I want to remind that this is not an official library from OneSignal itself but it is developed and maintained by open source contributors. Since this issue seems to be related to OneSignal itself, there is little I can do.
I am also having the same error for last 15 to 20 days
Error: connect ETIMEDOUT 104.18.225.52:443
0|server | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
0|server | errno: 'ETIMEDOUT',
0|server | code: 'ETIMEDOUT',
0|server | syscall: 'connect',
0|server | address: '104.18.225.52',
0|server | port: 443
0|server | }
there is a workaround shared by OneSignal team: Add entry in host file of your linux box. onesignal.com 104.18.226.52
Working fine for me now.
I reported this issue earlier. What's strange is it doesn't work in local but is working in production
I am not using this repo but I am facing the same issue on development server it works fine on my local env
sendNotificationToUser(data) {
try {
var notificationData = {}
notificationData.app_id = oneSignalAppId
notificationData.headings = {
en: "Heading"
}
notificationData.contents = {
en: data.message
}
notificationData.include_player_ids = [data.deviceId]
var headers = {
"Content-Type": "application/json; charset=utf-8"
}
var options = {
host: "onesignal.com",
port: 443,
path: "/api/v1/notifications",
method: "POST",
headers: headers
}
var https = require("https")
var req = https.request(options, function (res) {
res.on("data", function (data1) {
console.log("Response:")
console.log(JSON.parse(data1))
})
})
req.on("error", function (e) {
console.log("ERROR:")
console.log(e)
})
req.write(JSON.stringify(notificationData))
req.end()
} catch (err) {
console.log("err in notification", err)
}
}
i have copy pasted this from oneSignals website but it still gives me the same error this api works 50% of times and 50% of times it responds with time out error, even all the inputs are correct
ERROR:
{
Error: connect ETIMEDOUT 104.18.225.52:443
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
syscall: 'connect',
address: '104.18.225.52',
port: 443
}
Please check my comment above. I had the same issue and got the response from onesignal team itself.
I am using lens where should I add it in lens?
I think fastest way should be to connect with their support team.
there is a workaround shared by OneSignal team: Add entry in host file of your linux box. onesignal.com 104.18.226.52
Working fine for me now.
104.18.226.52
Did you type the IP Wrongly ?
Should it be 104.18.225.52
@thekunalmaheshwari
No the IP i mention is correct. onesignal is pointing to both IPs. 104.18.226.52 and 104.18.225.52 When your call goes to 104.18.225.52 it is failing. after adding host entry as:
onesignal.com 104.18.226.52
your request will work seamlessly.
Now also its having issues. Anybody is checking on this. I have added the contents in hosts, Still no luck
Same issue here since last 3 days
I am not using this repo but I am facing the same issue on development server it works fine on my local env
sendNotificationToUser(data) { try { var notificationData = {} notificationData.app_id = oneSignalAppId notificationData.headings = { en: "Heading" } notificationData.contents = { en: data.message } notificationData.include_player_ids = [data.deviceId] var headers = { "Content-Type": "application/json; charset=utf-8" } var options = { host: "onesignal.com", port: 443, path: "/api/v1/notifications", method: "POST", headers: headers } var https = require("https") var req = https.request(options, function (res) { res.on("data", function (data1) { console.log("Response:") console.log(JSON.parse(data1)) }) }) req.on("error", function (e) { console.log("ERROR:") console.log(e) }) req.write(JSON.stringify(notificationData)) req.end() } catch (err) { console.log("err in notification", err) } }
i have copy pasted this from oneSignals website but it still gives me the same error this api works 50% of times and 50% of times it responds with time out error, even all the inputs are correct
ERROR: { Error: connect ETIMEDOUT 104.18.225.52:443 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14) errno: 'ETIMEDOUT', code: 'ETIMEDOUT', syscall: 'connect', address: '104.18.225.52', port: 443 }
one simple solution is to directly hit the working ip, you can do this by including host: 'onesignal.con' in headers and host: '104.18.226.52' in options
this resolved my issue
to know more about how you can specify ip with host in https request go here https://stackoverflow.com/questions/53522723/https-request-specifying-hostname-and-specific-ip-address
Thanks, @ajay-wohlig. But exactly not sure in future this might happen again. Now it works fine I just add the hostname in the header.
var headers = {
'Content-Type': 'application/json; charset=utf-8',
Authorization: Basic ${process.env.ONE_SIGNAL_REST_API_KEY}
,
host: 'onesignal.com'
};
Hey, is this issue fixed? it's very irritating for the creators on our cms side, they need to keep on redoing the notification toggle action till it successfully sends notification
It Is Working Fine With Mobile Data Internet , Once You Connect With Internet Using Broadband Internet Its Works only 10%, and Give 90% times ETIMEDOUT.
Still Doesn't Get This Issue What Is Causing This Error.... But In Mean Time Of Development Use Mobile Data.. This Works ..!
@badinenisaivardhan I am also facing a similar issue while making server(node.js) to server. The strange thing is I am facing an issue on Airtel broadband (XStream) and only on a development server. Changing the network or using VPN did the trick.
I don't understand why it is not working with Airtel broadband. Not many resources on the internet on this.
If anyone can help with this, I want to understand why such behaviour ?
Hey.. @siddharth-compro I Hope You are from India, Try using Jio / Airtel Mobile Hotspot It Works , But If You Want To Deploy Your App Use Vercel/Render or Replit ..!! I Have Deployed the Code On This Platforms and worked without issue.. !! Coming to Your Question: ISP Point Of View : May be Some Issue With Tier1- Tier2 ISP/Proxies That Are Not Allowing Connection,... I OneSignal Help : I Have Also Reached To One Signal Tech Team For Help , The Reply I Got
Hi there, thanks for reaching out.
Generally, these should be rare, but when timeout and 500 range errors occur, it will require setting up a retry to send again. We don't have any built-in retries for these for these.
If you create your own retries, we recommend setting a 60 second HTTP timeout and retry after 60 seconds.
Again, these issues should be rare, but if you are running into them frequently, please provide: 1 - the date and time (with timezone) the error occurred
2 - if you are still seeing these errors
3 - any logs or steps to reproduce that you can
We do our best to update our status page as often as possible, so please follow us on https://status.onesignal.com/ or twitter @onesignalstatus https://twitter.com/onesignalstatus
OneSignal Should Figure Out the Solution In Coming Rollout Updates But Probable Solution To Workaround is Mobile Providers Like Jio/Airtel , Hope this Helps You Mate 👍
@badinenisaivardhan Thankyou for such quick response.
Yes, I am from India 😃
ISP Point Of View : May be Some Issue With Tier1- Tier2 ISP/Proxies That Are Not Allowing Connection
Just to add here, I tried using Airtel mobile network same problem persists. As I mentioned earlier, it works with other networks like Jio, etc or using some VPN service. I just want to dig deeper into the reason behind the timeouts. But from your response it seems that it is some issue with ISP(In my case Airtel) that are not allowing connections.
I had a colleague that faced the same issue.
He had an active Ad blocker that was interrupting the connection to the server. Worked fine after removing ad blocker.