REST API Errors 520, solved with a proxy

I made 50 requests to this url now, I didn’t get any errors, also it doesn’t return data for this particular to_date

This one works well again… The other one still give me an error

@cryptokid This is what I get sometimes when I test within the interface. I never encountered that before this weekend…

Undocumented error…

I tested with this https://deep-index.moralis.io/api/v2/0xe8a00ad589b5bda02c7bc9bba249445d1f53d50b/logs?chain=bsc&offset=0&to_date=2022-03-09%2014:01:01 100 times from a python script and I didn’t get any error

I definitely think there is something going on Moralis servers… these are purely random errors

it could be, how can I replicate that?
what do you do to replicate it?

Hum nothing fancy, I just use the parameters as shown above and try the request a few times. Sometimes work, sometimes not…

I am still not able to replicate it.
someone else seems like also has a similar problem: Deep Index Errors: 520, 502

Yes I saw this one but no solution at the moment because you were not able to replicate as well. If someone else can have a look would be great, I don’t think it’s an isolated case

this is the only endpoint that has this problem?

This works:

This doesn’t:

Maybe it’s something related to response content length. I mostly use logs endpoint but I also get this error while fetching “pair created” event with the rest api

I still get some errors 502 Bad gateway from the Moralis interface itself as follow:

curl -X 'GET' \
  'https://deep-index.moralis.io/api/v2/0x8482a932536fad492dcdbcedeb60cb9421ac384b/logs?chain=bsc' \
  -H 'accept: application/json' \
  -H 'X-API-Key

How is that possible?

Did you try to run the requests from another network/IP?

Yes and get the same error from another IP and network

When I debug the interface with the following simple query:
https://deep-index.moralis.io/api/v2/0x8482a932536fad492dcdbcedeb60cb9421ac384b/logs?chain=bsc

I get this error in my dev console:
“net::ERR_HTTP2_PROTOCOL_ERROR 200”

Any change in your Nginx config or related to HTTP2 or content length response header recently?

I got this in response as headers:

Response
:status: 200
Content-Type: application/json; charset=utf-8
Access-Control-Allow-Origin: *
Content-Encoding: gzip
ETag: W/"4f78a-qioR7lLRxZrkIRJFzXaMZYwem9k"
Date: Wed, 06 Apr 2022 11:59:07 GMT
Vary: Accept-Encoding
x-rate-limit-limit: 25
x-rate-limit-used: 2
x-powered-by: Express
Server: cloudflare
x-request-weight: 2
cf-cache-status: DYNAMIC
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
x-rate-limit-remaining-ip-ttl: 1
cf-ray: 6f7a5b08db188ce2-EWR
x-rate-limit-remaining-ttl: 1
x-rate-limit-ip-used: 2

what do you do to get that error?

I found a workaround. I created a proxy API to communicate with your API rather than calling it directly and everything looks to work fine again…

What is the difference?

Don’t know. The requests were all simple ones but for an unknown reason it works and direct call was not working

Did you do that through a backend like Node?