EUDAT-B2SHARE / b2share

B2SHARE software for the EUDAT CDI services.
https://b2share.eudat.eu
GNU General Public License v2.0
35 stars 32 forks source link

Internal server error while listing records per community (eiscat) through the API #866

Closed janiheikkinen closed 8 years ago

janiheikkinen commented 8 years ago

$ curl -k -i https://trng-b2share.eudat.eu/api/records/eiscat?access_token=0987654321 HTTP/1.1 500 INTERNAL SERVER ERROR Date: Thu, 03 Mar 2016 15:01:46 GMT

{"status": 500, "message": "Internal Server Error"}

emanueldima commented 8 years ago

@llehtine do we have a stack trace?

llehtine commented 8 years ago

Getting this on the server:

2016-03-04 13:29:45,140 ERROR: Internal Error [in /var/www/.virtualenvs/b2share/lib/python2.7/site-packages/flask_restful/__init__.py:287]
Traceback (most recent call last):
  File "/var/www/.virtualenvs/b2share/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/var/www/.virtualenvs/b2share/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/var/www/.virtualenvs/b2share/lib/python2.7/site-packages/flask_restful/__init__.py", line 397, in wrapper
    resp = resource(*args, **kwargs)
  File "/var/www/.virtualenvs/b2share/lib/python2.7/site-packages/flask/views.py", line 84, in view
    return self.dispatch_request(*args, **kwargs)
  File "/var/www/.virtualenvs/b2share/lib/python2.7/site-packages/flask_restful/__init__.py", line 487, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/var/www/.virtualenvs/b2share/lib/python2.7/site-packages/invenio-2.0.7.dev20150901-py2.7.egg/invenio/ext/restful/__init__.py", line 297, in decorated
    resp = f_oauth_required(*args, **kwargs)
  File "/var/www/.virtualenvs/b2share/lib/python2.7/site-packages/flask_oauthlib/provider/oauth2.py", line 476, in decorated
    return f(*args, **kwargs)
  File "/var/www/.virtualenvs/b2share/lib/python2.7/site-packages/invenio-2.0.7.dev20150901-py2.7.egg/invenio/b2share/modules/b2deposit/restful.py", line 220, in get
    domain_records = BibrecBib98x.query.filter_by(id_bibxxx=domain.id).all()
AttributeError: 'NoneType' object has no attribute 'id'
emanueldima commented 8 years ago

It looks like the eiscat domain is not defined in the database. Could be related/solved by https://github.com/EUDAT-B2SHARE/b2share/pull/865

llehtine commented 8 years ago

Hi, It should be there:

root@trng-eudatis log]# sudo -u apache /var/www/.virtualenvs/b2share/bin/inveniomanage config get CFG_B2SHARE_DOMAINS
generic, drihm, linguistics, euon, bbmri, nrm, gbif, rda, aalto, eiscat
[root@trng-eudatis log]# /etc/init.d/httpd restart

mysql> select id,name,dbquery from collection where id=11;
+----+--------+------------+
| id | name   | dbquery    |
+----+--------+------------+
| 11 | Eiscat | 980:Eiscat |
+----+--------+------------+
1 row in set (0.00 sec)

mysql> select * from collection_collection where id_son=11;
+--------+--------+------+-------+
| id_dad | id_son | type | score |
+--------+--------+------+-------+
|      1 |     11 | r    |    10 |
+--------+--------+------+-------+
1 row in set (0.00 sec)
emanueldima commented 8 years ago

Ok, then this happens when there is no indexed record in the corresponding domain.

@janiheikkinen Could you tell us if this also happens after you have already deposited records in the eiscat domain?

janiheikkinen commented 8 years ago

After depositing the first record for eiscat domain, the error does not occur.