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

Server error after stopping timer #735

Closed
jamesewoo opened this issue Dec 2, 2023 · 2 comments
Closed

Server error after stopping timer #735

jamesewoo opened this issue Dec 2, 2023 · 2 comments
Labels
bug Reports of unexpected problems or errors
Milestone

Comments

@jamesewoo
Copy link

There is a 500 Server Error when working with timers:

To reproduce:

  1. Create a timer
  2. Click "Sleep"
  3. Click Submit
  4. Click the browser's back button

My babybuddy version is v2.1.2.

@cdubz
Copy link
Member

cdubz commented Dec 7, 2023

@jamesewoo are you able to reproduce the issue at https://demo.baby-buddy.net? I can't seem to.

If possible can you set your DEBUG environment variable to 1 and reproduce the issue? That should give you some more useful context to investigate and share.

@cdubz cdubz added need more info Needs more information from issue poster support Issues providing user support labels Dec 7, 2023
@jamesewoo
Copy link
Author

Here's what I got on the demo page. I used Firefox in private browsing mode.

Screenshot 2023-12-11 at 1 14 59 PM

Traceback:

Environment:


Request Method: GET
Request URL: https://demo.baby-buddy.net/sleep/add/?timer=2&child=lisa-evans

Django Version: 4.2.8
Python Version: 3.11.6
Installed Applications:
['api',
 'babybuddy.apps.BabyBuddyConfig',
 'core.apps.CoreConfig',
 'dashboard',
 'reports',
 'axes',
 'django_filters',
 'rest_framework',
 'rest_framework.authtoken',
 'widget_tweaks',
 'imagekit',
 'storages',
 'import_export',
 'qr_code',
 'dbsettings',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'whitenoise.middleware.WhiteNoiseMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'babybuddy.middleware.RollingSessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'babybuddy.middleware.UserTimezoneMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'babybuddy.middleware.UserLanguageMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'axes.middleware.AxesMiddleware',
 'babybuddy.middleware.HomeAssistant']



Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/site-packages/django/utils/decorators.py", line 46, in _wrapper
    return bound_method(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/site-packages/django/views/decorators/cache.py", line 62, in _wrapper_view_func
    response = view_func(request, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/site-packages/django/contrib/auth/mixins.py", line 109, in dispatch
    return super().dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/site-packages/django/views/generic/base.py", line 143, in dispatch
    return handler(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/site-packages/django/views/generic/edit.py", line 180, in get
    return super().get(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/site-packages/django/views/generic/edit.py", line 144, in get
    return self.render_to_response(self.get_context_data())
                                   ^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/site-packages/django/views/generic/edit.py", line 74, in get_context_data
    kwargs["form"] = self.get_form()
                     ^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/site-packages/django/views/generic/edit.py", line 39, in get_form
    return form_class(**self.get_form_kwargs())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/core/forms.py", line 92, in __init__
    kwargs = set_initial_values(kwargs, type(self))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/core/forms.py", line 46, in set_initial_values
    timer = models.Timer.objects.get(id=timer_id)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.11/site-packages/django/db/models/query.py", line 637, in get
    raise self.model.DoesNotExist(
    ^

Exception Type: DoesNotExist at /sleep/add/
Exception Value: Timer matching query does not exist.

I think the app is trying to stop a timer that has already been stopped and deleted.

@cdubz cdubz closed this as completed in e65b174 Jan 27, 2024
@cdubz cdubz added bug Reports of unexpected problems or errors and removed need more info Needs more information from issue poster support Issues providing user support labels Jan 27, 2024
@cdubz cdubz added this to the 2.2.1 milestone Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Reports of unexpected problems or errors
Projects
None yet
Development

No branches or pull requests

2 participants