o2r-project / o2r-shipper

Export research compendia to repositories and archives
https://o2r.info/results/
Apache License 2.0
0 stars 3 forks source link

Internal Server Error when making new shipment #28

Closed jansule closed 7 years ago

jansule commented 7 years ago

When making a new shipment, the server responds with a 500 - Internal Server Error. The detailed error message is: TypeError("argument of type 'NoneType' is not iterable") and further File "shipper.py", line 253, in shipment_post_new if 'candidate' in current_compendium:TypeError: argument of type 'NoneType' is not iterable.

See the complete error log in the following:

{
  "data": "\n    <!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n    <html>\n        <head>\n            <title>Error: 500 Internal Server Error</title>\n            <style type=\"text/css\">\n              html {background-color: #eee; font-family: sans;}\n              body {background-color: #fff; border: 1px solid #ddd;\n                    padding: 15px; margin: 15px;}\n              pre {background-color: #eee; border: 1px solid #ddd; padding: 5px;}\n            </style>\n        </head>\n        <body>\n            <h1>Error: 500 Internal Server Error</h1>\n            <p>Sorry, the requested URL <tt>&#039;http://localhost/api/v1/shipment&#039;</tt>\n               caused an error:</p>\n            <pre>Internal Server Error</pre>\n              <h2>Exception:</h2>\n              <pre>TypeError(&quot;argument of type &#039;NoneType&#039; is not iterable&quot;,)</pre>\n              <h2>Traceback:</h2>\n              <pre>Traceback (most recent call last):\n  File &quot;/usr/local/lib/python3.6/site-packages/bottle.py&quot;, line 862, in _handle\n    return route.call(**args)\n  File &quot;/usr/local/lib/python3.6/site-packages/bottle.py&quot;, line 1740, in wrapper\n    rv = callback(*a, **ka)\n  File &quot;shipper.py&quot;, line 253, in shipment_post_new\n    if &#039;candidate&#039; in current_compendium:\nTypeError: argument of type &#039;NoneType&#039; is not iterable\n</pre>\n        </body>\n    </html>\n",
  "status": 500,
  "config": {
    "method": "POST",
    "transformRequest": [
      null
    ],
    "transformResponse": [
      null
    ],
    "jsonpCallbackParam": "callback",
    "url": "http://localhost/api/v1/shipment",
    "data": {
      "compendium_id": "4N4wo",
      "recipient": "zenodo_sandbox"
    },
    "headers": {
      "Accept": "application/json, text/plain, */*",
      "Content-Type": "application/json;charset=utf-8"
    }
  },
  "statusText": "Internal Server Error"
}
ghost commented 7 years ago

found the error. it happens, when you try to ship with non-existing compendium id. working on a fix.

could you please look into the db if there is an entry for your compendium id? would be useful for me to know this. If you dont mind, please also include the request you sent to the server.

jansule commented 7 years ago

The compendium id exists in the db. (Otherwise I also wouldn't be able to reach the page from where the shipment is triggered).

Here is my request to the server: api endpoint: POST http://localhost/api/v1/shipment

with following body

{
"compendium_id":"4N4wo",
"recipient":"zenodo_sandbox"
}

and following config


{
"headers": {
          "Content-Type": "multipart/form-data"
    }
}
ghost commented 7 years ago

please try again with current build.

jansule commented 7 years ago

Tried with current build but error still exists. See this commit to reproduce error.

ghost commented 7 years ago

Has already been resolved by one of the latest commits.