3 months ago
I had a piece of python code on one of my railway deployments that was communicating with a javascript websocket on another of my railway deployments. After I restarted the service for the javascript websocket today, I started to received connection refused messages like this:
BadRequestError: request aborted
at IncomingMessage.onAborted (/app/node_modules/raw-body/index.js:245:10)
at IncomingMessage.emit (node:events:517:28)
at IncomingMessage._destroy (node:_http_incoming:224:10)
at _destroy (node:internal/streams/destroy:109:10)
at IncomingMessage.destroy (node:internal/streams/destroy:71:5)
at abortIncoming (node:_http_server:781:9)
at socketOnClose (node:_http_server:775:3)
at Socket.emit (node:events:529:35)
at TCP. (node:net:350:12)
This was not happening 1 week ago and I didnt change anything in the code
0 Replies
and from my python client
ERROR:root:Error connecting to WebSocket server: [Errno 111] Connect call failed ('fd12:2ad:180d:0:4000:1e:a81f:9553', 8080, 0, 0)
Traceback (most recent call last):
File "/app/telegram-bot.py", line 1270, in listen
async with websockets.connect(uri, max_size=None, ping_interval=20, ping_timeout=60) as websocket:
File "/usr/local/lib/python3.9/site-packages/websockets/asyncio/client.py", line 587, in aenter
return await self
File "/usr/local/lib/python3.9/site-packages/websockets/asyncio/client.py", line 541, in await_impl
self.connection = await self.create_connection()
File "/usr/local/lib/python3.9/site-packages/websockets/asyncio/client.py", line 467, in create_connection
_, connection = await loop.create_connection(factory, **kwargs)
File "/usr/local/lib/python3.9/asyncio/baseevents.py", line 1065, in createconnection
raise exceptions[0]
File "/usr/local/lib/python3.9/asyncio/baseevents.py", line 1050, in createconnection
sock = await self._connect_sock(
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 961, in _connect_sock
await self.sock_connect(sock, address)
File "/usr/local/lib/python3.9/asyncio/selectorevents.py", line 500, in sockconnect
return await fut
File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 535, in _sockconnectcb
raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('fd12:2ad:180d:0:4000:1e:a81f:9553', 8080, 0, 0)
3 months ago
restarting the server would absolutely sever the connection the client has, your client would want to have reconnection logic implemented
yes I have reconnecting logic. Also I have stopped my python client and it still shows that error on the javascript side. Was there any update being done on default nixpacks configs in the last 1 week?
3 months ago
last update to nixpacks was 3 weeks ago, so this would have to be a code or configuration issue.
this was how i was initializing the webhook server with javascript to talk internally:
app.listen(WEBHOOK_PORT, "::", () => {
logger.warn({
message:Webhook server is running on port http://[::]:${WEBHOOK_PORT}
,
});
});
does this look wrong?
also on the same client, im listening to 2 different ports, one like the above and the other like this:
app.listen(HELIUS_SWAPS_WEBHOOK_PORT, "0.0.0.0", () => {
logger.warn({ message: `Helius Webhook server is listening on port [http://0.0.0.0:${HELIUS_SWAPS_WEBHOOK_PORT}](http://0.0.0.0:${HELIUS_SWAPS_WEBHOOK_PORT})` });
});
is there a problem having 2?
3 months ago
can you connect to the websocket server with something like yaak?
No I am getting:
{
"status": "error",
"code": 502,
"message": "Application failed to respond",
"requestid": "sLlu8fIT7muXoiOLJlUGw_499424464"
}
3 months ago
for that error, please see our docs -
are you on Metal? I have a websocket server (in Node) running on Railway without issues, but it's not on Metal yet (and I'm scared of moving)