ciso-assistant-community icon indicating copy to clipboard operation
ciso-assistant-community copied to clipboard

Error 500 on analytics

Open pvassalligs opened this issue 1 year ago • 9 comments

Describe the bug Error 500 - Internal Error

To Reproduce On login I get the side menu and the links are working properly but all at sudden I get the error on the overview-> Analytics page

Expected behavior The right page and the analytics working.

Screenshots image

Environment (please complete the following information):

  • Device: ubuntu
  • OS: 24.04
  • Browser chrome
  • Version 126.0.6478.127 version 64 bit

pvassalligs avatar Jul 04 '24 13:07 pvassalligs

Is it transient (i.e. when you refresh the error is gone), or is it persistent?

eric-intuitem avatar Jul 05 '24 14:07 eric-intuitem

Unfortunately the error is persistent...

pvassalligs avatar Jul 08 '24 11:07 pvassalligs

I have checked the logs. Here they are:

docker-compose logs Traceback (most recent call last): File "/usr/lib/python3/dist-packages/docker/api/client.py", line 214, in _retrieve_server_version return self.version(api_version=False)["ApiVersion"] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/docker/api/daemon.py", line 181, in version return self._result(self._get(url), json=True) ^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/docker/utils/decorators.py", line 46, in inner return f(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/docker/api/client.py", line 237, in _get return self.get(url, **self._set_request_timeout(kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/requests/sessions.py", line 602, in get return self.request("GET", url, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/requests/sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/requests/sessions.py", line 703, in send r = adapter.send(request, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/requests/adapters.py", line 486, in send resp = conn.urlopen( ^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 791, in urlopen response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 497, in _make_request conn.request( TypeError: HTTPConnection.request() got an unexpected keyword argument 'chunked'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/bin/docker-compose", line 33, in sys.exit(load_entry_point('docker-compose==1.29.2', 'console_scripts', 'docker-compose')()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 81, in main command_func() File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 200, in perform_command project = project_from_options('.', options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 60, in project_from_options return get_project( ^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 152, in get_project client = get_client( ^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/compose/cli/docker_client.py", line 41, in get_client client = docker_client( ^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/compose/cli/docker_client.py", line 170, in docker_client client = APIClient(use_ssh_client=not use_paramiko_ssh, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/docker/api/client.py", line 197, in init self._version = self._retrieve_server_version() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/docker/api/client.py", line 221, in _retrieve_server_version raise DockerException( docker.errors.DockerException: Error while fetching server API version: HTTPConnection.request() got an unexpected keyword argument 'chunked'

pvassalligs avatar Jul 09 '24 13:07 pvassalligs

Have you experienced the issue after an upgrade of the system ? When upgrading to a new version, I often stumble upon this kind of error. I solve it by running the migrations via Docker command line :

#To get the name of your backend, by default it is 'backend', we'll call it $BACKEND_NAME here
$ docker ps
$ docker exec -it $BACKEND_NAME python manage.py migrate

Keep us updated if it helped

CyberPoly1000 avatar Jul 10 '24 13:07 CyberPoly1000

Hello @pvassalligs , closing this ticket for now as it looks like a transient migration issue. Feel free to reopen it if something comes up :)

ab-smith avatar Jul 27 '24 07:07 ab-smith

docker exec -it $BACKEND_NAME python manage.py migrate

Hi @ab-smith and @CyberPoly1000: it's not a migration issue and I can't reopen the ticket...

It's related, as I can see from logs to a Content-length limit:

_Listening on 0.0.0.0:3000 SvelteKitError: Content-length of 23845526 exceeds limit of 20000000 bytes. at Object.start (file:///app/build/handler.js:984:19) at setupReadableStreamDefaultController (node:internal/webstreams/readablestream:2460:23) at setupReadableStreamDefaultControllerFromSource (node:internal/webstreams/readablestream:2492:3) at new ReadableStream (node:internal/webstreams/readablestream:280:7) at get_raw_body (file:///app/build/handler.js:973:9) at getRequest (file:///app/build/handler.js:1054:7) at Array.ssr (file:///app/build/handler.js:1248:19) at handle (file:///app/build/handler.js:1318:23) at file:///app/build/handler.js:1318:40 at Array. (file:///app/build/handler.js:1237:4) { status: 413, text: 'Payload Too Large' }

Can you please tell me how to increase that limit? Thank you :)

pvassalligs avatar Aug 19 '24 09:08 pvassalligs

@nas-tabchiche I think we had a discussion about BODY_SIZE_LIMIT at some point isn't it?

ab-smith avatar Aug 19 '24 09:08 ab-smith

We did talk about that regarding file uploads indeed. Here it seems no POST is made, something must make the payload's size explode because there is no reason for it to ever reach 20+MB.

@pvassalligs The error is thrown right when you attempt to open the analytics page, right? Also, can you provide me with a rough overview of what your instance looks like (number of domains, applied controls, projects, risk assessments, audits...)?

nas-tabchiche avatar Aug 19 '24 09:08 nas-tabchiche

@nas-tabchiche the error appears when I press the upload button, the json file is 23MB: 2 domains, no applied controls, no projects, no risk assessments, no audits. Just started in playing around and loaded a tons of libraries to view the controls. 2 users with their password.

pvassalligs avatar Aug 19 '24 10:08 pvassalligs

The issue was solved with 4ff293b81e6b. Closing This.

nas-tabchiche avatar Jan 22 '25 18:01 nas-tabchiche