mezza
unread,Nov 14, 2011, 2:16:28 AM11/14/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ActiveSalesforce
In the absence of a Reports REST API from Salesforce, I'm attempting
to do a series of SOQL queries that will return the data I need, and
from the returned data assembling the Report I want in Ruby.
It seems to work fine, and against my Sandbox instance I have no
issues at all.
When connecting to a Production instance, I'm running into odd SSL
buffering exceptions, that lead me to believe there might be a
possible bug in the databasedotcom gem or the http adapter.
If I do a standard client.query, then the page size of the returned
collection seems to be 2000 records. If I then do SOQL query using
attributes from all the results in a given collection page to get
related records, then I get the following error:
~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/openssl/buffering.rb:
145:in `sysread_nonblock': Connection reset by peer
(Errno::ECONNRESET)
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/openssl/
buffering.rb:145:in `read_nonblock'
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/protocol.rb:
135:in `rbuf_fill'
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/protocol.rb:
116:in `readuntil'
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/protocol.rb:
126:in `readline'
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:2211:in
`read_status_line'
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:2200:in
`read_new'
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:1183:in
`transport_request'
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:1169:in
`request'
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:1162:in
`block in request'
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:627:in
`start'
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:1160:in
`request'
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:880:in
`get'
from ~/.rvm/gems/ruby-1.9.2-p136/gems/databasedotcom-1.2.3/lib/
databasedotcom/client.rb:289:in `block in http_get'
from ~/.rvm/gems/ruby-1.9.2-p136/gems/databasedotcom-1.2.3/lib/
databasedotcom/client.rb:336:in `block (2 levels) in
with_encoded_path_and_checked_response'
from ~/.rvm/gems/ruby-1.9.2-p136/gems/databasedotcom-1.2.3/lib/
databasedotcom/client.rb:343:in `with_logging'
from ~/.rvm/gems/ruby-1.9.2-p136/gems/databasedotcom-1.2.3/lib/
databasedotcom/client.rb:335:in `block in
with_encoded_path_and_checked_response'
from ~/.rvm/gems/ruby-1.9.2-p136/gems/databasedotcom-1.2.3/lib/
databasedotcom/client.rb:349:in `ensure_expected_response'
from ~/.rvm/gems/ruby-1.9.2-p136/gems/databasedotcom-1.2.3/lib/
databasedotcom/client.rb:334:in
`with_encoded_path_and_checked_response'
from ~/.rvm/gems/ruby-1.9.2-p136/gems/databasedotcom-1.2.3/lib/
databasedotcom/client.rb:288:in `http_get'
from ~/.rvm/gems/ruby-1.9.2-p136/gems/databasedotcom-1.2.3/lib/
databasedotcom/client.rb:204:in `query'
The query is nothing complex, and of the form:
client.query('SELECT Id, Custom_Attribute__c FROM Custom_Object__c
WHERE Id IN ('A','B'...)")
If I modify my code to only do subsequent SOQL queries in batches of
250 records or less, then the code executes fine. Clearly, I could
just operate on batches of 250 records, but this will increase the
number of API calls, and for the Production system I'm aiming to
deploy to this could become an issue.
I suspect the issue might be to do with a chunked response from
Salesforce. Is this the case? What's the solution?
Thanks in advance. M