Search code examples
rubyherokuruby-on-rails-3.2yamldelayed-job

Delayed_job crashing Heroku worker (YAML issue?)


I'm running into a strange issue that is causing my Heroku workers to crash. We're using Ruby on Rails and delayed_job for background jobs. I'm passing a job to delayed_job using the Vero gem.

This is the call I make to "identify" the user to Vero:

after_save { self.identify! }

Then it puts a job in the queue that looks like this:

--- !ruby/object:Vero::Api::Workers::Users::TrackAPI
domain: https://api.getvero.com
options:
  :email: ******@gmail.com
  :data:
    :email: ******@gmail.com
    :name: ? ?
    :first_name: ?
    :last_name: ?
    :school_id: -1

The issue seems to be those question marks. I'm not sure why they are showing up there instead of a string of text. This is the error that comes up:

Psych::SyntaxError: (<unknown>): mapping keys are not allowed in this context at line 7 column 14

Unfortunately, instead of the job just failing.. it actually crashes the worker.. not allowing for another jobs to be processed.

Has anyone run into this issue in the past? How can I format the YAML in a way that it won't crash the worker?

Thanks!


Solution

  • Check out this user. Seems that he entered some data not accept by the encoding of the fields in the db. Are you using utf-8? If he entered utf-16 you can translitirate it in ruby to utf-8