While working on some tests, I started getting the following error for all tests.
Psych::SyntaxError: couldn't parse YAML at line 92 column 0
Using this code to run tests:
ruby -Itest ./test/functional/users_controller_test.rb
I couldn't find any YAML errors in the fixtures, so I undid all my changes. According to git, the files are in the same state as when I started. But I keep getting the same error.
How to fix? How to find the file that is causing the problem?
Rails 3.0.7
Ruby 1.9.2p290
Upgrade your Rails to a newer 3.0.x version, and look at this other Stack Overflow question for other hints.
Found it! There was a tab character in two fixtures files.
The strange thing is that the files did not change from before. They used to work fine. I am sure of that because git can tell the difference between a tab and a space. (The files are now modified).
Apparently a gem or some other file got updated with a YAML parser that is more picky...but the strange thing is that I did not update anything.
I guess this is a good reason to run RVM or rbenv (which I am). Too bad it doesn't explain what happened...
Related
Trying to run a project that was provided by a client.
I have the correct versions of Ruby, Gems, Rails, Bundler, Homebrew etc installed.
When I run rails server I get the following error in terminal.
.rvm/gems/ruby-2.2.2/gems/airbrake-ruby-1.0.4/lib/airbrake-ruby.rb:288:in `call_notifier': the 'default' notifier isn't configured (Airbrake::Error)
After much time spent on Google I couldn't find a fix on this.
Here is a screenshot of the whole terminal error message which I get the feeling these other lines could be related.
It looks like a previous developer may have hardcoded a commit hook in the application, pointing to a file in their local .git folder (and which you don't have).
I'd recommend either asking the developer to provide the missing file, create a dummy file in the same place, or removing that line.
Up until now I've been using script/runner to forward bouncebacks to eblast-bounceback#mydomain.com and eblast-bounceback#dev.mydomain.com. However it is no longer working in Rails 4.0. I also can't seem to find a good resource online to illustrate how to do it. I usually get directed to the 'whenever' gem - but that's for cron jobs, not for 'piping to programs'.
So this is essentially what I'm currently doing, but is failing:
|/home/user/rails/dev.www/script/rails runner 'EBlast.receive(STDIN.read)' -e development
How do I get this to work? I'm not on Rails 4.1, I'm on 4.0. FWIW I do not have bin/rails. The above command yields "no such file or directory".
There were actually a few things I needed to do.
The email eblast-bounce#dev.mydomain.com was considered 'unroutable'. At first I figured it was because there wasn't any MX records for the subdomain, so I added one. But then I still got the error. I had manually updated the aliases file in /etc/valiases to pipe to the program using a symlinked directory (because I was deploying with Capistrano, and the directory ends up changing after every deploy). Turns out symlinks don't work for some reason when it comes to exim routing (/home/me/rails_deployments/dev.www/current/bin/rails fails). Maybe I'm wrong about the symlinks thing but the problem went away when I used the solution below.
This problem however was solved when I eventually came to another problem (/usr/bin/env: ruby: No such file or directory). I'm using RVM to manage rubies/gems, and apparently the email forwarder didn't know what ruby was. This leads to the final solution:
(when in cPanel, "pipe to program" assumes the user home directory (/home/me/))
.rvm/wrappers/ruby-2.1.0#website/ruby /home/me/rails_deployments/dev.www/current/bin/rails runner 'EBlast.receive(STDIN.read)' -e development
Where ruby-2.1.0 is my current ruby version, and #website is the gemset used by the EBlast.receive code base.
EDIT: Spoke too soon, the command has its own set of problems...(gemfile not present). This is ludicrous.
I am getting the following error for the all rspec tests, which have been working fine before... Really strange thing is that I didn't change anything with regard to mongod or rspec or mongoid... :( I can access mongo shell just fine, too.
Any help or suggestion for debugging this would be much appreciated!
Ruby: 1.9.3p194
Rails: 3.2.12
Mongod: 2.2
Mongoid: 3.1.4
Failure/Error: Unable to find matching line from backtrace
Moped::Errors::ConnectionFailure:
Could not connect to a primary node for replica set <Moped::Cluster nodes=[<Moped::Node resolved_address=nil>]>
Link to mongoid.yml: https://gist.github.com/yangtheman/5879742
This is too embarrassing, but I found the source of the error. I somehow commented out localhost line in hosts file. When I uncommented it, everything went back to normal.
I'm trying to deploy a Rails 3.2 app to Heroku.
When I migrate the database, the rake is aborted.
Checking the logs I see
/usr/local/lib/ruby/1.9.1/syck.rb:135:in `load': syntax error on line 7, col 11: `' (ArgumentError)
I've tried to track down what's causing this, including disabling all non essential gems, reviewing the app for obvious syntax errors, etc. But no luck.
As this error seems to be generated by a Heroku system file, I'm not sure what to try next.
Has anyone else encountered this? Are there any good references that would help me get to the bottom of this?
Sounds like a syntax error on line 7 of a yml file somewhere.
I assume everything is ok locally, so either that yml file has contents based on environment variables which differ between development and production (and the values in production result in incorrect yaml) or the difference comes from using psych (the new yaml parser) locally but syck on heroku. You can check which parser is being used with YAML::ENGINE.
I'm getting the following error when I boot my rails 3.1.3 application:
psych.rb:148:in `parse': couldn't parse YAML at line 28 column 9 (Psych::SyntaxError)
I'm guessing it is related to YML file syntax.
The problem appears when I try running:
YAML.load_file "..."
From another rails 3.1.3 application and YMLs are loaded just fine.
The syntax is covered here: http://en.wikipedia.org/wiki/YAML#Syntax
An online parser, which may help you troubleshoot, is here: http://yaml-online-parser.appspot.com/
Found a solution. If you can't find a YML syntax error in your application locale files the problem might be in some of the locale files of a gem you might be using.
I introduced a breakpoint at base.rb:15 (of rails 3.1.3) and there you can see a list of all locale yml files that will be loaded under variable filenames.
Inspecting each one I finally found a file with a