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

Propagate/wrap error conditions of SPARQL endpoint #327

Open
alexdma opened this issue Mar 26, 2021 · 1 comment
Open

Propagate/wrap error conditions of SPARQL endpoint #327

alexdma opened this issue Mar 26, 2021 · 1 comment

Comments

@alexdma
Copy link

alexdma commented Mar 26, 2021

Re openjournals/joss-reviews#2731

If I try to execute a request from my API at http://grlc.io/api/alexdma/getty-linked-data-api/#/processes/get_processes

with application/json as a MIME type, I get an HTTP 200 but with the following payload (seemingly forwarded from the SPARQL endpoint)

{
  "error": {
    "cause": null,
    "stackTrace": [],
    "message": "/sparql?query={URLencoded query}",
    "localizedMessage": "/sparql?query={URLencoded query}",
    "suppressed": []
  },
  "stackTrace": ""
}

The reason seems to be that the Getty SPARQL endpoint will accept application/sparql-results+json but not application/json (if that's what GRLC is sending it as an Accept header). However the original response of the endpoint, as I have tested it, is a HTTP 500.

Falling back to a supported MIME type, or inspecting the JSON schema of the response payload, can be future enhancements nice to have, but I think it is more urgent to propagate error conditions in the response header of GRLC, so that one doesn't get misleading OKs.

Perhaps consider returning a 502 Bad Gateway for these cases, to highlight it is not GRLC's fault.

@c-martinez
Copy link
Collaborator

Hi @alexdma! Thanks for raising this issue. Very good point, definitely something to improve there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants