Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2222] ACS - Event.Query suddenly returns Internal 500 response

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionFixed
Resolution Date2013-08-30T17:41:15.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
LabelsACS, triage
ReporterDaniel Sefton
AssigneeShak Hossain
Created2013-08-27T11:03:50.000+0000
Updated2016-03-08T07:41:13.000+0000

Description

The following query returns Internal Server Error 500 since 2013-08-27 01:32:58 UTC. This query was working fine until 2013-08-26 23:25:28 UTC and no code changes occurred.
Cloud.Events.query({
    order : {
	lnglat : {
	    '$nearSphere' : [currentlat, currentlon],
	}
    }
}, function(e) {
...
}
Request Time	2013-08-27 01:32:58 UTC
Request Name	GET /v1/events/query.json
Response Status	500
Response Message	Error: Internal Server Error
Parameters	 { "oauth_consumer_key" => "oA7...a9L", "_session_id" => "Vtb-aHJbcIH0k0syT08CjDgL2E0", "order" => "{"lnglat":{"$nearSphere":[40.42369079589844,-79.92929077148438]}}", "suppress_response_codes" => "true", "controller" => "events", "action" => "query", "version" => "v1", "format" => "json" }
Authorization	OAuth realm="",oauth_version="1.0",oauth_consumer_key="oA7...a9L",oauth_signature_method="HMAC-SHA1",oauth_nonce="TGKlzI22QnrEA23",oauth_timestamp="1377567177",oauth_signature="4IBNrfxaeRVEL%2BWt0bClDeWzSto%3D"
User Agent	Appcelerator Titanium/3.1.2.GA (iPhone/6.1.3; iPhone OS; en_US;)
Source IP	71.206.237.230
Response Size	135 bytes

Request Time	2013-08-26 23:25:28 UTC
Request Name	GET /v1/events/query.json
Response Status	200
Parameters	 { "oauth_consumer_key" => "oA7...a9L", "_session_id" => "ZLEH6hH4qixFpbXKfH8x-H3ShdY", "order" => "{"lnglat":{"$nearSphere":[40.305538177490234,-79.99760437011719]}}", "suppress_response_codes" => "true", "controller" => "events", "action" => "query", "version" => "v1", "format" => "json" }
Authorization	OAuth realm="",oauth_version="1.0",oauth_consumer_key="oA7...a9L",oauth_signature_method="HMAC-SHA1",oauth_nonce="72fLOFlpvzG3OrO",oauth_timestamp="1377559528",oauth_signature="YyBJI%2BM7%2FXBUNqwj9Ldf6TJJVsw%3D"
User Agent	Appcelerator Titanium/3.1.2.GA (iPhone/6.1.3; iPhone OS; en_US;)
Source IP	166.137.81.166
Response Size	5844 bytes

Attachments

FileDateSize
photo.PNG2013-08-28T17:33:47.000+0000179876

Comments

  1. Daniel Sefton 2013-08-27

    Hi N Morris, Our deepest apologies for the inconvenience. We have fixed the issue. It would be great if you could try again and let us know the outcome. Thanks!
  2. Bruce Parr 2013-08-27

    Just tested from my application. I am still getting the same error.
  3. Daniel Sefton 2013-08-27

    Thanks. I will escalate to engineering.
  4. Daniel Sefton 2013-08-28

    Hi Bruce, Please can you try again? Thanks a lot!
  5. Nicholas Conroy 2013-08-28

    Of course our client is presenting his app to investors today. We are getting a slightly different problem now. The response returns 200 but zero results. This is the same search that has been running perfectly for months and definitely has results. Here is the search: {"per_page":60,"response_depth":3,"where":{"lnglat":{"$nearSphere":[150.8077095,-34.4821236],"$maxDistance":47.08836917281432},"start_time":{"$lte":"2013-09-04T10:25:58+00:00","$gte":"2013-08-28T10:25:58+00:00"}},"order":"start_time"} Removing either lnglat OR start_time filters has no effect on the issue. Removing the where clause entirely returns everything. Is this related to the same issue? Any word on ETA for this fix?
  6. Wei Kong 2013-08-28

    We are not seeing this issue any more based on your sample query. Can you please confirm it is still an issue?
  7. Nicholas Conroy 2013-08-28

    This is still an issues on our end.
  8. Wei Kong 2013-08-28

    we are looking into it. Please provide your app key so that we can look into it. you can email to me wkong@appcelerator.com
  9. Nicholas Conroy 2013-08-28

    I am now getting "Error: Internal Server Error" with the same search
  10. Hiorshi Oyamada 2013-08-28

    Hi, Wei, I have similar issue.

    symptom

    In my case *Cloud.Places.query* suddenly doesn't work at Aug 26. Probably around 21:00-23:00(PDT) It works following sample code which is written by CoffeeScript ---- Cloud = require('ti.cloud') Cloud.Places.query page: 1 per_page: 200 where: state:'tokyo' ---- But, it doesn't work ---- Cloud = require('ti.cloud') Cloud.Places.query page: 1 per_page: 20 where: lnglat: $nearSphere:[longitude,latitude] $maxDistance: 0.01 ---- Accroding to My App log, status code is 200 and parameters is as follows bq. { "key" => "xx", "page" => "1", "per_page" => "20", "where" => "{"lnglat":{"$nearSphere":[longitude,latitude],"$maxDistance":0.01}}

    expected

    Retreive shopData from acs and then show icon as follows !http://craftbeer-fan.info/assets/themes/clean-canvas-wrap/img/capture/feature-01.png! Should I send my app key to your email *wkong@appcelerator.com* if you need? Best Regards, Hiroshi
  11. Wei Kong 2013-08-28

    Can you please try again? BTW, there are several issues with this query "$maxDistance":47.08836917281432},"start_time":{"$lte":"2013-09-04T10:25:58+00:00","$gte":"2013-08-28T10:25:58+00:00"}} maxDistance is way too big here. See http://docs.appcelerator.com/cloud/latest/#!/guide/search_query $maxDistance used with $nearSphere to limit maximum search distance. All distances use radians. This allows you to easily multiply by the radius of the earth (about 6371 km or 3959 miles) to get the distance in your choice of units. Conversely, divide by the radius of the earth when doing queries To find users named joe near longitude -122.1 and latitude 37.1 with maximum distance of 5 miles (convert 5 miles to radians, 5/3959 = 0.00126) Also we don't support timestamp format 2013-09-04T10:25:58+00:00 it should be 2013-09-04T10:25:58+0000 or 2013-09-04T10:25:58-0000 Did this work before?
  12. Hiorshi Oyamada 2013-08-28

    Hi, Wei, My apps work fine! Appreciate your support. Hiroshi
  13. Bruce Parr 2013-08-28

    As of 1:14 PM EDT, this is still a problem in my app. This morning I tried reversing the lat/lon to lon/lat in the query thinking that was the issue. It did not resolve anything. https://docs.google.com/file/d/0B3HdkNE9WNvPbm9EMjhNeWl1aFk/edit?usp=sharing
  14. Wei Kong 2013-08-28

    The issue with Bruce's app is that the $nearSphere is pass in as order instead of where.
  15. Bruce Parr 2013-08-28

    Wei, If that were the case, 1) Why did it work for an entire year until last week? 2) Please refer to ACS documentation at http://docs.appcelerator.com/cloud/latest/#!/guide/search_query where it states "To find users named joe near longitude -122.1 and latitude 37.1 with maximum distance of 5 miles (convert 5 miles to radians, 5/3959 = 0.00126) where={"first_name":"joe", "coordinates":{"$nearSphere":[-122.1,37.1], "$maxDistance" : 0.00126}} order Sort results by one or more fields. In general, you can sort based on any predefined field that you can query using the where operator, as well as on custom fields. Any exceptions to this rule are noted in API reference for the individual query methods." If there are exceptions to this documentation, I have yet to find them. From what I can tell, your own documentation supports what I tried to do.
  16. Wei Kong 2013-08-28

    Hi Bruce, According to the log you sent me(see blow), you did order={"first_name":"joe", "coordinates":{"$nearSphere":[-122.1,37.1], "$maxDistance" : 0.00126}} instead of where={"first_name":"joe", "coordinates":{"$nearSphere":[-122.1,37.1], "$maxDistance" : 0.00126}} I don't see any where in the parameters for order we only accept a list of field names not a json hash. The internal server error is a bug on our side when order is passed in with invalid format. We can fix it to output better error message. I'm not sure how geo query worked for you for one year since from the log, I don't think any geo query was performed, it was just a basic query. It is possible that we changed the code so that invalid order string is throwing error instead of being slient Except from your log: Parameters { "oauth_consumer_key" => "xxx", "_session_id" => "xxx", "order" => "{"lnglat":{"$nearSphere":[-79.69265747070313,40.31901931762695]}}", "suppress_response_codes" => "true", "controller" => "events", "action" => "query", "version" => "v1", "format" => "json" }
  17. Bruce Parr 2013-08-29

    I eliminated the where clause and sort from my query and it at least returns data. I can live with that for now until I figure out a way to sort by distance from the current user.

JSON Source