Occasional Bitstamp API error
Every now and then, I get an error like this:
Server Response: 503 - https://www.bitstamp.net/api/ticker
Error with JSON: '[' or '{' expected near '<'
Buffer:
<html style="height:100%"><head><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"><meta name="format-detection" content="telephone=no"><meta name="viewport" content="initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"></head><body style="margin:0px;height:100%"><iframe src="/_Incapsula_Resource?CWUDNSAI=21&xinfo=5-355317-0%20NNNN%20RT%281517935718253%2067%29%20q%280%200%20-1%20-1%29%20r%28152%20-1%29%20b6%20U10000&incident_id=514000270000000519-2195046149521845&edet=20&cinfo=ffffffff3250" frameborder=0 width="100%" height="100%" marginheight="0px" marginwidth="0px">Request unsuccessful. Incapsula incident ID: 514000270000000519-2195046149521845</iframe></body></html>
Retry in 2 sec...
Usually, it only appears once, but today it happened continously for about 50 times or so and it's still happening. If anyone has any idea where it's coming from or why it is happening, feel free to comment here. It is weird, since it usually only happens once, so I guess there isn't actually a syntax error in the JSON on blackbirds side...
Hi @LasseMoench take a look at this comment about a timeout issue with Bitstamp and Incapsula.
Ok so according to that comment and the reddit thread mentioned there, Incapsula (Bitstamps anti-DDOS provider) is the reason for this. I will ask Bitstamp support if there is anything that can be done to avoid it, e.g. lowering the interval for querying.
@LasseMoench did you get a response from Bitstamp support regarding this issue?
I'm experiencing the same, except I get a 400 status code (when fetching order books via their API). It's pretty annoying, since the 400 status code causes my app to stop retrying. And when I visit the iframe "src" URL in the HTML response it says www.bitstamp.net - Response Failed, Error code 5, There was an error in processing the server response which sounds like it should be categorized as a 500 status code.
Did anyone here arrive at a strategy for handling this type of issue? I'm seeing long request duration's (which turn into timeouts for me).
Did anyone here arrive at a strategy for handling this type of issue? I'm seeing long request duration's (which turn into timeouts for me).
My strategy is to handle this response as a special case and change the status code to 500, which then causes a retry.
@runeksvendsen :(