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

API server error when requesting items that don't exist #229

Open
jkeifer opened this issue Oct 20, 2023 · 0 comments
Open

API server error when requesting items that don't exist #229

jkeifer opened this issue Oct 20, 2023 · 0 comments

Comments

@jkeifer
Copy link
Collaborator

jkeifer commented Oct 20, 2023

What should be a 404 ends up being a 500 with a traceback like

[ERROR] TypeError: 'NoneType' object is not subscriptable
Traceback (most recent call last):
  File "/var/task/lambda_function.py", line 161, in lambda_handler
    item = statedb.dbitem_to_item(statedb.get_dbitem(payload_id))
  File "/var/task/cirrus/lib2/statedb.py", line 570, in dbitem_to_item
    state, updated = dbitem["state_updated"].split("_")

That statedb.get_dbitem() call is typed to return a dict, but can also return None (https://github.com/cirrus-geo/cirrus-geo/blob/main/src/cirrus/lib2/statedb.py#L83). That we are indiscriminately passing the return value of that function into statedb.dbitem_to_item(), which expects an item dict, not None, is the basis for this exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant