NFT Search API Returns 500 Internal Server Error

While using the API located at https://deep-index.moralis.io/api/v2/nft/search, I receive 500 Internal Server Errors. About a week ago, it would return 200 about 50% of the time, but 500 the other 50% of the time. I was able to run these requests back to back and one would be rejected with a 500, and the following request (same endpoint, same headers, same everything) would return valid data mere seconds later.

Now, it returns a 500 Internal Server Error with every request, and my code to handle these requests has not changed. I even tried doing sample queries through the API Reference website at https://docs.moralis.io/reference/searchnfts for the search API, and it returned a 500 response as well, so I know the issue cannot only be with my code.

I tried attaching a screenshot of the 500 error in the Moralis website, as well as a screenshot of the internal server error and the corresponding network request sent to Moralis, but the forum rejects more than 1 image from my post. As a result, I am posting the network request, as I feel that adds the largest amount of details. I have cropped the API Key from the network request, but I do send our API Key with the request.

Please let me know if you need more details from me.

Thanks for reporting. We will look into it and update it here when it is resolved.

Hi @hades, for a temporary fix can you try using other params like from/to date or from/to block or addresses for narrowing down the results?

Hey @johnversus, I can add additional filters for now. The from/to options don’t change the 500/200 status frequencies for small search strings like ape, but if I only send longer search strings, I more consistently get a 200 status code.

I’m assuming this has to do with finding too many search results on your end. However, the issue still arises in that it’s hard for me to predict how many filters I need to add - the number of results varies widely depending on the search string irrespective of length. For the product I’m developing, it doesn’t seem prudent to require rather long search strings, as I’m simply trying to return a few results regardless of their search length.

If this is indeed related to finding too many results or the search getting terminated due to the search taking too long, perhaps it would be sufficient to add an extra search parameter as an option that I can use to signal your search algorithm to terminate after only finding a few results, instead of finding all the results and paging them.

I’ll keep following this thread for updates so I can (eventually) provide a better user experience on my project. Thanks for the update!

2 Likes