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

Bug - 500 error for /dissemination/search/: 'NoneType' object is not iterable #4731

Open
phildominguez-gsa opened this issue Feb 27, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@phildominguez-gsa
Copy link
Contributor

phildominguez-gsa commented Feb 27, 2025

Also occurs with /advanced

Erroring line: https://github.com/GSA-TTS/FAC/blob/main/backend/dissemination/views.py#L135

Example request: https://one.newrelic.com/logger?account=3919076&begin=1740511680000&end=1740511800000&state=ccc0bf9f-ffb8-ed81-0c43-b6e16ab75ae6

Example response: https://onenr.io/0ZQWXJk63wW

"Traceback (most recent call last):\n File "/home/vcap/deps/1/python/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner\n response = get_response(request)\n ^^^^^^^^^^^^^^^^^^^^^\n File "/home/vcap/deps/1/python/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response\n response = wrapped_callback(request, *callback_args, **callback_kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/home/vcap/deps/1/python/lib/python3.12/site-packages/newrelic/hooks/framework_django.py", line 527, in wrapper\n return wrapped(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^\n File "/home/vcap/deps/1/python/lib/python3.12/site-packages/django/views/generic/base.py", line 104, in view\n return self.dispatch(request, *args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/home/vcap/deps/1/python/lib/python3.12/site-packages/django/utils/decorators.py", line 48, in _wrapper\n return bound_method(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/home/vcap/deps/1/python/lib/python3.12/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper\n return view_func(request, *args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/home/vcap/app/dissemination/views.py", line 158, in dispatch\n return super(AdvancedSearch, self).dispatch(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/home/vcap/deps/1/python/lib/python3.12/site-packages/newrelic/hooks/framework_django.py", line 900, in wrapper\n return wrapped(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^\n File "/home/vcap/deps/1/python/lib/python3.12/site-packages/django/views/generic/base.py", line 143, in dispatch\n return handler(request, *args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/home/vcap/app/support/decorators.py", line 15, in wrapper_timer\n value = func(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^\n File "/home/vcap/app/dissemination/views.py", line 236, in post\n paginator_results = _populate_cog_over_name(paginator_results)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/home/vcap/app/dissemination/views.py", line 135, in _populate_cog_over_name\n for result in results:\n ^^^^^^^\nTypeError: 'NoneType' object is not iterable"

@github-project-automation github-project-automation bot moved this to Triage in FAC Feb 27, 2025
@phildominguez-gsa phildominguez-gsa added the bug Something isn't working label Feb 27, 2025
@phildominguez-gsa phildominguez-gsa changed the title Bug - 500 error for /search/advanced/: 'NoneType' object is not iterable Bug - 500 error for /dissemination/search/: 'NoneType' object is not iterable Feb 27, 2025
@phildominguez-gsa phildominguez-gsa self-assigned this Feb 27, 2025
@phildominguez-gsa
Copy link
Contributor Author

I tried replicating this both locally and in prod using the same search params and never encountered a 500. I'm not seeing anything suspicious with the code, either. Closing for now!

@phildominguez-gsa phildominguez-gsa closed this as not planned Won't fix, can't repro, duplicate, stale Feb 28, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in FAC Feb 28, 2025
@phildominguez-gsa
Copy link
Contributor Author

Still seeing a handful of these each week. Reopening.

@phildominguez-gsa phildominguez-gsa moved this from Done to Triage in FAC Mar 6, 2025
@phildominguez-gsa phildominguez-gsa removed their assignment Mar 6, 2025
@jperson1
Copy link
Contributor

It's difficult to get this to happen locally. It looks like the form comes in invalid, and so the default paginator_results value of None is passed into _populate_cog_over_name.

I can get it to happen occasionally by inputting a bad fiscal year start/end date.

See here:

paginator_results = _populate_cog_over_name(paginator_results)

Perhaps this is quickly fixed by doing one of:

  1. Checking for None, and returning None
  2. Setting the default paginator_results value to an empty list or empty Paginator object
  3. Moving the _populate_cog_over_name call into the block where paginator_results is populated

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
Status: Triage
Development

No branches or pull requests

2 participants