netsuite: NoMethodError: undefined method `results' for false:FalseClass when using NetSuite::Records::InventoryItem.search.results_in_batches
Starting only July 24th, and every day since, this code has started failing, even though the server hasn’t been updated. My code looks like this:
search = NetSuite::Records::InventoryItem.search
ns_items = []
search.results_in_batches do |batch|
puts "batch: #{batch.length}"
ns_items += batch
end
ns_items.length
The output looks like this:
batch: 1000
D, [2015-07-28T13:18:49.907366 #42726] DEBUG -- : HTTPI GET request to webservices.na1.netsuite.com (net_http)
D, [2015-07-28T13:18:50.073021 #42726] DEBUG -- : HTTPI POST request to webservices.na1.netsuite.com (net_http)
batch: 1000
D, [2015-07-28T13:19:03.984211 #42726] DEBUG -- : HTTPI GET request to webservices.na1.netsuite.com (net_http)
D, [2015-07-28T13:19:04.164485 #42726] DEBUG -- : HTTPI POST request to webservices.na1.netsuite.com (net_http)
batch: 1000
D, [2015-07-28T13:19:19.110026 #42726] DEBUG -- : HTTPI GET request to webservices.na1.netsuite.com (net_http)
D, [2015-07-28T13:19:19.286344 #42726] DEBUG -- : HTTPI POST request to webservices.na1.netsuite.com (net_http)
NoMethodError: undefined method `results' for false:FalseClass
from ~/.rvm/gems/ruby-2.2.2/bundler/gems/netsuite-8e2bdcdd9af1/lib/netsuite/support/search_result.rb:90:in `results_in_batches'
from ~/.../app/models/inventory_item.rb:43:in `update_kit_ids'
I’m using netsuite gem 0.4.2 at revision: 8e2bdcdd9af1692ffab21945fafbb987be057375
Is there something I can do to fix this?
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 17 (10 by maintainers)
@rudyyazdi sounds like a plan! Let me know what I can do to help!
@rudyyazdi Yes! I’ll share here in a gist the code I’m using now. I may be sharing more than is necessary for this situation but it’s been a long time since I wrote it.
https://gist.github.com/glennfu/56f0bab456d0bccafe0b6aab5cb7f8a5
Another thing you might try first, I had to put all these guys inline, no idea why, to get a search working:
search = NetSuite::Records::InventoryItem.search; ns_items = []; search.results_in_batches { |batch| ns_items += batch }; ns_items.lengthMoving them to separate lines caused it to blow up.
I hope something here helps!