I am unable to successfully use my css file in my django project - python-3.x

[03/May/2021 11:44:59] "GET /add_food/ HTTP/1.1" 200 4583
[03/May/2021 11:44:59] "GET /static/css/base.css HTTP/1.1" 404 1763
[03/May/2021 11:45:04] "GET / HTTP/1.1" 200 3812
[03/May/2021 11:45:04] "GET /static/css/base.css HTTP/1.1" 404 1763
[03/May/2021 11:46:24] "GET / HTTP/1.1" 200 3812
[03/May/2021 11:46:24] "GET /static/css/base.css HTTP/1.1" 404 1763
[03/May/2021 11:48:07] "GET / HTTP/1.1" 200 3812
[03/May/2021 11:48:07] "GET /static/css/base.css HTTP/1.1" 404 1763
This is the error I am facing on running the server and reloading the localhost.
the part where I have added my static file is as follows
<link href="{% static 'css/base.css' %}" rel="stylesheet">
where i have defined static in settings.py is as follows:
STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
STATIC_ROOT = os.path.join(BASE_DIR, 'static_saved')
my project structure is linked here
what am i doing wrong?

Related

Gunicorn access log format not apply

I'm using gunicorn to run a fastapi script, the access log file were created using the gunicorn.conf.py with accesslog yet it will not apply the access_log_format. I tried this apply this example from the github and is still not working
My gunicorn.conf.py
accesslog = '/home/ossbod/chunhueitest/supervisor_log/accesslog.log'
loglevel = 'info'
access_log_format = '%(h)s %(l)s %(t)s "%(r)s" %(s)s %(q)s %(b)s "%(f)s" "%(a)s" %(M)s'
The result I got
<IP>:54668 - "GET /docs HTTP/1.1" 200
<IP>:54668 - "GET /openapi.json HTTP/1.1" 200
<IP>:54668 - "POST /api/v1/add_user HTTP/1.1" 201
How can i get the format to apply to the log?

Django+Vue:static file not found

When I use Django+Vue to build a web appliction, It occoured that the staic files always not found though I had placed all the files correctly.
the logs from server like this:
WARNING Not Found: /static/js/app.4c2224dc.js
WARNING Not Found: /static/css/app.a5d43e07.css
WARNING Not Found: /static/css/chunk-vendors.2ccfa1b8.css
WARNING Not Found: /static/js/chunk-vendors.c2488b8d.js
WARNING "GET /static/js/app.4c2224dc.js HTTP/1.1" 404 179
WARNING "GET /static/css/app.a5d43e07.css HTTP/1.1" 404 179
WARNING "GET /static/css/chunk-vendors.2ccfa1b8.css HTTP/1.1" 404 179
WARNING "GET /static/js/chunk-vendors.c2488b8d.js HTTP/1.1" 404 179
WARNING Not Found: /login
WARNING "GET /login HTTP/1.1" 404 179
WARNING Not Found: //performanceProject
WARNING "GET //performanceProject HTTP/1.1" 404 179
WARNING Not Found: /performanceProject
WARNING "GET /performanceProject HTTP/1.1" 404 179
I solved the problem by https://www.cnpython.com/qa/1400788.
1、pip3 install whitenoise
2、modify settings.py add 'whitenoise.middleware.WhiteNoiseMiddleware' to MIDDLEWARE, example below:
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware', # Add WhiteNoise here
...
]
# when DEBUG=true
# STATICFILES_DIRS = [
# os.path.join(BASE_DIR, 'dist/static')
# ]
# when debug=False
STATIC_ROOT = os.path.join(BASE_DIR, 'dist/static')
# always need to be set ignore debug=False or True
STATICFILES_STORAGE = 'whitenoise.storage.CompressedStaticFilesStorage'
3、python3 manage.py collectstatic
4、python3 manage.py runserver 0.0.0.0:XXXX

Nginx websocket proxy for Node.js

I am trying to use Node.js to read phoenix channels using npm package phoenix-channels. Phoenix channels are multiplexed on top of websockets. I'm using an NGINX proxy in front of my phoenix webserver, so for NGINX, it's just a websocket.
Phoenix channels work fine going to a web page, as you can see here (you'll see data coming through in the web page).
It also works fine from nodejs on my internal network:
test_chan.js (with explicit IP and port):
const { Socket } = require('phoenix-channels')
let socket = new Socket("https://192.168.1.113:4445/socket")
socket.connect()
// Now that you are connected, you can join channels with a topic:
let channel = socket.channel("room:lobby", {})
channel.on("new_msg", payload => {
console.log(`${payload.body}`);
});
channel.join()
.receive("ok", resp => { console.log("Joined successfully", resp) })
.receive("error", resp => { console.log("Unable to join", resp) })
However if I replace the explicity IP:PORT address with the domain name, and run it from externally, it doesn't work (the only difference here from the script above is the URL):
test_chan.js (through domain name, and via my NGINX proxy):
const { Socket } = require('phoenix-channels')
let socket = new Socket("https://suprabonds.com/socket")
socket.connect()
// Now that you are connected, you can join channels with a topic:
let channel = socket.channel("room:lobby", {})
channel.on("new_msg", payload => {
console.log(`${payload.body}`);
});
channel.join()
.receive("ok", resp => { console.log("Joined successfully", resp) })
.receive("error", resp => { console.log("Unable to join", resp) })
So the suprabonds.com websockets works fine in a browser through the proxy, but doesn't work as a nodejs script.
Here is my nginx conf for suprabonds.com:
sites-enabled relevant server section:
server {
server_name suprabonds.com www.suprabonds.com;
location / {
proxy_pass http://localhost:4445;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/suprabonds.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/suprabonds.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
Any idea as to what I'm doing wrong?
EDIT
Here are the /var/log/nginx/access.log latest entries:
86.143.74.170 - - [22/Apr/2021:15:52:56 +0000] "GET /socket/websocket?vsn=1.0.0 HTTP/1.1" 301 178 "-" "-"
86.143.74.170 - - [22/Apr/2021:15:52:58 +0000] "GET /socket/websocket?vsn=1.0.0 HTTP/1.1" 301 178 "-" "-"
86.143.74.170 - - [22/Apr/2021:15:53:03 +0000] "GET /socket/websocket?vsn=1.0.0 HTTP/1.1" 301 178 "-" "-"
86.143.74.170 - - [22/Apr/2021:15:53:08 +0000] "GET /phoenix/live_reload/socket/websocket?vsn=2.0.0 HTTP/1.1" 101 143 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0"
86.143.74.170 - - [22/Apr/2021:15:53:08 +0000] "GET /socket/websocket?token=undefined&vsn=2.0.0 HTTP/1.1" 101 113098 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0"
86.143.74.170 - - [22/Apr/2021:15:53:19 +0000] "GET /phoenix/live_reload/socket/websocket?vsn=2.0.0 HTTP/1.1" 101 79 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0"
86.143.74.170 - - [22/Apr/2021:15:53:19 +0000] "GET /socket/websocket?token=undefined&vsn=2.0.0 HTTP/1.1" 101 27025 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0"
86.143.74.170 - - [22/Apr/2021:15:53:20 +0000] "GET /socket/websocket?token=undefined&vsn=2.0.0 HTTP/1.1" 101 479 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0"
86.143.74.170 - - [22/Apr/2021:15:53:20 +0000] "GET /phoenix/live_reload/socket/websocket?vsn=2.0.0 HTTP/1.1" 101 79 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0"
86.143.74.170 - - [22/Apr/2021:15:53:23 +0000] "GET /socket/websocket?vsn=1.0.0 HTTP/1.1" 301 178 "-" "-"
86.143.74.170 - - [22/Apr/2021:15:53:24 +0000] "GET /socket/websocket?vsn=1.0.0 HTTP/1.1" 301 178 "-" "-"
86.143.74.170 - - [22/Apr/2021:15:53:26 +0000] "GET /socket/websocket?vsn=1.0.0 HTTP/1.1" 301 178 "-" "-"
86.143.74.170 - - [22/Apr/2021:15:53:31 +0000] "GET /socket/websocket?vsn=1.0.0 HTTP/1.1" 301 178 "-" "-"
86.143.74.170 - - [22/Apr/2021:15:53:41 +0000] "GET /socket/websocket?vsn=1.0.0 HTTP/1.1" 301 178 "-" "-"
The firefox ones are the ones that work fine. The others (with 301 178 in them) are the ones from the non-working Node.js script (that is, the one using the domain name). The error.log file in the same location is empty.
Please note that I'm also using noip dynamic dns.
If you change your URL to:
let socket = new Socket("wss://suprabonds.com/socket/websocket?token=undefined")
or
let socket = new Socket("wss://suprabonds.com/socket/websocket?vsn=1.0.0")
It will connect

Python (Pyppeteer): [WinError 10054] An existing connection was forcibly closed by the remote host

I am trying to serve some HTML through a local server setup using Python and then use the pyppeteer module to take a screenshot of the web page.
This is the Python code to take the screenshot.
from pyppeteer import launch
async def main():
browser = await launch(headless=True)
page = await browser.newPage()
arg = sys.argv[1]
await page.goto("http://localhost:8888/map.html"), {'waitUntil': 'networkidle2'})
await page.pdf({'path': 'screenshot.pdf', 'landscape' : True, 'format': 'A4'});
await browser.close()
asyncio.get_event_loop().run_until_complete(main())
Here is map.html code that I am trying to serve over the Python server. It reads in a json file with some function settings and calls flex_map which has some D3 Javascript code.
<html>
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v5.min.js"></script>
<script src="/js/legend.js"></script>
<script src="/js/flex_map.js"></script>
</head>
<body>
<script>
d3.json("/settings/map_settings.json").then(function(mapSettings) {
flex_map(mapSettings.geoJsonFile,
mapSettings.dataFile,
mapSettings.fillVariable,
mapSettings.geoVariable,
mapSettings.geoJsonGeoVariable,
mapSettings.legend_title,
mapSettings.legendTranslateX,
mapSettings.legendTranslateY);
});
</script>
</body>
</html>
When I submit this code with python take_screenshot.py after creating the local server, I get the following error:
Serving HTTP on 0.0.0.0 port 8888 (http://0.0.0.0:8888/) ...
127.0.0.1 - - [23/Apr/2020 18:34:02] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [23/Apr/2020 18:34:04] "GET /map.html HTTP/1.1" 304 -
127.0.0.1 - - [23/Apr/2020 18:34:04] "GET /settings/map_settings.json HTTP/1.1" 304 -
127.0.0.1 - - [23/Apr/2020 18:34:04] "GET /data/temp_data.csv HTTP/1.1" 304 -
127.0.0.1 - - [23/Apr/2020 18:35:08] "GET /map.html HTTP/1.1" 200 -
127.0.0.1 - - [23/Apr/2020 18:35:08] "GET /js/legend.js HTTP/1.1" 200 -
127.0.0.1 - - [23/Apr/2020 18:35:08] "GET /js/flex_map.js HTTP/1.1" 200 -
127.0.0.1 - - [23/Apr/2020 18:35:08] "GET /settings/map_settings.json HTTP/1.1" 200 -
127.0.0.1 - - [23/Apr/2020 18:35:09] "GET /data/temp_data.csv HTTP/1.1" 200 -
127.0.0.1 - - [23/Apr/2020 18:35:09] "GET /geoJSON/us_counties.json HTTP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 52861)
Traceback (most recent call last):
File "C:\Anaconda\lib\socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "C:\Anaconda\lib\socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Anaconda\lib\http\server.py", line 646, in __init__
super().__init__(*args, **kwargs)
File "C:\Anaconda\lib\socketserver.py", line 720, in __init__
self.handle()
File "C:\Anaconda\lib\http\server.py", line 426, in handle
self.handle_one_request()
File "C:\Anaconda\lib\http\server.py", line 394, in handle_one_request
self.raw_requestline = self.rfile.readline(65537)
File "C:\Anaconda\lib\socket.py", line 589, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
----------------------------------------
I am not really sure where the source of this issue could be. One strange thing is if I change the HTML file to
<html>
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v5.min.js"></script>
<script src="/js/legend.js"></script>
<script src="/js/flex_map.js"></script>
</head>
<body>
<script>
flex_map(args go here...);
</script>
</body>
</html>
the code runs fine and takes a screenshot, so it might have something to do with loading in the json file but I am not sure how to resolve that. Also opening the map.html code on Chrome through a localhost works fine.

Elastic beanstalk + socket.io sticky sessions

I am having a weird issue with socket.io on elastic beanstalk using the Application Load Balancer and connecting from node (server-side). Currently I have two nodes, each behind their own nginx, and all behind an application load balancer configured with sticky sessions.
The issue I am having is that the upgrade from long polling -> websocket works fine in the browser but fails from node. The only way I can connect from node is to manually set transports: ["websockets"] which is undesirable. Below are the logs for connecting to the API via node with this code and DEBUG=*
const clientSocket = io(URL);
Looking at the nginx access.logs, nothing seems out of the ordinary regarding the sessions. Here's a snippet. As you can see, everything from my-ip is consistently routed to the same node
172.31.8.41 - - [28/Feb/2019:19:51:42 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.28.138 - - [28/Feb/2019:19:51:42 +0000] "GET /socket.io/?EIO=3&transport=polling&t=MargPwH&b64=1&sid=7k33d9491Y8GWscOAABp HTTP/1.1" 400 52 "-" "node-XMLHttpRequest" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:51:42 +0000] "GET /socket.io/?EIO=3&transport=websocket&sid=7k33d9491Y8GWscOAABp HTTP/1.1" 400 18 "-" "-" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:51:44 +0000] "GET /socket.io/?EIO=3&transport=polling&t=MargQGg&b64=1&sid=hy5Trvc1rOCOV-BrAABq HTTP/1.1" 400 52 "-" "node-XMLHttpRequest" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:51:44 +0000] "GET /socket.io/?EIO=3&transport=websocket&sid=hy5Trvc1rOCOV-BrAABq HTTP/1.1" 400 18 "-" "-" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:51:44 +0000] "GET /socket.io/?EIO=3&transport=polling&t=MargI-p&b64=1&sid=4ZsFjp8X8MDznyr9AABE HTTP/1.1" 200 3 "-" "node-XMLHttpRequest" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:51:45 +0000] "GET /socket.io/?EIO=3&transport=polling&t=MargQfk&b64=1 HTTP/1.1" 200 103 "-" "node-XMLHttpRequest" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:51:51 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.8.41 - - [28/Feb/2019:19:51:57 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.28.138 - - [28/Feb/2019:19:52:06 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.28.138 - - [28/Feb/2019:19:52:11 +0000] "GET /socket.io/?EIO=3&transport=polling&t=MargW-E&b64=1 HTTP/1.1" 200 103 "-" "node-XMLHttpRequest" "my-ip"
172.31.8.41 - - [28/Feb/2019:19:52:12 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.28.138 - - [28/Feb/2019:19:52:15 +0000] "GET /socket.io/?EIO=3&transport=polling&t=MargQhr&b64=1&sid=uxJMGa3egW9Wb2jhAABG HTTP/1.1" 200 3 "-" "node-XMLHttpRequest" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:52:21 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.8.41 - - [28/Feb/2019:19:52:27 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.28.138 - - [28/Feb/2019:19:52:36 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.28.138 - - [28/Feb/2019:19:52:36 +0000] "GET /socket.io/?EIO=3&transport=polling&t=MargX0N&b64=1&sid=bBINNyBJvvX5cP0RAABH HTTP/1.1" 200 3 "-" "node-XMLHttpRequest" "my-ip"
172.31.8.41 - - [28/Feb/2019:19:52:36 +0000] "POST /socket.io/?EIO=3&transport=polling&t=MargdA9&b64=1&sid=bBINNyBJvvX5cP0RAABH HTTP/1.1" 200 2 "-" "node-XMLHttpRequest" "my-ip"
172.31.8.41 - - [28/Feb/2019:19:52:37 +0000] "GET /socket.io/?EIO=3&transport=polling&t=MargdR3&b64=1 HTTP/1.1" 200 103 "-" "node-XMLHttpRequest" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:52:38 +0000] "GET /socket.io/?EIO=3&transport=websocket&sid=gfTQu0aAJF6Z6Q5gAABI HTTP/1.1" 101 0 "-" "-" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:52:39 +0000] "GET /socket.io/?EIO=3&transport=polling&t=Margdm-&b64=1 HTTP/1.1" 200 103 "-" "node-XMLHttpRequest" "my-ip"
172.31.8.41 - - [28/Feb/2019:19:52:42 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.28.138 - - [28/Feb/2019:19:52:51 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.8.41 - - [28/Feb/2019:19:52:57 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.28.138 - - [28/Feb/2019:19:53:04 +0000] "GET /socket.io/?EIO=3&transport=polling&t=Margdpg&b64=1&sid=3nZgirr9cXOZNj_XAABJ HTTP/1.1" 200 3 "-" "node-XMLHttpRequest" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:53:04 +0000] "POST /socket.io/?EIO=3&transport=polling&t=Margjz2&b64=1&sid=3nZgirr9cXOZNj_XAABJ HTTP/1.1" 200 2 "-" "node-XMLHttpRequest" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:53:05 +0000] "GET /socket.io/?EIO=3&transport=polling&t=MargkGk&b64=1 HTTP/1.1" 200 103 "-" "node-XMLHttpRequest" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:53:06 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.8.41 - - [28/Feb/2019:19:53:12 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.28.138 - - [28/Feb/2019:19:53:21 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.8.41 - - [28/Feb/2019:19:53:27 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.28.138 - - [28/Feb/2019:19:53:31 +0000] "GET /socket.io/?EIO=3&transport=polling&t=MargkJN&b64=1&sid=rKuyOzJrHA7Fe41JAABK HTTP/1.1" 200 3 "-" "node-XMLHttpRequest" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:53:31 +0000] "POST /socket.io/?EIO=3&transport=polling&t=MargqSU&b64=1&sid=rKuyOzJrHA7Fe41JAABK HTTP/1.1" 200 2 "-" "node-XMLHttpRequest" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:53:32 +0000] "GET /socket.io/?EIO=3&transport=polling&t=MargqnP&b64=1&sid=vlqaqHh9VJNz5gXjAABr HTTP/1.1" 400 52 "-" "node-XMLHttpRequest" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:53:33 +0000] "POST /socket.io/?EIO=3&transport=polling&t=Margqpb&b64=1&sid=vlqaqHh9VJNz5gXjAABr HTTP/1.1" 400 52 "-" "node-XMLHttpRequest" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:53:34 +0000] "GET /socket.io/?EIO=3&transport=polling&t=MargrBM&b64=1&sid=oJJ-VBCV30wZRG_4AABs HTTP/1.1" 400 52 "-" "node-XMLHttpRequest" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:53:34 +0000] "POST /socket.io/?EIO=3&transport=polling&t=MargrDy&b64=1&sid=oJJ-VBCV30wZRG_4AABs HTTP/1.1" 400 52 "-" "node-XMLHttpRequest" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:53:36 +0000] "GET /socket.io/?EIO=3&transport=polling&t=MargrdM&b64=1&sid=UR3CqEnDl_-nFC5pAABt HTTP/1.1" 400 52 "-" "node-XMLHttpRequest" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:53:36 +0000] "POST /socket.io/?EIO=3&transport=polling&t=MargrfZ&b64=1&sid=UR3CqEnDl_-nFC5pAABt HTTP/1.1" 400 52 "-" "node-XMLHttpRequest" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:53:36 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.28.138 - - [28/Feb/2019:19:53:37 +0000] "GET /socket.io/?EIO=3&transport=websocket&sid=04idFIicBmnKXJVyAABu HTTP/1.1" 400 18 "-" "-" "my-ip"
172.31.8.41 - - [28/Feb/2019:19:53:42 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.28.138 - - [28/Feb/2019:19:53:51 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.8.41 - - [28/Feb/2019:19:53:57 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.28.138 - - [28/Feb/2019:19:54:06 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.8.41 - - [28/Feb/2019:19:54:12 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.28.138 - - [28/Feb/2019:19:54:21 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.8.41 - - [28/Feb/2019:19:54:27 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.8.41 - - [28/Feb/2019:19:54:27 +0000] "POST /socket.io/?EIO=3&transport=polling&t=Marh2FA&b64=1&sid=04idFIicBmnKXJVyAABu HTTP/1.1" 400 52 "-" "node-XMLHttpRequest" "my-ip"
172.31.8.41 - - [28/Feb/2019:19:54:27 +0000] "POST /socket.io/?EIO=3&transport=polling&t=Marh2Hf&b64=1&sid=04idFIicBmnKXJVyAABu HTTP/1.1" 400 52 "-" "node-XMLHttpRequest" "my-ip"
172.31.8.41 - - [28/Feb/2019:19:54:28 +0000] "GET /socket.io/?EIO=3&transport=websocket&sid=LE3bgCzvK0VAtXL_AABv HTTP/1.1" 400 18 "-" "-" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:54:36 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.8.41 - - [28/Feb/2019:19:54:42 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.28.138 - - [28/Feb/2019:19:54:51 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.28.138 - - [28/Feb/2019:19:54:54 +0000] "GET /socket.io/?EIO=3&transport=polling&t=Marh8em&b64=1&sid=LE3bgCzvK0VAtXL_AABv HTTP/1.1" 400 52 "-" "node-XMLHttpRequest" "my-ip"
172.31.8.41 - - [28/Feb/2019:19:54:54 +0000] "POST /socket.io/?EIO=3&transport=polling&t=Marh8hg&b64=1&sid=LE3bgCzvK0VAtXL_AABv HTTP/1.1" 400 52 "-" "node-XMLHttpRequest" "my-ip"
172.31.8.41 - - [28/Feb/2019:19:54:55 +0000] "GET /socket.io/?EIO=3&transport=polling&t=Marh928&b64=1&sid=F_VPIilCbjKlcTAfAABw HTTP/1.1" 400 52 "-" "node-XMLHttpRequest" "my-ip"
172.31.8.41 - - [28/Feb/2019:19:54:55 +0000] "GET /socket.io/?EIO=3&transport=websocket&sid=F_VPIilCbjKlcTAfAABw HTTP/1.1" 400 18 "-" "-" "my-ip"
172.31.8.41 - - [28/Feb/2019:19:54:56 +0000] "GET /socket.io/?EIO=3&transport=websocket&sid=w2fGwjpj8ElojoJTAABx HTTP/1.1" 400 18 "-" "-" "my-ip"
172.31.8.41 - - [28/Feb/2019:19:54:57 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.28.138 - - [28/Feb/2019:19:55:06 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.8.41 - - [28/Feb/2019:19:55:12 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.8.41 - - [28/Feb/2019:19:55:21 +0000] "POST /socket.io/?EIO=3&transport=polling&t=MarhFRZ&b64=1&sid=w2fGwjpj8ElojoJTAABx HTTP/1.1" 400 52 "-" "node-XMLHttpRequest" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:55:21 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.8.41 - - [28/Feb/2019:19:55:22 +0000] "GET /socket.io/?EIO=3&transport=polling&t=MarhFfr&b64=1 HTTP/1.1" 200 103 "-" "node-XMLHttpRequest" "my-ip"
172.31.8.41 - - [28/Feb/2019:19:55:27 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.28.138 - - [28/Feb/2019:19:55:36 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.8.41 - - [28/Feb/2019:19:55:42 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.8.41 - - [28/Feb/2019:19:55:47 +0000] "GET /socket.io/?EIO=3&transport=polling&t=MarhFiU&b64=1&sid=RmuQkr9UirrYp6NGAABL HTTP/1.1" 200 3 "-" "node-XMLHttpRequest" "my-ip"
172.31.8.41 - - [28/Feb/2019:19:55:47 +0000] "POST /socket.io/?EIO=3&transport=polling&t=MarhLpU&b64=1&sid=RmuQkr9UirrYp6NGAABL HTTP/1.1" 200 2 "-" "node-XMLHttpRequest" "my-ip"
172.31.8.41 - - [28/Feb/2019:19:55:48 +0000] "GET /socket.io/?EIO=3&transport=polling&t=MarhM45&b64=1 HTTP/1.1" 200 103 "-" "node-XMLHttpRequest" "my-ip"
172.31.8.41 - - [28/Feb/2019:19:55:49 +0000] "GET /socket.io/?EIO=3&transport=websocket&sid=fTWuT3g-SQ6Y-7DKAABM HTTP/1.1" 101 0 "-" "-" "my-ip"
172.31.8.41 - - [28/Feb/2019:19:55:50 +0000] "GET /socket.io/?EIO=3&transport=polling&t=MarhMTu&b64=1 HTTP/1.1" 200 103 "-" "node-XMLHttpRequest" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:55:52 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.8.41 - - [28/Feb/2019:19:55:57 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.28.138 - - [28/Feb/2019:19:56:07 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.8.41 - - [28/Feb/2019:19:56:12 +0000] "GET / HTTP/1.1" 200 5 "-" "ELB-HealthChecker/2.0" "-"
172.31.8.41 - - [28/Feb/2019:19:56:16 +0000] "GET /socket.io/?EIO=3&transport=polling&t=MarhMWX&b64=1&sid=4UCaq5tvWPrIxr-RAABN HTTP/1.1" 200 3 "-" "node-XMLHttpRequest" "my-ip"
172.31.28.138 - - [28/Feb/2019:19:56:16 +0000] "POST /socket.io/?EIO=3&transport=polling&t=MarhSg5&b64=1&sid=4UCaq5tvWPrIxr-RAABN HTTP/1.1" 200 2 "-" "node-XMLHttpRequest" "my-ip"
socket.io logs from node:
julian#wilson:~/project/app-server$ tsc && node dist/src/order_spammer.js
socket.io-client:url parse https://env.api.app.bet +0ms
socket.io-client new io instance for https://env.api.app.bet +0ms
socket.io-client:manager readyState closed +0ms
socket.io-client:manager opening https://env.api.app.bet +1ms
engine.io-client:socket creating transport "polling" +0ms
engine.io-client:polling polling +0ms
engine.io-client:polling-xhr xhr poll +0ms
engine.io-client:polling-xhr xhr open GET: https://env.api.app.bet/socket.io/?EIO=3&transport=polling&t=Mard8kg&b64=1 +1ms
engine.io-client:polling-xhr xhr data null +0ms
engine.io-client:socket setting transport polling +12ms
socket.io-client:manager connect attempt will timeout after 20000 +13ms
socket.io-client:manager readyState opening +1ms
engine.io-client:polling polling got data 96:0{"sid":"xxj_pihkgmI4gJEhAABB","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000}2:40 +174ms
engine.io-client:socket socket receive: type "open", data "{"sid":"xxj_pihkgmI4gJEhAABB","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000}" +164ms
engine.io-client:socket socket open +0ms
socket.io-client:manager open +162ms
socket.io-client:manager cleanup +0ms
socket.io-client:socket transport is open - connecting +0ms
engine.io-client:socket starting upgrade probes +1ms
engine.io-client:socket probing transport "websocket" +0ms
engine.io-client:socket creating transport "websocket" +0ms
engine.io-client:socket socket receive: type "message", data "0" +4ms
socket.io-parser decoded 0 as {"type":0,"nsp":"/"} +0ms
engine.io-client:polling polling +7ms
engine.io-client:polling-xhr xhr poll +180ms
engine.io-client:polling-xhr xhr open GET: https://env.api.app.bet/socket.io/?EIO=3&transport=polling&t=Mard8nV&b64=1&sid=xxj_pihkgmI4gJEhAABB +0ms
engine.io-client:polling-xhr xhr data null +0ms
engine.io-client:socket socket error {"type":"TransportError","description":400} +171ms
socket.io-client:manager error { Error: xhr poll error
at XHR.Transport.onError (/home/julian/project/app-server/node_modules/engine.io-client/lib/transport.js:64:13)
at Request.<anonymous> (/home/julian/project/app-server/node_modules/engine.io-client/lib/transports/polling-xhr.js:128:10)
at Request.Emitter.emit (/home/julian/project/app-server/node_modules/component-emitter/index.js:133:20)
at Request.onError (/home/julian/project/app-server/node_modules/engine.io-client/lib/transports/polling-xhr.js:309:8)
at Timeout._onTimeout (/home/julian/project/app-server/node_modules/engine.io-client/lib/transports/polling-xhr.js:256:18)
at ontimeout (timers.js:427:11)
at tryOnTimeout (timers.js:289:5)
at listOnTimeout (timers.js:252:5)
at Timer.processTimers (timers.js:212:10) type: 'TransportError', description: 400 } +177ms
engine.io-client:socket socket close with reason: "transport error" +4ms
engine.io-client:polling transport open - closing +174ms
engine.io-client:polling writing close packet +0ms
engine.io-client:polling-xhr xhr open POST: https://env.api.app.bet/socket.io/?EIO=3&transport=polling&t=Mard8qD&b64=1&sid=xxj_pihkgmI4gJEhAABB +175ms
engine.io-client:polling-xhr xhr data 1:1 +0ms
socket.io-client:manager onclose +4ms
socket.io-client:manager cleanup +0ms
socket.io-client:socket close (transport error) +181ms
socket.io-client:manager will wait 661ms before reconnect attempt +1ms
engine.io-client:socket probe transport "websocket" failed because of error: socket closed +3ms
socket.io-client:socket emitting packet with ack id 0 +425ms
socket.io-client:manager attempting reconnect +661ms
socket.io-client:manager readyState closed +0ms
socket.io-client:manager opening https://env.api.app.bet +0ms
engine.io-client:socket creating transport "polling" +661ms
engine.io-client:polling polling +664ms
engine.io-client:polling-xhr xhr poll +663ms
engine.io-client:polling-xhr xhr open GET: https://env.api.app.bet/socket.io/?EIO=3&transport=polling&t=Mard8-b&b64=1 +1ms
engine.io-client:polling-xhr xhr data null +0ms
engine.io-client:socket setting transport polling +3ms
socket.io-client:manager connect attempt will timeout after 20000 +4ms
engine.io-client:polling polling got data 96:0{"sid":"HADNz_FR5SkW-zAdAAA0","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000}2:40 +140ms
engine.io-client:socket socket receive: type "open", data "{"sid":"HADNz_FR5SkW-zAdAAA0","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000}" +137ms
engine.io-client:socket socket open +0ms
socket.io-client:manager open +137ms
socket.io-client:manager cleanup +1ms
socket.io-client:socket transport is open - connecting +378ms
socket.io-client:manager reconnect success +0ms
engine.io-client:socket starting upgrade probes +1ms
engine.io-client:socket probing transport "websocket" +0ms
engine.io-client:socket creating transport "websocket" +0ms
engine.io-client:socket socket receive: type "message", data "0" +3ms
socket.io-parser decoded 0 as {"type":0,"nsp":"/"} +983ms
socket.io-client:manager writing packet {"type":2,"data":["active_markets",null],"options":{"compress":true},"id":0,"nsp":"/"} +3ms
socket.io-parser encoding packet {"type":2,"data":["active_markets",null],"options":{"compress":true},"id":0,"nsp":"/"} +1ms
socket.io-parser encoded {"type":2,"data":["active_markets",null],"options":{"compress":true},"id":0,"nsp":"/"} as 20["active_markets",null] +0ms
engine.io-client:socket flushing 1 packets in socket +1ms
engine.io-client:polling-xhr xhr open POST: https://env.api.app.bet/socket.io/?EIO=3&transport=polling&t=Mard90s&b64=1&sid=HADNz_FR5SkW-zAdAAA0 +145ms
engine.io-client:polling-xhr xhr data 26:420["active_markets",null] +0ms
engine.io-client:polling polling +7ms
engine.io-client:polling-xhr xhr poll +1ms
engine.io-client:polling-xhr xhr open GET: https://env.api.app.bet/socket.io/?EIO=3&transport=polling&t=Mard90u&b64=1&sid=HADNz_FR5SkW-zAdAAA0 +1ms
engine.io-client:polling-xhr xhr data null +0ms
engine.io-client:socket probe transport "websocket" failed because of error: Error: websocket error +135ms
engine.io-client:socket socket error {"type":"TransportError","description":400} +5ms
socket.io-client:manager error { Error: xhr post error
at XHR.Transport.onError (/home/julian/project/app-server/node_modules/engine.io-client/lib/transport.js:64:13)
at Request.<anonymous> (/home/julian/project/app-server/node_modules/engine.io-client/lib/transports/polling-xhr.js:109:10)
at Request.Emitter.emit (/home/julian/project/app-server/node_modules/component-emitter/index.js:133:20)
at Request.onError (/home/julian/project/app-server/node_modules/engine.io-client/lib/transports/polling-xhr.js:309:8)
at Timeout._onTimeout (/home/julian/project/app-server/node_modules/engine.io-client/lib/transports/polling-xhr.js:256:18)
at ontimeout (timers.js:427:11)
at tryOnTimeout (timers.js:289:5)
at listOnTimeout (timers.js:252:5)
at Timer.processTimers (timers.js:212:10) type: 'TransportError', description: 400 } +141ms
engine.io-client:socket socket close with reason: "transport error" +1ms
engine.io-client:polling transport open - closing +139ms
engine.io-client:polling writing close packet +0ms
engine.io-client:polling-xhr xhr open POST: https://env.api.app.bet/socket.io/?EIO=3&transport=polling&t=Mard933&b64=1&sid=HADNz_FR5SkW-zAdAAA0 +138ms
engine.io-client:polling-xhr xhr data 1:1 +0ms
socket.io-client:manager onclose +2ms
socket.io-client:manager cleanup +0ms
socket.io-client:socket close (transport error) +146ms
socket.io-client:manager will wait 760ms before reconnect attempt +1ms
engine.io-client:polling polling got data 1:6 +168ms
socket.io-client:manager attempting reconnect +760ms
socket.io-client:manager readyState closed +0ms
socket.io-client:manager opening https://env.api.app.bet +0ms
engine.io-client:socket creating transport "polling" +762ms
engine.io-client:polling polling +594ms
engine.io-client:polling-xhr xhr poll +763ms
engine.io-client:polling-xhr xhr open GET: https://env.api.app.bet/socket.io/?EIO=3&transport=polling&t=Mard9E-&b64=1 +0ms
engine.io-client:polling-xhr xhr data null +0ms
engine.io-client:socket setting transport polling +2ms
socket.io-client:manager connect attempt will timeout after 20000 +2ms
engine.io-client:polling polling got data 96:0{"sid":"WKWlwvuSqRP4z_kbAABC","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000}2:40 +197ms
engine.io-client:socket socket receive: type "open", data "{"sid":"WKWlwvuSqRP4z_kbAABC","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000}" +195ms
engine.io-client:socket socket open +0ms
socket.io-client:manager open +195ms
socket.io-client:manager cleanup +0ms
socket.io-client:socket transport is open - connecting +958ms
socket.io-client:manager reconnect success +0ms
engine.io-client:socket starting upgrade probes +0ms
engine.io-client:socket probing transport "websocket" +0ms
engine.io-client:socket creating transport "websocket" +0ms
engine.io-client:socket socket receive: type "message", data "0" +1ms
socket.io-parser decoded 0 as {"type":0,"nsp":"/"} +1s
engine.io-client:polling polling +2ms
engine.io-client:polling-xhr xhr poll +198ms
engine.io-client:polling-xhr xhr open GET: https://env.api.app.bet/socket.io/?EIO=3&transport=polling&t=Mard9I4&b64=1&sid=WKWlwvuSqRP4z_kbAABC +0ms
engine.io-client:polling-xhr xhr data null +0ms
engine.io-client:socket socket error {"type":"TransportError","description":400} +135ms
socket.io-client:manager error { Error: xhr poll error
at XHR.Transport.onError (/home/julian/project/app-server/node_modules/engine.io-client/lib/transport.js:64:13)
at Request.<anonymous> (/home/julian/project/app-server/node_modules/engine.io-client/lib/transports/polling-xhr.js:128:10)
at Request.Emitter.emit (/home/julian/project/app-server/node_modules/component-emitter/index.js:133:20)
at Request.onError (/home/julian/project/app-server/node_modules/engine.io-client/lib/transports/polling-xhr.js:309:8)
at Timeout._onTimeout (/home/julian/project/app-server/node_modules/engine.io-client/lib/transports/polling-xhr.js:256:18)
at ontimeout (timers.js:427:11)
at tryOnTimeout (timers.js:289:5)
at listOnTimeout (timers.js:252:5)
at Timer.processTimers (timers.js:212:10) type: 'TransportError', description: 400 } +136ms
engine.io-client:socket socket close with reason: "transport error" +1ms
engine.io-client:polling transport open - closing +135ms
engine.io-client:polling writing close packet +0ms
engine.io-client:polling-xhr xhr open POST: https://env.api.app.bet/socket.io/?EIO=3&transport=polling&t=Mard9KB&b64=1&sid=WKWlwvuSqRP4z_kbAABC +135ms
engine.io-client:polling-xhr xhr data 1:1 +0ms
socket.io-client:manager onclose +3ms
socket.io-client:manager cleanup +0ms
socket.io-client:socket close (transport error) +139ms
socket.io-client:manager will wait 1076ms before reconnect attempt +0ms
engine.io-client:socket probe transport "websocket" failed because of error: socket closed +2ms
socket.io-client:manager attempting reconnect +1s
socket.io-client:manager readyState closed +0ms
socket.io-client:manager opening https://env.api.app.bet +0ms
engine.io-client:socket creating transport "polling" +1s
engine.io-client:polling polling +1s
engine.io-client:polling-xhr xhr poll +1s
engine.io-client:polling-xhr xhr open GET: https://env.api.app.bet/socket.io/?EIO=3&transport=polling&t=Mard9b3&b64=1 +0ms
engine.io-client:polling-xhr xhr data null +0ms
engine.io-client:socket setting transport polling +2ms
socket.io-client:manager connect attempt will timeout after 20000 +2ms
Any ideas how I can debug this?

Resources