Hardress
Hardress

Reputation: 47

App won't load on heroku, can't decipher heroku logs to tell what the error is

[Update: I have a syntax error in my comment_update_job.rb file and I am troubleshooting that now] I am taking an online Rails course and my app has suddenly stopped working. Could someone please help point me in the right direction for deciphering the heroku logs?

Here is my comment_update.job.rb file

class CommentUpdateJob < ApplicationJob
  queue_as :default

  def perform(comment, current_user)
    ProductChannel.broadcast_to(comment.product_id, comment: render_comment(comment, current_user), average_rating: comment.product.average_rating)
  end

private

  def render_comment(comment, current_user)
    CommentsController.render(partial: 'comments/comment', locals: { comment: comment, current_user: current_user })
  end

end

Here is my heroku log:

2018-12-06T16:09:16.954955+00:00 app[web.1]: => Booting Puma
2018-12-06T16:09:16.954980+00:00 app[web.1]: => Rails 5.2.1 application starting in production
2018-12-06T16:09:16.954982+00:00 app[web.1]: => Run `rails server -h` for more startup options
2018-12-06T16:09:16.957071+00:00 app[web.1]: /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require': /app/app/jobs/comment_update_job.rb:12: syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError)
2018-12-06T16:09:16.957089+00:00 app[web.1]: end

Upvotes: 0

Views: 39

Answers (2)

jvillian
jvillian

Reputation: 20263

Before you edited your question, you showed:

class CommentUpdateJob < ApplicationJob
  queue_as :default

  def perform(comment, current_user)
    ProductChannel.broadcast_to(comment.product_id, comment: render_comment(comment, current_user), average_rating: comment.product.average_rating)
  end

  private

  def render_comment(comment, current_user)
    CommentsController.render(partial: 'comments/comment', locals: { comment: comment, current_user: current_user })
  end

This is missing an end. It should be:

class CommentUpdateJob < ApplicationJob
  queue_as :default

  def perform(comment, current_user)
    ProductChannel.broadcast_to(comment.product_id, comment: render_comment(comment, current_user), average_rating: comment.product.average_rating)
  end

  private

  def render_comment(comment, current_user)
    CommentsController.render(partial: 'comments/comment', locals: { comment: comment, current_user: current_user })
  end

end

BTW, in my config/environments/development.rb, I like to set:

config.eager_load = true

This will cost you time on start up. But, it creates a closer match between your production and development environments and will typically cause errors to be thrown in development that would otherwise not be thrown until you're deploying to Heroku. IMO, the additional start up time in development is more than made up by saving the time of failed deployments on Heroku.

Upvotes: 2

backciro
backciro

Reputation: 11

Never seen this error, but I think it might be or a routing problem, or a redis database missing plug-in.

I suggest you to use PostgreSQL with heroku platform it very-well integrated and there is a free Hobbistic version that allow you to test and fully use your app for staging.

Look for ENV_VARIABLES in your heroku dashboard (like dev/production mode and other).

Hope that this thing could help you :)

Upvotes: 0

Related Questions