Hi community,
Our team is currently running Parse Server v.3.0.0 with a few PHP client applications using Parse PHP SDK v.1.3, and we are noticing some very strange behavior when executing simple queries against the server.
The queries are usually in the form of /parse/classes/SomeObject?where={"someField":"someValue"}&limit=1
(only one field used for filtering, the limit
may vary if we are using ParseQuery::first
or not). Also, queries are made using the master key
.
The errors are low-level PHP errors in the ParseQuery class, such as:
#1
ErrorException: Warning: Invalid argument supplied for foreach()
#7 /vendor/parse/php-sdk/src/Parse/ParseQuery.php(440): Parse\ParseQuery::find
#6 /vendor/parse/php-sdk/src/Parse/ParseQuery.php(366): Parse\ParseQuery::first
#2
ErrorException: Notice: Undefined index: count
php-sdk/src/Parse/ParseQuery.php(415): Parse\ParseQuery::count
#3
ErrorException: Notice: Undefined index: results
#6 /vendor/parse/php-sdk/src/Parse/ParseQuery.php(440): Parse\ParseQuery::find
All the errors revolve around the client lib interpreting the query response as successful (meaning it probably did not receive an error response) and the response not containing the expected results: []
field in its payload, even if there were no results yielded from the query.
Upon checking the http access logs for our Parse Server instance, we can see that the server is returning HTTP 200
responses, but it (probably) does not have a “normal” response body.
One query example usually returns a response with 202 bytes in size (given that it’s producing the same result), but at the moment of the error, the response is only 14 bytes in size with the same HTTP 200
status.
Additionally, it appears that every time the error occurs, the response size is 14 bytes.
We still need to devise a way to log the actual request/response body in the Parse Server instance to confirm that it’s actually the case.
The errors are intermittent and somewhat random. They occur for queries on varied classes, and so far we were not able to find any patterns or correlations that could be causing such behavior. Both server and client apps are running on AWS Elastic Beanstalk instances.
Questions:
-
Any hints as to what could be causing such behavior? Maybe a permissions problem? Maybe the server wasn’t able to deal with the concurrent number of requests it was receiving? Maybe the resource was locked for some reason?
-
Any ideas on how to further troubleshoot this?
-
Is there any standard way to log the HTTP request/response body in the Parse Server instance? If not, is there a preferred way (e.g. with a Middleware impl.)?
-
Assuming that something is going wrong within the server while it’s processing the query request, are there any logs that we could increase the verbosity of so that we can better understand the root cause?
Really appreciate any pointers on this.