Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crapi-web Container is unhealthy #178

Open
mxm-smaler opened this issue Mar 6, 2023 · 8 comments
Open

crapi-web Container is unhealthy #178

mxm-smaler opened this issue Mar 6, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@mxm-smaler
Copy link

crapi-web log:
Creating test database for alias 'default'...
Creating test database for alias 'mongodb'...
root ERROR /workshop/api/mechanic/signup - {'name': 'MechRaju', 'email': '[email protected]', 'mechanic_code': 'TRAC_MEC_3', 'number': '9123456708'} - 400 -{'password': [ErrorDetail(string='This field is required.', code='required')]}
django.request WARNING Bad Request: /workshop/api/mechanic/signup
.django.request WARNING Bad Request: /workshop/api/mechanic/signup
.django.request WARNING Bad Request: /workshop/api/mechanic/signup
.django.request WARNING Unauthorized: /workshop/api/mechanic/
django.request WARNING Unauthorized: /workshop/api/mechanic/
.django.request WARNING Unauthorized: /workshop/api/mechanic/
..root ERROR /workshop/api/merchant/contact_mechanic - {'mechanic_api': 'https://www.google.com', 'number_of_repeats': 5, 'mechanic_code': 'TRAC_MEC_3', 'vin': '9NFXO86WBWA082766', 'problem_details': 'My Car is not working'} - 400 -{'repeat_request_if_failed': [ErrorDetail(string='This field is required.', code='required')]}
django.request WARNING Bad Request: /workshop/api/merchant/contact_mechanic
.root INFO Repeat count: 0
root INFO Repeat count: 1
root INFO Repeat count: 2
root INFO Repeat count: 3
root INFO Repeat count: 4
root INFO Repeat count: 5
django.request WARNING Bad Request: /workshop/api/merchant/contact_mechanic
....................

Runtime Environment
Docker version 20.10.12, build 20.10.12-0ubuntu4
docker-compose version 1.29.2, build unknown
ubuntu-desktop 22.04 amd64

@mxm-smaler mxm-smaler added the bug Something isn't working label Mar 6, 2023
@bijoyvarghese256
Copy link

Having same error.. found any solution??

@mxm-smaler
Copy link
Author

No, let me know if the problem is solved

@bijoyvarghese256
Copy link

I just solved the problem my re installating the docker

@nextep
Copy link

nextep commented Mar 20, 2023

I have the same error for the WEB but the log provided above looks like its for another bug. Here's the docker logs from the failed one.

ERROR: for crapi-web Container "0ad28bac3b34" is unhealthy.
ERROR: Encountered errors while bringing up the project.

┌──(root㉿kali)-[/home/kali/lab]
└─# docker logs 0ad28bac3b34
Creating test database for alias 'default'...
Got an error creating the test database: database "test_crapi" already exists

Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 82, in _execute
return self.cursor.execute(sql)
psycopg2.errors.DuplicateDatabase: database "test_crapi" already exists

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/creation.py", line 170, in _create_test_db
self._execute_create_test_db(cursor, test_db_params, keepdb)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/postgresql/creation.py", line 51, in _execute_create_test_db
raise e
File "/usr/local/lib/python3.8/site-packages/django/db/backends/postgresql/creation.py", line 42, in _execute_create_test_db
super()._execute_create_test_db(cursor, parameters, keepdb)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/creation.py", line 156, in _execute_create_test_db
cursor.execute('CREATE DATABASE %(dbname)s %(suffix)s' % parameters)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.8/site-packages/django/db/utils.py", line 89, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 82, in _execute
return self.cursor.execute(sql)
django.db.utils.ProgrammingError: database "test_crapi" already exists

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "manage.py", line 35, in
main()
File "manage.py", line 31, in main
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.8/site-packages/django/core/management/init.py", line 381, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.8/site-packages/django/core/management/init.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.8/site-packages/django/core/management/commands/test.py", line 23, in run_from_argv
super().run_from_argv(argv)
File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.8/site-packages/django/core/management/commands/test.py", line 53, in handle
failures = test_runner.run_tests(test_labels)
File "/usr/local/lib/python3.8/site-packages/django/test/runner.py", line 629, in run_tests
old_config = self.setup_databases(aliases=databases)
File "/usr/local/lib/python3.8/site-packages/django/test/runner.py", line 552, in setup_databases
return _setup_databases(
File "/usr/local/lib/python3.8/site-packages/django/test/utils.py", line 170, in setup_databases
connection.creation.create_test_db(
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/creation.py", line 58, in create_test_db
self._create_test_db(verbosity, autoclobber, keepdb)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/creation.py", line 179, in _create_test_db
confirm = input(
EOFError: EOF when reading a line
Type 'yes' if you would like to try deleting the test database 'test_crapi', or 'no' to cancel:

@bijoyvarghese256
Copy link

Just re install the docker

@nextep
Copy link

nextep commented Mar 20, 2023

I had tried your suggestion and no go

@xwanghh
Copy link

xwanghh commented Mar 27, 2023

Do you have a specific solution?

@nikhil-rajesh
Copy link
Collaborator

nikhil-rajesh commented Apr 21, 2023

This is because there was an improper shutdown of crapi before and the test database was not deleted, can you remove the docker volume for the database and check?
#164 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants