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

ads.SearchQuery returns a status 500 APIResponseError #103

Closed
barentsen opened this issue Apr 4, 2018 · 6 comments
Closed

ads.SearchQuery returns a status 500 APIResponseError #103

barentsen opened this issue Apr 4, 2018 · 6 comments

Comments

@barentsen
Copy link
Contributor

As of a few days ago, any query executed via ads.SearchQuery is failing for me with a Status 500 (Internal Server Error). In contrast, queries executed directly via curl work fine. Can anyone reproduce this?

Queries via curl work fine:

curl -H "Authorization: Bearer XXXXXX" 'https://api.adsabs.harvard.edu/v1/search/query?q=supernova'
{"responseHeader":{"status":0,"QTime":1202,"params":{"q":"supernova","x-amzn-trace-id":"Root=1-5ac45571-9b4e04a76ed0f5a5582825ba","fl":"id","start":"0","rows":"10","wt":"json"}},"response":{"numFound":189894,"start":0,"docs":[{"id":"13974266"},{"id":"14024550"},{"id":"13449936"},{"id":"14287281"},{"id":"14287265"},{"id":"14221554"},{"id":"14862719"},{"id":"14287247"},{"id":"14287150"},{"id":"14496802"}]}}

Same query via ads.SearchQuery fails:

Python 3.6.2 |Anaconda custom (64-bit)| (default, Jul 20 2017, 13:51:32) 

In [1]: import ads

In [2]: q = ads.SearchQuery(q="supernova")

In [3]: for paper in q:
   ...:     print(paper.title)
   ...: 
---------------------------------------------------------------------------
APIResponseError                          Traceback (most recent call last)
<ipython-input-3-d676df0a2251> in <module>()
----> 1 for paper in q:
      2     print(paper.title)

/home/gb/dev/ads/ads/search.py in __next__(self)
    499         # explicitly
    500         if self.response is None:
--> 501             self.execute()
    502 
    503         try:

/home/gb/dev/ads/ads/search.py in execute(self)
    534 
    535         self.response = SolrResponse.load_http_response(
--> 536             self.session.get(self.HTTP_ENDPOINT, params=q)
    537         )
    538 

/home/gb/dev/ads/ads/base.py in load_http_response(cls, http_response)
     92         """
     93         if not http_response.ok:
---> 94             raise APIResponseError(http_response.text)
     95         c = cls(http_response)
     96         c.response = http_response

APIResponseError: '{"responseHeader":{"status":500,"QTime":0,"params":{"json":"x-amzn-trace-id=Root%3D1-5ac4550e-a56a60d4d40c08349e8c5556&rows=10&q=identifier%3A2017AJ....153..265W&start=0&wt=json&fl=id"}},"error":{"msg":"java.lang.String cannot be cast to java.util.Map","trace":"java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map\\n\\tat org.apache.solr.request.json.ObjectUtil.mergeObjects(ObjectUtil.java:108)\\n\\tat org.apache.solr.request.json.RequestUtil.mergeJSON(RequestUtil.java:262)\\n\\tat org.apache.solr.request.json.RequestUtil.processParams(RequestUtil.java:177)\\n\\tat org.apache.solr.util.SolrPluginUtils.setDefaults(SolrPluginUtils.java:180)\\n\\tat org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:150)\\n\\tat org.apache.solr.core.SolrCore.execute(SolrCore.java:2213)\\n\\tat org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:654)\\n\\tat org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:460)\\n\\tat org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:303)\\n\\tat org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:254)\\n\\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)\\n\\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)\\n\\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)\\n\\tat org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)\\n\\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)\\n\\tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1160)\\n\\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)\\n\\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)\\n\\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1092)\\n\\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\\n\\tat org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)\\n\\tat org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)\\n\\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)\\n\\tat org.eclipse.jetty.server.Server.handle(Server.java:518)\\n\\tat org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)\\n\\tat org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:244)\\n\\tat org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)\\n\\tat org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)\\n\\tat org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)\\n\\tat org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:246)\\n\\tat org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:156)\\n\\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)\\n\\tat org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)\\n\\tat java.lang.Thread.run(Thread.java:748)\\n","code":500}}\n'
@andycasey
Copy link
Owner

andycasey commented Apr 4, 2018 via email

@barentsen
Copy link
Contributor Author

Thanks for the speedy response ADS and @andycasey!

@huib-van-langevelde
Copy link

Great, have been trying to debug this, thanks for sharing.

@onekiloparsec
Copy link

onekiloparsec commented Apr 4, 2018

As far as I can tell, the fix isn't yet deployed.

(edit/vsudilov) - this link had sensitive information

@marblestation
Copy link

The fix has been deployed in ADS and it should be working now!

@vsudilov vsudilov closed this as completed Apr 4, 2018
@barentsen
Copy link
Contributor Author

Thanks everyone, I confirm it's working again for me!

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

6 participants