getting "invalid multibyte escape: /^\xFF\xFE/ (SyntaxError)" error on Heroku - ruby-on-rails

I'm using the VPIM gem for rails to create vcards for users based on their profile information.
It all works fine on my local host, but when I deploy to Heroku, the app crashes.
I'm getting the error below in the heroku logs, which I assume is what is causing the app to crash...
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require': /app/vendor/bundle/ruby/2.0.0/gems/vpim-0.695/lib/vpim/vcard.rb:678: invalid multibyte escape: /^\xFE\xFF/ (SyntaxError)
2013-10-27T15:52:14.211497+00:00 app[web.1]: invalid multibyte escape: /^\xFF\xFE/
Any idea on how to fix this issue?
Here's the gem I'm using and some possible solutions that I haven't been able to get working yet. It might be because of my level of understanding of ruby-on-rails.
Gem: github(dot)com/fraser/vpim-rails
Possible solutions:
https://github.com/sam-github/vpim/issues/5
https://github.com/GetJobber/vpim-rails/commit/0c92b5d7f9b2f6a59bdeea3127dbb668072371cc
Any help will be much appreciated.
-Ethan

There is a quick fix for it. Open the following file
"/app/vendor/bundle/ruby/2.0.0/gems/vpim-0.695/lib/vpim/vcard.rb"
in text editor, and add the following line at the beginning of file.
"# encoding: ISO-8859-1"
This solved it for me.

Related

Rails App Suddenly Not Working

I was just working on one of my models when my Rails app would not work anymore. Even typing out commands like rails -v, rails, c, bundle install, or any command is giving out the same error. What's causing it is a syntax error on the file fileutils.rb. I'm using the ruby version ruby-1.9.3-p551.
First set of error messages.
(I have not included the middle part of the error messages.)
Last set of error messages.
I do not understand as to what caused the file fileutils.rb to be modified or be syntax errored.
I have modified the fileutils.rb by copy-pasting lines 309-421 from another fileutils.rb file.
I got it working again but I am still confused as to what corrupted my file.

Rails Server and Console crashing because of unexpected break (LocalJumpError)

I'm getting this weird behaviour when running rails server or rails console.
The server/console crashes in various locations in the code throwing this exception:
script/rails:6:in `require': unexpected break (LocalJumpError)
from script/rails:6:in `<main>'
I must note that this behaviour happens to only one more person in my team, all other members of my team does not experience this behaviour and also production server is working just fine with no crashes like this.
Also, we found putting debugger somewhere in the code and just pressing continue solves this problem. But this is hardly a logic way to deal with this bug.
Does anyone experienced similar behaviour and knows how to solve this?
I have not enough information to provide a 100% sure solution, but here is my guess :
Try to use bundle exec rails <command> rather than script/rails <command>. Rails script doesn't have changed for some time, but it may just be you're not loading the correct gem dependencies.
It would be interesting to know if the other person of your team getting the problem is using script/rails too. If all other people having no problem use the rather idiomatic bundle exec rails, you have a good clue for a dependency version problem.

Heroku App Crashed No Errors In Log

Hi I am trying to deploy a small app on heroku
I managed to create the app, push the contents to the app, scaled it by one dyno but when I try to do heroku open, the app crashed and gave me error code 10
Here is the log file in paste bin
http://pastebin.com/Rh4iXn3Y
I found this error, uninitialized constant SimpleForm (NameError)
I uninstalled the simpleform gem but I figured it left behind some files that the gem didn't remove, I removed the file myself.
It should not throw me this error.
I am new to heroku, I know I need to dig through the doc to see how it works, but in the mean time can some one help me out?
thanks!
if you need more information please let me know.
From your log file:
2013-05-16T00:02:10.346211+00:00 app[web.1]: /app/config/initializers/simple_form.rb:2:in `<top (required)>': uninitialized constant SimpleForm (NameError)
Remove /app/config/initializers/simple_form.rb
Don't afraid of reading logs line by line. Near all answers are already there.

Failed to send invitation email with devise_invitable

I deployed my app to heroku recently. When i try to send out an invite to anyone i get the following error.
ActionView::Template:Error (invalid type sequence in UTF-8)
In my template I added <%# encoding: utf-8 %>.
I am stuck at the moment since it was working well in development enviroment
Did you try running magic_encoding from the command line? You might have missed a Controller that needs the #encoding utf-8. Can you show us some code? Are you using any characters (Japanese, etc.) in your Controller?

Heroku console doesn't handle ActiveSupport::SecureRandom.hex

Simple question - I'm trying to assign random values to some of my app's fields on Heroku by writing:
Project.all.each do |p|; p.key ||= ActiveSupport::SecureRandom.hex; p.save; end
This is producing the internal server error due to the hex.
Do you know why this is happening and how I can fix it?
Edit: It turns out the failure was due to an hour-long Heroku outage that killed tools as well as slowing down apps. hex still works on Heroku console.
Can you try just running the line ActiveSupport::SecureRandom.hex on Heroku's console?
I just did that and it worked, so the error might be elsewhere.
It turns out the failure was due to an hour-long Heroku outage that killed tools as well as slowing down apps. hex still works on Heroku console.
Thanks leonardoborges and Skydreamer for your help!
You should use heroku logs in your project to see exactly what's wrong and fix it.

Resources