Getting 500 Internal Server Error from Account.getVirtualGuests()

拟墨画扇 提交于 2020-01-06 15:18:52

问题


I have been using a particular method for the past year and a half for loading the virtual guests from our account. Sometime in the past week, it broken. The following code (using ruby gem 3.1.1) returns a 500 Internal Server Error:

  softlayer_client = SoftLayer::Client.new()
  obj_svc = softlayer_client['Account']
  obj_svc = obj_svc.object_mask('mask[ id,tagReferences  ]')
  result = obj_svc.getVirtualGuests()
  result.each do |pre_obj|
    puts pre_obj.inspect
  end

But this does not:

  softlayer_client = SoftLayer::Client.new()
  obj_svc = obj_svc.object_mask('mask[ id  ]')
  result = obj_svc.getVirtualGuests()
  result.each do |pre_obj|
    puts pre_obj.inspect
  end

Seems like tagReferences was broken recently, since this has been working for a long time.


回答1:


I've reviewed your first block of code and it works OK. Nevertheless, the problem that you're facing might be due to the number of objects that the method's returning, either virtual guests or tag objects. This can be avoided using a result_limit(OFFSET, LIMIT) as in the next example:

OFFSET = 0
LIMIT = 5
USERNAME = 'set me'
API_KEY = 'set me'
softlayer_client = SoftLayer::Client.new(username: USERNAME, api_key: API_KEY)
obj_svc = softlayer_client['Account']
obj_svc = obj_svc.object_mask('mask[ id,tagReferences  ]')
obj_svc = obj_svc.result_limit(OFFSET, LIMIT)
result = obj_svc.getVirtualGuests()
result.each do |pre_obj|
  puts pre_obj.inspect
end

If it doesn't solve your problem, try downloading the latest softlayer ruby client gem (i.e. 3.2.1)

You could review the next link as well:

https://sldn.softlayer.com/blog/phil/How-Solve-Error-fetching-http-headers



来源:https://stackoverflow.com/questions/38131357/getting-500-internal-server-error-from-account-getvirtualguests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!