How to Debug Rails "ArgumentError (dump format error for symbol(0xc3))"

38 Views Asked by At

I'm attempting to run a Rails Job that makes an API call to Zoho's CRM via the ZCRMSDK gem. Previously (hundreds of commits ago) it had been working. tl;dr it was working and now it's not.

The error I get when I attempt to run the job in the rails console is "ArgumentError (dump format error for symbol(0xc3))", which isn't terribly helpful.

I've attempted to clear the tmp folder and I've also straight up deleted it per this recommendation and no joy. My only recourse is to maybe update to a newer Zoho gem, but I'd prefer to unbork this error.

The job code is:

Module Zoho
class ContractorApi

attr_reader :module_api_name, :record, :company_profile

def initialize(id)
  @module_api_name = ENV['CONSUMER_MODULE']
  @record = User.find(id)
  @company_profile = @record.company_profile
end

def create
  records = []
  rec1 = ZCRMSDK::Operations::ZCRMRecord.get_instance(module_api_name, nil)
  rec1.field_data = Array(payload)
  records.push(rec1)
  res = ZCRMSDK::Operations::ZCRMModule
          .get_instance(module_api_name)
          .create_records(records)
          .bulk_entity_response
  res.each do |response|
    Rails.logger.info response.code
    Rails.logger.info response.message
    Rails.logger.info response.details
  end
rescue ZCRMSDK::Utility::ZCRMException => e
  Rails.logger.info "Contractor module INSERT failed for #{record.id}"
  Rails.logger.info e.status_code
  Rails.logger.info e.error_message
  Rails.logger.info e.exception_code
  Rails.logger.info e.error_details
  Rails.logger.info e.error_content
end

private

def payload
  {
    "user_id": record.id,
    "Email": record.email,
    "sign_in_count": record.sign_in_count,
    "current_sign_in_at": record.current_sign_in_at.to_formatted_s(:iso8601),
    "last_sign_in_at": record.last_sign_in_at.to_formatted_s(:iso8601),
    'created_at': record.created_at.to_formatted_s(:iso8601),
    'updated_at': record.updated_at.to_formatted_s(:iso8601),
    "First_Name": record.first_name,
    "Last_Name": record.last_name || "No Last Name",
    "username": record.username,
    "Company_Name": record.company_name,
    "hasProfile": false,   
    "isContractor": true, 
  }
    end
end
end

The error logs:

 app/worker.1 [ActiveJob] [Zoho::ProfileApiJob] [038c983c-0581-4a3a-ab5c-d464993cb31d] Error performing Zoho::ProfileApiJob (Job ID: 038c983c-0581-4a3a-ab5c-d464993cb31d) from Sidekiq(default) in 3.77ms: ArgumentError (dump format error for symbol(0xc3)):
Aug 22 11:59:35 app/worker.1 /app/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.8.1/lib/active_support/core_ext/marshal.rb:6:in `load'
Aug 22 11:59:35 app/worker.1 /app/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.8.1/lib/active_support/core_ext/marshal.rb:6:in `load'

Any recommendations on where to look or should I just upgrade to a newer Zoho SDK gem?

0

There are 0 best solutions below