express graphql always sends 500 Internal server error for any thrown error from resolver - graphql

I am using express graphql in my node app . and it graphql always sends 500 Internal server error for any thrown error from resolver. Please suggest any solution so i will get proper response and status code

The express-graphql sends the HTTP error 500 whenever detects there is no data returned. Definitely, in case of exception is thrown there won't be a returning data. Although it looks like an obvious bug the developers have their own opinion on that. They seemed to decide providing an option to disable the feature so that the server shouldn't set the 500 error. At least the open issue on that is still there.
Checking out the sources I've found these options to get around the problem:
To set any other response code than 200 (e.g. 299 (custom)) in your resolver.
To set the response code in your error formatting handler. This seems to be the most optimal solution.
Just to pick up some other library =)

Related

IIS 10 Failed Request 500 - General_Request_Start Failed To Complete

I'm trying to understand why after deployment my server is returning 500 - Internal server error for a simple GET request that checks the server's status which is supposed to return 200 (when I run it locally with unit tests I wrote, it works fine). I retrieved the failed request log, but can't quite seem to understand what the problem is.
In several events the severity column shows: Failed To Complete
The Request summary shows:
These are the Errors and Warnings shown:
Does anyone know why I might be getting theses errors, or why I might be getting a 500 Internal Server error response?
I will add that I already have a GET request that is working:
https://myalertsserver.cloudapp.net/providers/management/alerts which returns 200.
and when I try:
https://myalertsserver.cloudapp.net/providers/status I get a 404 Error.
It seems to me like it has to do with something in the configuration, but I can't seem to understand what.
Thanks in advance.

OpenURI::HTTPError Exception: 500 Internal Server Error

Unable to open URL "http://www.diretaimoveisbh.com.br//Resultado.asp?nTransacao=V&vid_tipoimovel=&vId_bairro=&pagina=11" with open-uri, It keeps throwing error "OpenURI::HTTPError Exception: 500 Internal Server Error", I searched everywhere but didnt got any solution.
Please help If anyone here know how to resolve that issue.
Thanks in advance.
If you get a 500 back from the server, something is really broken somewhere, probably on the server. Maybe the URL is broken too.
Expect issues retrieving the data you want unless you receive a 200 back from the server. 200 code means everything you expect should be there, 4xx or 5xx code is something completely different, see for more info.
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
In the meantime, you may try/catch the exception, but keep in mind, its most likely not going to contain anything (except maybe error information) in the payload until its returning a 200.

4xx Response from server doesn't include JSON data

I've got a .NET MVC site that uses JSON to perform AJAX form Posts. If a validation error occurs (ie user misses a required field etc), then the server returns the validation errors in a JSON object and sets the HTTP status code of the response to something in the 400 range. On our local machines, this works absolutely fine.
However on our CI environment, it has suddenly stopped working, without any code changes. The response comes back from the server with the correct HTTP code, but the content is not the JSON our controller returns, but the standard .NET error page HTML, ie just the 11-byte 'Bad Request' response if the status code is 400.
The error code is correct for each validation error, so we are hitting the right controller/action, and the validation is working correctly, but for some reason our JSON is getting snipped out. Any ideas why this might be happening?
You are getting 400 code because your request syntax in not correct. Check if you have actually encode json data correctly or not.

What other 5xx errors could be occuring and how to I find/track them?

I have a Classic ASP/VBScript site running on IIS 6, and a program called SmarterStats (found via an earlier question) providing various stats and info from the server logs. This is an internal site, and we do use integrated authentication (AUTH_TYPE = Negotiate).
I'm looking at the report on response codes, and it says that in the last 7 days there have been 255 responses with a 5xx error code... naturally not the most useful stat I could get back.
I have a custom error page for 500 and 500.100 errors that logs the specifics for me to follow up on - and that log is virtually empty. I've tested with an intentionally broken page, and a standard user account, and it is working as expected - custom message, log entry made. (and checked with "friendly error messages" on and off - works either way)
The only entry I have in the log is a single entry for an error -2147024843 (authentication related, took too long to get a response), and that's it... what other errors could be happening and how can I find/track them?
Should I route all the different types of 5xx errors through my custom page? Or is there something else I should be doing?
Resolution: I'm going to go with running all 5xx errors through the custom page. For reasons that leave me totally baffled, the errors have stopped... I've not changed anything, no one has changed anything on that server - but the errors have stopped. Go figure.
It seems like logging all 5xx errors via your custom page might be a good idea. Your logging seems to be working, but SmarterStats seems like it might be giving you bogus data?
What version of SmarterStats are you using?
My hosting provider has Version 5.2 and I can see a detailed list of which pages have produced a 5xx error by going to Report Items > Server Responses > 5xx - Server Errors in the navigation tree. The report that gets displayed has a table listing the pages that have produced the error codes so you can then go investigate those pages to see what may be causing the error.
Depending on your site the error might be perfectly normal, for example I have some custom HTTP handlers which implement a standardised HTTP protocol which actually specifies that 5xx errors should be thrown under certain circumstances.
Though this shouldn't apply to an internal only site on public websites it is sometimes the case that badly written crawlers will access your pages in such a way as to produce an error

How to do error handling in Jmeter

I'm using Jmeter to do a load testing for a website.
JMeter does not show errors other than 404 errors.
How can I get the error messages in JMeter for the errors that occur for other cases?
By default, JMeter only flags typical HTTP error response codes, like 4XX and 5XX errors.
You should use Response Assertions on your HTTP samplers if you wish to have finer control over what is flagged as an error.
You can use 404 code as a success also. When you put your assertion with 404, there is a checkbox in the corner that says 'Ignore Status'. This will treat also 404 as a success.
One annoyance with this though seems to be that JMeter always treats a 404 as an error, when can be a valid response for some applications. So even if you make an assertion that a 404 response is OK, it will still show as an error.

Resources