Hello there! Been loving getting stuck in & creating bits & bobs with this wonderful little framework. Had a go at making a listing of a bunch of opening events which occur in my current city of residence - Tokyo. Unfortunately, although the app seemed to be fine running locally (in production), once pushed to Heroku I began to see intermittent occurrences of: !! Unexpected error while processing request: undefined method `to_sym'' for nil:NilClass just as the app reached rendering the (haml) view. The problem is, there is no stack trace which is spit out at this point - and any puts I have added to the view to check things are ok, are never reached. I have a hunch that this may be to do with haml / tilt not starting up in time but was wondering if there''s a way to make production camping apps more "verbose", or if this is needed at all. Thank you all. -- ----=^.^=---
What version of ruby is Heroku running? Dave On Thu, Jan 20, 2011 at 12:14 AM, adam moore <nerdfunk at gmail.com> wrote:> Hello there! > > Been loving getting stuck in & creating bits & bobs with this > wonderful little framework. Had a go at making a listing of a bunch of > opening events which occur in my current city of residence - Tokyo. > Unfortunately, although the app seemed to be fine running locally (in > production), once pushed to Heroku I began to see intermittent > occurrences of: > > !! Unexpected error while processing request: undefined method > `to_sym'' for nil:NilClass > > just as the app reached rendering the (haml) view. > > The problem is, there is no stack trace which is spit out at this > point - and any puts I have added to the view to check things are ok, > are never reached. I have a hunch that this may be to do with haml / > tilt not starting up in time but was wondering if there''s a way to > make production camping apps more "verbose", or if this is needed at > all. > > Thank you all. > > > -- > ----=^.^=--- > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-- Dave
Hm? Like Dave mentioned, could you give us the versions you''re using? For both Camping, Rack, Tilt, Haml and Ruby? Also, you could add this little snippet to "force" a backtrace: class NilClass def to_sym puts "NilClass#to_sym:" caller.each do |line| puts " #{line}" end raise end end Maybe that gives you any clues! // Magnus Holm On Thu, Jan 20, 2011 at 06:14, adam moore <nerdfunk at gmail.com> wrote:> Hello there! > > Been loving getting stuck in & creating bits & bobs with this > wonderful little framework. Had a go at making a listing of a bunch of > opening events which occur in my current city of residence - Tokyo. > Unfortunately, although the app seemed to be fine running locally (in > production), once pushed to Heroku I began to see intermittent > occurrences of: > > !! Unexpected error while processing request: undefined method > `to_sym'' for nil:NilClass > > just as the app reached rendering the (haml) view. > > The problem is, there is no stack trace which is spit out at this > point - and any puts I have added to the view to check things are ok, > are never reached. I have a hunch that this may be to do with haml / > tilt not starting up in time but was wondering if there''s a way to > make production camping apps more "verbose", or if this is needed at > all. > > Thank you all. > > > -- > ----=^.^=--- > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >
My gem file reads thus: gem "activerecord", "3.0.3" gem "camping", "2.1" gem "nokogiri", "1.4.4" gem "rest-open-uri", "1.0.0" gem "sqlite3-ruby", "1.3.2" gem "tilt", "1.2.1" gem "haml", "3.0.25" Will get the ruby version asap. Love the idea of adding the method! Great! On Friday, January 21, 2011, Magnus Holm <judofyr at gmail.com> wrote:> Hm? > > Like Dave mentioned, could you give us the versions you''re using? For > both Camping, Rack, Tilt, Haml and Ruby? Also, you could add this > little snippet to "force" a backtrace: > > ?class NilClass > ? ?def to_sym > ? ? ?puts "NilClass#to_sym:" > ? ? ?caller.each do |line| > ? ? ? ?puts " ?#{line}" > ? ? ?end > ? ? ?raise > ? ?end > ?end > > Maybe that gives you any clues! > > // Magnus Holm > > > > On Thu, Jan 20, 2011 at 06:14, adam moore <nerdfunk at gmail.com> wrote: >> Hello there! >> >> Been loving getting stuck in & creating bits & bobs with this >> wonderful little framework. Had a go at making a listing of a bunch of >> opening events which occur in my current city of residence - Tokyo. >> Unfortunately, although the app seemed to be fine running locally (in >> production), once pushed to Heroku I began to see intermittent >> occurrences of: >> >> !! Unexpected error while processing request: undefined method >> `to_sym'' for nil:NilClass >> >> just as the app reached rendering the (haml) view. >> >> The problem is, there is no stack trace which is spit out at this >> point - and any puts I have added to the view to check things are ok, >> are never reached. I have a hunch that this may be to do with haml / >> tilt not starting up in time but was wondering if there''s a way to >> make production camping apps more "verbose", or if this is needed at >> all. >> >> Thank you all. >> >> >> -- >> ----=^.^=--- >> _______________________________________________ >> Camping-list mailing list >> Camping-list at rubyforge.org >> http://rubyforge.org/mailman/listinfo/camping-list >> > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list-- ----=^.^=---
Wow, thanks Magnus. Adding that certainly made the output more interesting: http://pastebin.com/DSMKWK52 As you can see, the ruby version seems to be 1.8. It can be bumped up to 1.9 I believe if this is preferred? drinking.rb line 127 is simply: render :index The plot thickens... Adam
On Friday, January 21, 2011, adam moore <nerdfunk at gmail.com> wrote:> Wow, thanks Magnus. Adding that certainly made the output more interesting: > > http://pastebin.com/DSMKWK52 > > As you can see, the ruby version seems to be 1.8. > It can be bumped up to 1.9 I believe if this is preferred? > > drinking.rb line 127 is simply: > > ? ? ? ?render :index > > The plot thickens... >But soon the mystery will unfold itself! Could you list all the filenames in your views-directory? It seems that Camping fails to extract the extension of the index template. I''m just puzzled why it works locally but not on Heroku. Also, try to evaluate this on Heroku''s console: filename[/\.(\w+)$/,1] (where filename is the filename of the index template). -- // Magnus Holm
On Friday, January 21, 2011, adam moore <nerdfunk at gmail.com> wrote:> Wow, thanks Magnus. Adding that certainly made the output more interesting: > > http://pastebin.com/DSMKWK52 > > As you can see, the ruby version seems to be 1.8. > It can be bumped up to 1.9 I believe if this is preferred? > > drinking.rb line 127 is simply: > > ?? ? ? ?render :index > > The plot thickens... >But soon the mystery will unfold itself! Could you list all the filenames in your views-directory? It seems that Camping fails to extract the extension of the index template. I''m just puzzled why it works locally but not on Heroku. Also, try to evaluate this on Heroku''s console: filename[/\.(\w+)$/,1] where filename is the filename of the index template. -- // Magnus Holm
With burning ears I link to you the git repository : http://github.com/minikomi/tokyoartparties Be gentle haha
> Also, try to evaluate this on Heroku''s console: filename[/\.(\w+)$/,1] > (where filename is the filename of the index template). > > -- > // Magnus Holm > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-listRuby console for tokyoartparties.heroku.com>> "index.haml"[/\.(\w+)$/,1]=> "haml" Hope this is correct...
We''re getting closer! Try this from both locally and on Heroku: Dir["src/views/index.*"].first My prediction: it returns index.haml locally and index.haml~ on Heroku. Therefore Camping fails to extract the extension on Heroku. Solution: delete all ~-files (and add *~ to gitignore). I''ll also make the extraction code a little leas fragile to files which have weird extensions. On Friday, January 21, 2011, adam moore <nerdfunk at gmail.com> wrote:> With burning ears I link to you the git repository : > > http://github.com/minikomi/tokyoartparties > > Be gentle haha > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-- // Magnus Holm
=> "src/views/index.haml" But I will strip out the ~ files and let you know if things improve! The heroku support staff have also been taking a look:> Hi,> I was able to see this on heroku intermittently. On a few restarts, I got it, but in other occasions it worked fine right away. I was unable to reproduce this locally.
Wow! That seems to have done it! Great. Will let their team know as well. Thank you very much,
Also, you can change Ruby version on Heroku by choosing a different stack. You can see a list of avail. stacks using "heroku stack" in command line (locally). You can change the stack by using "heroku stack:migrate <chosen stack>" and git pushing. (Personally, I have had problems with that; solution is to "heroku destroy" an app and recreate it specifying the stack: "heroku create <appname> --stack <stack>".) Bamboo and Aspen stacks differ in preinstalled gems (Bamboo has none, Aspen lots). Different Bamboo differ only by specific Ruby version. -- Matma Rex