RockefellerArchiveCenter/fornax

POST request to /sips in web browser is throwing KeyError for "identifier"

Opened this issue · 2 comments

Describe the bug

When submitting a POST request (to create a SIP) via the web form at /sips/, I am brought to an error page with the following message:

<h1>KeyError at /sips/</h1>
  <pre class="exception_value">'identifier'</pre>
  

Request Method: | POST
-- | --
http://localhost:8003/sips/
3.2.5
KeyError
'identifier'
/code/sip_assembly/views.py, line 38, in create
/usr/local/bin/python
3.6.14
['/code',  '/usr/local/lib/python36.zip',  '/usr/local/lib/python3.6',  '/usr/local/lib/python3.6/lib-dynload',  '/usr/local/lib/python3.6/site-packages']

I encountered this locally in a container working on a branch off of development.

To reproduce

Using the web form at /sips/, submit a POST request including valid (or even invalid) JSON.

Expected behavior

A SIP is created and the /sips/ page is returned.

Additional context

I do not know yet exactly where this issue is originating, but we've encountered other issues in microservices related to identifier and bag_identifier being used to refer to the same thing.

Okay, so the issue is that the web form has "bag_identifier" as the field name, but in the views, "identifier" is expected. So the problem is with the web form (it works when I changed "bag_identifier" to "identifier").

@bonniegee can you file an issue on Zodiac about this general problem? I think we need to look at aligning what's being POSTed with underlying field names. This affects multiple apps so we'll need to do additional research (and file additional issues) but that's a problem for another day.