hacker_0101
hacker_0101

Reputation: 11

Deploying Ruby on Rails app to Heroku: Links not working, Images not appearing

I have just deployed my app on Heroku to find that none of my images are showing up and the links are not working even though my app works well locally. Please click on this link to take a look:
https://obscure-depths-71348.herokuapp.com/

You can see that each time the "Sign Up", Log In", or "Live" button is pressed, you see, "We're sorry, but something went wrong."

What is even more agonizing is that when I type in the command prompt "heroku logs", I get an eternally long list of fatal errors:

2016-12-05T06:30:46.235005+00:00 app[web.1]: F,    [2016-12-05T06:30:46.234958 #4] FATAL -- :   

[017e9049-b5c9-4f4c-8b0d-7380e3136888]
vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/tagged_logging.rb:70:in tagged' 2016-12-05T06:30:46.235054+00:00 app[web.1]: F,
[2016-12-05T06:30:46.235006 #4] FATAL -- :
[017e9049-b5c9-4f4c-8b0d-7380e3136888]
vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:24:in
call' 2016-12-05T06:30:46.235418+00:00 heroku[router]: at=info method=GET path="/assets/contactcover.jpg"
host=obscure-depths-71348.herokuapp.com
request_id=017e9049-b5c9-4f4c-8b0d-7380e3136888 fwd="153.104.25.21"
dyno=web.1 connect=1ms service=13ms status=404 bytes=1744 2016-12-05T06:30:46.235110+00:00 app[web.1]: F, [2016-12-05T06:30:46.235059 #4] FATAL -- :
[017e9049-b5c9-4f4c-8b0d-7380e3136888]
vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/request_id.rb:24:in call' 2016-12-05T06:30:46.235160+00:00 app[web.1]: F, [2016-12-05T06:30:46.235112 #4] FATAL -- :
[017e9049-b5c9-4f4c-8b0d-7380e3136888]
vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/method_override.rb:22:in
call' 2016-12-05T06:30:46.235276+00:00 app[web.1]: F, [2016-12-05T06:30:46.235209 #4] FATAL -- :
[017e9049-b5c9-4f4c-8b0d-7380e3136888]
vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in call' 2016-12-05T06:30:46.235207+00:00 app[web.1]: F, [2016-12-05T06:30:46.235161 #4] FATAL -- :
[017e9049-b5c9-4f4c-8b0d-7380e3136888]
vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/runtime.rb:22:in
call' 2016-12-05T06:30:46.235333+00:00 app[web.1]: F, [2016-12-05T06:30:46.235277 #4] FATAL -- :
[017e9049-b5c9-4f4c-8b0d-7380e3136888]
vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/executor.rb:12:in call' [even more fatal errors] 2016-12-05T06:30:46.219048+00:00 heroku[router]: at=info method=GET path="/assets/intro-bg.jpg"
host=obscure-depths-71348.herokuapp.com
request_id=186c98cc-a9dc-4348-9f24-8bdcde8b6380 fwd="153.104.25.21"
dyno=web.1 connect=0ms service=6ms status=404 bytes=1744 2016-12-05T06:30:46.338582+00:00 heroku[router]: at=info method=GET path="/fonts/fontawesome-webfont.ttf?v=4.2.0"
host=obscure-depths-71348.herokuapp.com
request_id=ab268eea-397b-486d-b481-bb9baed05b19 fwd="153.104.25.21"
dyno=web.1 connect=0ms service=22ms status=404 bytes=1744 [...] 2016-12-05T06:30:46.414182+00:00 app[web.1]: F, [2016-12-05T06:30:46.414118 #4] FATAL -- :
[1362654e-c7e4-45ff-bef6-a4150f2ac88c]
vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/method_override.rb:22:in
call'
2016-12-05T06:30:46.414232+00:00 app[web.1]: F,
[2016-12-05T06:30:46.414184 #4] FATAL -- :
[1362654e-c7e4-45ff-bef6-a4150f2ac88c]
vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/runtime.rb:22:in
call'
2016-12-05T06:30:46.414289+00:00 app[web.1]: F,
[2016-12-05T06:30:46.414236 #4] FATAL -- :
[1362654e-c7e4-45ff-bef6-a4150f2ac88c]
vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in
call' 2016-12-05T06:30:46.414344+00:00 app[web.1]: F, [2016-12-05T06:30:46.414290 #4] FATAL -- :
[1362654e-c7e4-45ff-bef6-a4150f2ac88c]
vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/executor.rb:12:in call'
2016-12-05T06:30:46.414409+00:00 app[web.1]: F,
[2016-12-05T06:30:46.414346 #4] FATAL -- :
[1362654e-c7e4-45ff-bef6-a4150f2ac88c]
vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/static.rb:136:in
call'
2016-12-05T06:30:46.414467+00:00 app[web.1]: F,
[2016-12-05T06:30:46.414403 #4] FATAL -- :
[1362654e-c7e4-45ff-bef6-a4150f2ac88c]
vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/sendfile.rb:111:in
call'
2016-12-05T06:30:46.414526+00:00 app[web.1]: F,
[2016-12-05T06:30:46.414471 #4] FATAL -- :
[1362654e-c7e4-45ff-bef6-a4150f2ac88c]
vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/engine.rb:522:in
call'
2016-12-05T06:30:46.414588+00:00 app[web.1]: F,
[2016-12-05T06:30:46.414529 #4] FATAL -- :
[1362654e-c7e4-45ff-bef6-a4150f2ac88c]
vendor/bundle/ruby/2.2.0/gems/puma-3.6.2/lib/puma/configuration.rb:225:in call'
2016-12-05T06:30:46.414653+00:00 app[web.1]: F,
[2016-12-05T06:30:46.414599 #4] FATAL -- :
[1362654e-c7e4-45ff-bef6-a4150f2ac88c]
vendor/bundle/ruby/2.2.0/gems/puma-3.6.2/lib/puma/server.rb:578:in
handle_request'
2016-12-05T06:30:46.414720+00:00 app[web.1]: F,
[2016-12-05T06:30:46.414655 #4] FATAL -- :
[1362654e-c7e4-45ff-bef6-a4150f2ac88c]
vendor/bundle/ruby/2.2.0/gems/puma-3.6.2/lib/puma/server.rb:415:in
process_client'
2016-12-05T06:30:46.414794+00:00 app[web.1]: F,
[2016-12-05T06:30:46.414727 #4] FATAL -- :
[1362654e-c7e4-45ff-bef6-a4150f2ac88c]
vendor/bundle/ruby/2.2.0/gems/puma-3.6.2/lib/puma/server.rb:275:in
block in run' [...] 2016-12-05T06:30:46.211389+00:00 heroku[router]: at=info method=GET path="/welcome/js/jquery.js"
host=obscure-depths-71348.herokuapp.com
request_id=46da25e7-77dd-4270-984d-30350b1517df fwd="153.104.25.21"
dyno=web.1 connect=0ms service=31ms status=404 bytes=1744

Here's a snippet of the root html. Also, my anchor links are not working if someone may kindly explain that to me as well:

home.html.erb:

<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>United Cycling</title>

    <!-- Bootstrap Core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="css/landing-page.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body>

    <!-- Navigation -->
    <nav class="navbar navbar-default navbar-fixed-top topnav" role="navigation">
        <div class="container topnav">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand topnav" href="#">United Cycling</a>
            </div>
            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav navbar-right">
                    <li>
                        <%= link_to("About", {}, :name => "about") %> 
                    </li>
                    <li>
                        <%= link_to("Schedule", {}, :name => "schedule") %> 
                    </li>
                    <li>
                        <%= link_to("Contact", {}, :name => "contact") %> 
                    </li>
                    <li> 
                        <a href="/members/live">Live </a> 
                    </li>
                    <% if user_signed_in? %> 
                    <li>
                        <%= link_to "Log Out", destroy_user_session_path, method: :delete %>
                    </li>
                    <% end %> 
                </ul>
            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container -->
    </nav>


    <!-- Header -->
    <a name="about"></a>
    <div class="intro-header">
        <div class="container">

            <div class="row">
                <div class="col-lg-12">
                    <div class="intro-message">
                        <h1>United Cycling</h1>
                        <h3>Est 2012</h3>
                        <hr class="intro-divider">
                        <ul class="list-inline intro-social-buttons">
                            <li>
                                <% if !user_signed_in? %> 
                                <a href="/users/sign_up" class="btn btn-default btn-lg"><span class="network-name">Sign Up</span></a>
                            </li>
                            <li>
                                <a href="/users/sign_in" class="btn btn-default btn-lg"><span class="network-name">Log In</span></a>
                            </li>
                            <% end %> 
                        </ul>
                    </div>
                </div>
            </div>

        </div>
...

And here's my Gemfile, where I might suspect trouble:

    source 'https://rubygems.org'

ruby '2.2.4'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
group :development, :test do
  gem 'sqlite3'
end

group :production do
  gem 'pg'
end

# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
gem 'devise', '~> 4.2'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development



group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platform: :mri
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console'

end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Thank you in advance!

Upvotes: 1

Views: 804

Answers (1)

Deepak Mahakale
Deepak Mahakale

Reputation: 23661

Try if you have done the following:

  • Run the migrations

    heroku run rake db:migrate
    
  • Restart the dynos

    heroku restart -a app_name
    

    or

    Heroku Dashboard > Your App > More > Restart all dynos

Upvotes: 0

Related Questions