linuxserver / docker-healthchecks

GNU General Public License v3.0
177 stars 37 forks source link

Env vars might have wrong type #98

Closed TheCataliasTNT2k closed 1 year ago

TheCataliasTNT2k commented 1 year ago

linuxserver.io

If I set PING_BODY_LIMIT=10000 in my environment variables, this init script here converts it to a python string.


Expected Behavior

The value has to be an integer, if not, python will throw an exception. But it is stored as a string in the python file /app/healthchecks/hc/local_settings.py.

Current Behavior

If I set PING_BODY_LIMIT=10000 in my environment variables, this init script here converts it to a python string.

Steps to Reproduce

  1. Set PING_BODY_LIMIT=10000 in your environment variables, generate the settings completely new (creating new container or set the setting to do that).
  2. Ping one of the checks, and get the error:
    Internal Server Error: /ping/URL
    hc_1                   | Traceback (most recent call last):
    hc_1                   |   File "/usr/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    hc_1                   |     response = get_response(request)
    hc_1                   |   File "/usr/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    hc_1                   |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
    hc_1                   |   File "/usr/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    hc_1                   |     return view_func(*args, **kwargs)
    hc_1                   |   File "/usr/lib/python3.10/site-packages/django/views/decorators/cache.py", line 62, in _wrapped_view_func
    hc_1                   |     response = view_func(request, *args, **kwargs)
    hc_1                   |   File "/app/healthchecks/./hc/api/views.py", line 53, in ping
    hc_1                   |     body = request.body[: settings.PING_BODY_LIMIT]
    hc_1                   | TypeError: slice indices must be integers or None or have an __index__ method

Command used to create docker container (run/create/compose/screenshot)

docker-compose up -d with this particular env var

Docker logs

see above

github-actions[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

pinkworld123 commented 1 year ago

yes i also have same issue. temporary fix after first time run, i need to set - REGENERATE_SETTINGS=False in docker-compose of linuxserver.

and manually set value without string "" in local_settings.py

this solution works. but its not clean. so its better to fix it. thanks

according to healthchecks docs PING_BODY_LIMIT= should be integer or None value. but no string "" when set in local_settings.py

https://github.com/healthchecks/healthchecks/issues/727

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

TheCataliasTNT2k commented 1 year ago

Are issues generally ignored, or are you busy right now?

thespad commented 1 year ago

They're not ignored, we just have a lot of issues and not a lot of people so we have to prioritise based on severity and affected users. Bash is a pain with typing, I'll see what I can do.

thespad commented 1 year ago

Once this build is finished can you test with lspipepr/healthchecks:v2.5-pkg-1eaf64f2-pr-101 and see if it works.

pinkworld123 commented 1 year ago

They're not ignored, we just have a lot of issues and not a lot of people so we have to prioritise based on severity and affected users. Bash is a pain with typing, I'll see what I can do.

Is there any way to contribute to repo? I would like to help.

thespad commented 1 year ago

PRs are always welcome if you think you've got something useful to add. See https://github.com/linuxserver/docker-healthchecks/blob/master/.github/CONTRIBUTING.md for specifics.

TheCataliasTNT2k commented 1 year ago

They're not ignored, we just have a lot of issues and not a lot of people so we have to prioritise based on severity and affected users. Bash is a pain with typing, I'll see what I can do.

Well yes, that's ok. I asked, because in some repos, issues are generally ignored completely...