Skip to content

Order Bot Trouble Shooting

dmkrtchyan edited this page Apr 18, 2018 · 2 revisions

STEP 1:

orders = Spree::Order.where("completed_at >= ? AND orderbot_synced is null AND state = 'complete'", 7.days.ago) #Get orders that have not been processed or failed orderbot.

orders.each {|x| OrderBotWorker.perform_async(x.id)} #Manually put them into the sidekiq queue and attempt to process them regularly

#wait a few moments to allow the orders to be processed throug the queue

orders.reload #updated set

STEP 2:

include Spree::OrderBotHelper

order = orders.first #check order number in orderbot if all line items except for returns insurance are through mark orderbot_synced as true and save

create_new_order_by_factory(order) #attempt to run it manually and see what the error is

#if error looks like this NoMethodError: undefined method first' for nil:NilClass from /var/www/fandp_web-production/release/20180412214005/app/helpers/spree/order_bot_helper.rb:179:in get_or_create_tag' from /var/www/fandp_web-production/release/20180412214005/app/helpers/spree/order_bot_helper.rb:89:in block in generate_tags_for_line_item' from /var/www/fandp_web-production/release/20180412214005/app/helpers/spree/order_bot_helper.rb:88:in each' from /var/www/fandp_web-production/release/20180412214005/app/helpers/spree/order_bot_helper.rb:88:in generate_tags_for_line_item' from /var/www/fandp_web-production/release/20180412214005/app/helpers/spree/order_bot_helper.rb:70:in create_new_product_associate_order_guide' from /var/www/fandp_web-production/release/20180412214005/app/helpers/spree/order_bot_helper.rb:47:in block (2 levels) in create_new_order' from /var/www/fandp_web-production/release/20180412214005/app/helpers/spree/order_bot_helper.rb:47:in each' from /var/www/fandp_web-production/release/20180412214005/app/helpers/spree/order_bot_helper.rb:47:in block in create_new_order' from /var/www/fandp_web-production/release/20180412214005/app/helpers/spree/order_bot_helper.rb:46:in each' from /var/www/fandp_web-production/release/20180412214005/app/helpers/spree/order_bot_helper.rb:46:in create_new_order' from /var/www/fandp_web-production/release/20180412214005/app/helpers/spree/order_bot_helper.rb:15:in block in create_new_order_by_factory' from /var/www/fandp_web-production/release/20180412214005/app/helpers/spree/order_bot_helper.rb:15:in each_key' from /var/www/fandp_web-production/release/20180412214005/app/helpers/spree/order_bot_helper.rb:15:in create_new_order_by_factory' from (irb):7 from /var/www/fandp_web-production/shared/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/commands/console.rb:47:in start' from /var/www/fandp_web-production/shared/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/commands/console.rb:8:in start' from /var/www/fandp_web-production/shared/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/commands.rb:41:in <top (required)>' from script/rails:14:in require' from script/rails:14:in `

'

#This issue is most likely caused my a customization presentation being too long or for some reason the get tags call is not returning the correct results

#if it is the latter you can attempt the to create it manually follow the logic in order_bot_helper manually but skip items.each {|item| create_new_product_associate_order_guide(item)}

#if it is the former you need to look through the line items and their customizations changing them. For example

#"[{"customisation_value": {"id": 3322, "name": "change-to-only-one-split-at-front,-no-splits-at-back", "group": null, "price": "10.0", "required_by": null, "presentation": "Change To Only One Split At Front, No Splits At Back"}}]"

#becomes "[{"customisation_value": {"id": 3322, "name": "change-to-only-one-split-at-front,-no-splits-at-back", "group": null, "price": "10.0", "required_by": null, "presentation": "Chnge To Only One Split At Front No Splits At Back"}}]"

#once you see {"response_code":1,"orderbot_order_id":14480,"reference_order_id":"R123063013-452473","success":true,"message":"Order has been updated successfully!"}"

order.orderbot_synced = true order.save orders.reload order = orders.first

OTHER ERRORS

RestClient::InternalServerError: 500 Internal Server Error from /var/www/fandp_web-production/shared/bundle/ruby/2.3.0/gems/rest-client-1.8.0/lib/restclient/abstract_response.rb:74:in return!' from /var/www/fandp_web-production/shared/bundle/ruby/2.3.0/gems/rest-client-1.8.0/lib/restclient/request.rb:495:in process_result' from /var/www/fandp_web-production/shared/bundle/ruby/2.3.0/gems/rest-client-1.8.0/lib/restclient/request.rb:421:in block in transmit' from /usr/lib/ruby/2.3.0/net/http.rb:853:in start' from /var/www/fandp_web-production/shared/bundle/ruby/2.3.0/gems/rest-client-1.8.0/lib/restclient/request.rb:413:in transmit' from /var/www/fandp_web-production/shared/bundle/ruby/2.3.0/gems/rest-client-1.8.0/lib/restclient/request.rb:176:in execute' from /var/www/fandp_web-production/shared/bundle/ruby/2.3.0/gems/rest-client-1.8.0/lib/restclient/request.rb:41:in execute' from /var/www/fandp_web-production/release/20180412214005/lib/order_bot/order_bot_client.rb:158:in make_post_request' from /var/www/fandp_web-production/release/20180412214005/lib/order_bot/order_bot_client.rb:75:in create_new_order_guide' from /var/www/fandp_web-production/release/20180412214005/app/helpers/spree/order_bot_helper.rb:68:in create_new_product_associate_order_guide' from /var/www/fandp_web-production/release/20180412214005/app/helpers/spree/order_bot_helper.rb:47:in block (2 levels) in create_new_order' from /var/www/fandp_web-production/release/20180412214005/app/helpers/spree/order_bot_helper.rb:47:in each' from /var/www/fandp_web-production/release/20180412214005/app/helpers/spree/order_bot_helper.rb:47:in block in create_new_order' from /var/www/fandp_web-production/release/20180412214005/app/helpers/spree/order_bot_helper.rb:46:in each' from /var/www/fandp_web-production/release/20180412214005/app/helpers/spree/order_bot_helper.rb:46:in create_new_order' from (irb):83 from /var/www/fandp_web-production/shared/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/commands/console.rb:47:in start' from /var/www/fandp_web-production/shared/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/commands/console.rb:8:in start' from /var/www/fandp_web-production/shared/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/commands.rb:41:in <top (required)>' from script/rails:14:in require' from script/rails:14:in

'
^^ This usuall means a dress has been renamed in spree but has not been updated in orderbot. Log into orderbot and rename the dress based on the custom sku