adam moore | 20 Jan 2011 06:14
Picon

Strange error with no stack trace

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.

--

-- 
----=^.^=---
David Susco | 20 Jan 2011 16:32
Picon

Re: Strange error with no stack trace

What version of ruby is Heroku running?

Dave

On Thu, Jan 20, 2011 at 12:14 AM, adam moore <nerdfunk@...> 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.
>
>
> --
(Continue reading)

Magnus Holm | 20 Jan 2011 18:13
Picon
Gravatar

Re: Strange error with no stack trace

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:
>
(Continue reading)

adam moore | 21 Jan 2011 00:31
Picon

Re: Strange error with no stack trace

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@...> 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
(Continue reading)

adam moore | 21 Jan 2011 07:46
Picon

Re: Strange error with no stack trace

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
Magnus Holm | 21 Jan 2011 09:23
Picon
Gravatar

Re: Strange error with no stack trace

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
_______________________________________________
Camping-list mailing list
Camping-list <at> rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list
(Continue reading)

adam moore | 21 Jan 2011 09:31
Picon

Re: Strange error with no stack trace

With burning ears I link to you the git repository :

http://github.com/minikomi/tokyoartparties

Be gentle haha
adam moore | 21 Jan 2011 09:35
Picon

Re: Strange error with no stack trace

> 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@...
> http://rubyforge.org/mailman/listinfo/camping-list

Ruby console for tokyoartparties.heroku.com
>> "index.haml"[/\.(\w+)$/,1]
=> "haml"

Hope this is correct...
Magnus Holm | 21 Jan 2011 09:28
Picon
Gravatar

Strange error with no stack trace

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
_______________________________________________
Camping-list mailing list
Camping-list <at> rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list
(Continue reading)

Magnus Holm | 21 Jan 2011 10:27
Picon
Gravatar

Strange error with no stack trace

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@...> 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@...
> http://rubyforge.org/mailman/listinfo/camping-list
>

--

-- 
// Magnus Holm

Gmane