Crash with `TypeError: list indices must be integers or slices, not str`
POST on /records endpoint
Traceback (most recent call last):
File "pyramid/tweens.py", line 41, in excview_tween
response = handler(request)
File "kinto/core/events.py", line 166, in tween
response = handler(request)
File "pyramid/router.py", line 117, in handle_request
root = root_factory(request)
File "kinto/core/authorization.py", line 180, in __init__
if resource.object_id is not None: # Skip POST on plural without id.
File "pyramid/decorator.py", line 41, in __get__
val = self.wrapped(inst)
File "kinto/core/resource/__init__.py", line 262, in object_id
_id = self.request.json["data"][self.model.id_field]
TypeError: list indices must be integers or slices, not str
https://mozilla.sentry.io/issues/7070562065/
Hi, I’m interested in helping with this issue, but I’m quite new to both Kinto and contributing to open source.
Before I start, could someone please let me know if this bug is still reproducible on the current main branch and whether it’s available for a new contributor to work on?
If it is, I’d really appreciate some guidance on how to get started, for example:
what is the minimal setup or configuration to reproduce the crash on the /records endpoint?
what is the expected shape of the JSON payload for request.json["data"] in this code path?
are there any existing tests or files you’d recommend I look at first?
Once I can reliably reproduce the error locally, I’ll be happy to propose a fix and open a pull request.
Thanks!