使用Rails在Heroku上部署应用程序(错误500)

时间:2019-05-22 14:23:06

标签: javascript ruby-on-rails heroku

我正在尝试在Heroku上部署我的应用程序,但显示以下错误

  

“很抱歉,出了点问题。”

所以我检查了我的heroku日志,这是我遇到的2个问题

2019-05-22T13:56:04.512197+00:00 heroku[router]: at=info method=GET path="/" host=concierge-at-sea.herokuapp.com request_id=4f5fe5ef-ab45-4012-97be-87de88b8fdb5 fwd="89.95.71.184" dyno=web.1 connect=0ms service=1496ms status=500 bytes=1827 protocol=https
2019-05-22T13:55:35.566494+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2019-05-22T13:55:35.686117+00:00 heroku[web.1]: Process exited with status 143

这是一个专门设计的应用程序,我已经尝试过heroku restart以重启我的测功机

但是我不理解错误500,在本地一切正常

这是我的heroku日志

2019-05-22T13:53:09.716085+00:00 app[web.1]: ],
2019-05-22T13:53:09.716086+00:00 app[web.1]: "js.map": [
2019-05-22T13:53:09.716087+00:00 app[web.1]: "/packs/js/application-b9d827093751ba55443e.js.map"
2019-05-22T13:53:09.716089+00:00 app[web.1]: ]
2019-05-22T13:53:09.716090+00:00 app[web.1]: },
2019-05-22T13:53:09.716091+00:00 app[web.1]: "map": {
2019-05-22T13:53:09.716093+00:00 app[web.1]: "css": [
2019-05-22T13:53:09.716094+00:00 app[web.1]: "/packs/css/map-1c42ce8f.css"
2019-05-22T13:53:09.716096+00:00 app[web.1]: ],
2019-05-22T13:53:09.716097+00:00 app[web.1]: "js": [
2019-05-22T13:53:09.716098+00:00 app[web.1]: "/packs/js/map-c76722abf103111664a2.js"
2019-05-22T13:53:09.716100+00:00 app[web.1]: ],
2019-05-22T13:53:09.716101+00:00 app[web.1]: "js.map": [
2019-05-22T13:53:09.716102+00:00 app[web.1]: "/packs/js/map-c76722abf103111664a2.js.map"
2019-05-22T13:53:09.716104+00:00 app[web.1]: ]
2019-05-22T13:53:09.716105+00:00 app[web.1]: }
2019-05-22T13:53:09.716106+00:00 app[web.1]: },
2019-05-22T13:53:09.716108+00:00 app[web.1]: "map.css": "/packs/css/map-1c42ce8f.css",
2019-05-22T13:53:09.716109+00:00 app[web.1]: "map.js": "/packs/js/map-c76722abf103111664a2.js",
2019-05-22T13:53:09.716110+00:00 app[web.1]: "map.js.map": "/packs/js/map-c76722abf103111664a2.js.map"
2019-05-22T13:53:09.716112+00:00 app[web.1]: }
2019-05-22T13:53:09.716113+00:00 app[web.1]: ):
2019-05-22T13:53:09.716334+00:00 app[web.1]: F, [2019-05-22T13:53:09.716276 #4] FATAL -- : [20ca8723-7451-41e8-ab0d-df5b3e56c777]      7:     <%= csrf_meta_tags %>
2019-05-22T13:53:09.716337+00:00 app[web.1]: [20ca8723-7451-41e8-ab0d-df5b3e56c777]      8:     <%= action_cable_meta_tag %>
2019-05-22T13:53:09.716338+00:00 app[web.1]: [20ca8723-7451-41e8-ab0d-df5b3e56c777]      9:     <%= stylesheet_link_tag 'application', media: 'all' %>
2019-05-22T13:53:09.716340+00:00 app[web.1]: [20ca8723-7451-41e8-ab0d-df5b3e56c777]     10:     <%= stylesheet_pack_tag 'application', media: 'all' %>
2019-05-22T13:53:09.716341+00:00 app[web.1]: [20ca8723-7451-41e8-ab0d-df5b3e56c777]     11:     <%= stylesheet_pack_tag 'map' %>
2019-05-22T13:53:09.716343+00:00 app[web.1]: [20ca8723-7451-41e8-ab0d-df5b3e56c777]     12:   </head>
2019-05-22T13:53:09.716344+00:00 app[web.1]: [20ca8723-7451-41e8-ab0d-df5b3e56c777]     13:   <body>
2019-05-22T13:53:09.716426+00:00 app[web.1]: F, [2019-05-22T13:53:09.716369 #4] FATAL -- : [20ca8723-7451-41e8-ab0d-df5b3e56c777]
2019-05-22T13:53:09.716517+00:00 app[web.1]: F, [2019-05-22T13:53:09.716463 #4] FATAL -- : [20ca8723-7451-41e8-ab0d-df5b3e56c777] app/views/layouts/application.html.erb:10:in `_app_views_layouts_application_html_erb___4054649697818533831_47054766793720'
2019-05-22T13:55:34.396458+00:00 heroku[web.1]: Restarting
2019-05-22T13:55:34.681019+00:00 heroku[web.1]: State changed from up to starting
2019-05-22T13:55:35.566494+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2019-05-22T13:55:35.686117+00:00 heroku[web.1]: Process exited with status 143
2019-05-22T13:55:35.579278+00:00 app[web.1]: - Gracefully stopping, waiting for requests to finish
2019-05-22T13:55:35.582846+00:00 app[web.1]: === puma shutdown: 2019-05-22 13:55:35 +0000 ===
2019-05-22T13:55:35.582878+00:00 app[web.1]: - Goodbye!
2019-05-22T13:55:41.287394+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb`
2019-05-22T13:55:43.390424+00:00 app[web.1]: Puma starting in single mode...
2019-05-22T13:55:43.390453+00:00 app[web.1]: * Version 3.12.1 (ruby 2.5.3-p105), codename: Llamas in Pajamas
2019-05-22T13:55:43.390455+00:00 app[web.1]: * Min threads: 5, max threads: 5
2019-05-22T13:55:43.390456+00:00 app[web.1]: * Environment: production
2019-05-22T13:55:45.981837+00:00 heroku[web.1]: State changed from starting to up
2019-05-22T13:55:45.842400+00:00 app[web.1]: * Listening on tcp://0.0.0.0:21575
2019-05-22T13:55:45.842712+00:00 app[web.1]: Use Ctrl-C to stop
2019-05-22T13:56:03.019885+00:00 app[web.1]: I, [2019-05-22T13:56:03.019766 #4]  INFO -- : [4f5fe5ef-ab45-4012-97be-87de88b8fdb5] Started GET "/" for 89.95.71.184 at 2019-05-22 13:56:03 +0000
2019-05-22T13:56:03.021420+00:00 app[web.1]: I, [2019-05-22T13:56:03.021348 #4]  INFO -- : [4f5fe5ef-ab45-4012-97be-87de88b8fdb5] Processing by Devise::SessionsController#new as HTML
2019-05-22T13:56:03.112359+00:00 app[web.1]: I, [2019-05-22T13:56:03.112174 #4]  INFO -- : [4f5fe5ef-ab45-4012-97be-87de88b8fdb5]   Rendering devise/sessions/new.html.erb within layouts/application
2019-05-22T13:56:04.512197+00:00 heroku[router]: at=info method=GET path="/" host=concierge-at-sea.herokuapp.com request_id=4f5fe5ef-ab45-4012-97be-87de88b8fdb5 fwd="89.95.71.184" dyno=web.1 connect=0ms service=1496ms status=500 bytes=1827 protocol=https
2019-05-22T13:56:04.509151+00:00 app[web.1]: I, [2019-05-22T13:56:04.509056 #4]  INFO -- : [4f5fe5ef-ab45-4012-97be-87de88b8fdb5]   Rendered devise/shared/_links.html.erb (1.1ms)
2019-05-22T13:56:04.509685+00:00 app[web.1]: I, [2019-05-22T13:56:04.509622 #4]  INFO -- : [4f5fe5ef-ab45-4012-97be-87de88b8fdb5]   Rendered devise/sessions/new.html.erb within layouts/application (1397.3ms)
2019-05-22T13:56:04.511523+00:00 app[web.1]: I, [2019-05-22T13:56:04.511465 #4]  INFO -- : [4f5fe5ef-ab45-4012-97be-87de88b8fdb5] Completed 500 Internal Server Error in 1490ms (ActiveRecord: 17.4ms)
2019-05-22T13:56:04.512104+00:00 app[web.1]: F, [2019-05-22T13:56:04.512053 #4] FATAL -- : [4f5fe5ef-ab45-4012-97be-87de88b8fdb5]
2019-05-22T13:56:04.512180+00:00 app[web.1]: F, [2019-05-22T13:56:04.512116 #4] FATAL -- : [4f5fe5ef-ab45-4012-97be-87de88b8fdb5] ActionView::Template::Error (Webpacker can't find application in /app/public/packs/manifest.json. Possible causes:
2019-05-22T13:56:04.512182+00:00 app[web.1]: 1. You want to set webpacker.yml value of compile to true for your environment
2019-05-22T13:56:04.512183+00:00 app[web.1]: unless you are using the `webpack -w` or the webpack-dev-server.
2019-05-22T13:56:04.512184+00:00 app[web.1]: 2. webpack has not yet re-run to reflect updates.
2019-05-22T13:56:04.512185+00:00 app[web.1]: 3. You have misconfigured Webpacker's config/webpacker.yml file.
2019-05-22T13:56:04.512186+00:00 app[web.1]: 4. Your webpack configuration is not creating a manifest.
2019-05-22T13:56:04.512188+00:00 app[web.1]: Your manifest contains:
2019-05-22T13:56:04.512189+00:00 app[web.1]: {
2019-05-22T13:56:04.512190+00:00 app[web.1]: "application.js": "/packs/js/application-b9d827093751ba55443e.js",
2019-05-22T13:56:04.512192+00:00 app[web.1]: "application.js.map": "/packs/js/application-b9d827093751ba55443e.js.map",
2019-05-22T13:56:04.512193+00:00 app[web.1]: "entrypoints": {
2019-05-22T13:56:04.512194+00:00 app[web.1]: "application": {
2019-05-22T13:56:04.512195+00:00 app[web.1]: "js": [
2019-05-22T13:56:04.512196+00:00 app[web.1]: "/packs/js/application-b9d827093751ba55443e.js"
2019-05-22T13:56:04.512197+00:00 app[web.1]: ],
2019-05-22T13:56:04.512198+00:00 app[web.1]: "js.map": [
2019-05-22T13:56:04.512199+00:00 app[web.1]: "/packs/js/application-b9d827093751ba55443e.js.map"
2019-05-22T13:56:04.512200+00:00 app[web.1]: ]
2019-05-22T13:56:04.512201+00:00 app[web.1]: },
2019-05-22T13:56:04.512202+00:00 app[web.1]: "map": {
2019-05-22T13:56:04.512203+00:00 app[web.1]: "css": [
2019-05-22T13:56:04.512204+00:00 app[web.1]: "/packs/css/map-1c42ce8f.css"
2019-05-22T13:56:04.512205+00:00 app[web.1]: ],
2019-05-22T13:56:04.512206+00:00 app[web.1]: "js": [
2019-05-22T13:56:04.512207+00:00 app[web.1]: "/packs/js/map-c76722abf103111664a2.js"
2019-05-22T13:56:04.512208+00:00 app[web.1]: ],
2019-05-22T13:56:04.512209+00:00 app[web.1]: "js.map": [
2019-05-22T13:56:04.512210+00:00 app[web.1]: "/packs/js/map-c76722abf103111664a2.js.map"
2019-05-22T13:56:04.512211+00:00 app[web.1]: ]
2019-05-22T13:56:04.512212+00:00 app[web.1]: }
2019-05-22T13:56:04.512213+00:00 app[web.1]: },
2019-05-22T13:56:04.512214+00:00 app[web.1]: "map.css": "/packs/css/map-1c42ce8f.css",
2019-05-22T13:56:04.512215+00:00 app[web.1]: "map.js": "/packs/js/map-c76722abf103111664a2.js",
2019-05-22T13:56:04.512217+00:00 app[web.1]: "map.js.map": "/packs/js/map-c76722abf103111664a2.js.map"
2019-05-22T13:56:04.512218+00:00 app[web.1]: }
2019-05-22T13:56:04.512219+00:00 app[web.1]: ):
2019-05-22T13:56:04.512299+00:00 app[web.1]: F, [2019-05-22T13:56:04.512257 #4] FATAL -- : [4f5fe5ef-ab45-4012-97be-87de88b8fdb5]      7:     <%= csrf_meta_tags %>
2019-05-22T13:56:04.512300+00:00 app[web.1]: [4f5fe5ef-ab45-4012-97be-87de88b8fdb5]      8:     <%= action_cable_meta_tag %>
2019-05-22T13:56:04.512301+00:00 app[web.1]: [4f5fe5ef-ab45-4012-97be-87de88b8fdb5]      9:     <%= stylesheet_link_tag 'application', media: 'all' %>
2019-05-22T13:56:04.512302+00:00 app[web.1]: [4f5fe5ef-ab45-4012-97be-87de88b8fdb5]     10:     <%= stylesheet_pack_tag 'application', media: 'all' %>
2019-05-22T13:56:04.512303+00:00 app[web.1]: [4f5fe5ef-ab45-4012-97be-87de88b8fdb5]     11:     <%= stylesheet_pack_tag 'map' %>
2019-05-22T13:56:04.512304+00:00 app[web.1]: [4f5fe5ef-ab45-4012-97be-87de88b8fdb5]     12:   </head>
2019-05-22T13:56:04.512305+00:00 app[web.1]: [4f5fe5ef-ab45-4012-97be-87de88b8fdb5]     13:   <body>
2019-05-22T13:56:04.512334+00:00 app[web.1]: F, [2019-05-22T13:56:04.512299 #4] FATAL -- : [4f5fe5ef-ab45-4012-97be-87de88b8fdb5]
2019-05-22T13:56:04.512374+00:00 app[web.1]: F, [2019-05-22T13:56:04.512340 #4] FATAL -- : [4f5fe5ef-ab45-4012-97be-87de88b8fdb5] app/views/layouts/application.html.erb:10:in `_app_views_layouts_application_html_erb__246445882644024882_47273754121400'```

我的路线

Rails.application.routes.draw do
  devise_for :users
  get '/dashboard' => 'pages#dashboard'

  devise_scope :user do
    root to: "devise/sessions#new"
  end

  authenticated :user do
    root 'pages#dashboard'
  end
end

我的布局

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Concierge@Sea</title>
    <%= csrf_meta_tags %>
    <%= action_cable_meta_tag %>
    <%= stylesheet_link_tag 'application', media: 'all' %>
    <%= stylesheet_pack_tag 'application', media: 'all' %> 
    <%= stylesheet_pack_tag 'map' %> 
  </head>
  <body>

    <%= render 'shared/flyout' %>
    <%= render 'shared/navbar' %>
    <%= render 'shared/flashes' %>
    <%= yield %>
    <%= javascript_include_tag 'application' %>
    <%= javascript_pack_tag 'application' %>
    <%= javascript_pack_tag 'map' %>
  </body>
</html>

谢谢您能帮助我或给我任何建议

1 个答案:

答案 0 :(得分:0)

在您的heroku日志中,您似乎遇到了webpacker的问题。如您所见

2019-05-22T13:56:04.512104+00:00 app[web.1]: F, [2019-05-22T13:56:04.512053 #4] FATAL -- : [4f5fe5ef-ab45-4012-97be-87de88b8fdb5]
2019-05-22T13:56:04.512180+00:00 app[web.1]: F, [2019-05-22T13:56:04.512116 #4] FATAL -- : [4f5fe5ef-ab45-4012-97be-87de88b8fdb5] ActionView::Template::Error (Webpacker can't find application in /app/public/packs/manifest.json. Possible causes:
2019-05-22T13:56:04.512182+00:00 app[web.1]: 1. You want to set webpacker.yml value of compile to true for your environment
2019-05-22T13:56:04.512183+00:00 app[web.1]: unless you are using the `webpack -w` or the webpack-dev-server.
2019-05-22T13:56:04.512184+00:00 app[web.1]: 2. webpack has not yet re-run to reflect updates.
2019-05-22T13:56:04.512185+00:00 app[web.1]: 3. You have misconfigured Webpacker's config/webpacker.yml file.
2019-05-22T13:56:04.512186+00:00 app[web.1]: 4. Your webpack configuration is not creating a manifest.

您是否在heroku上运行了webpacker:compile命令? 同样基于此处的信息https://github.com/rails/webpacker/issues/1494。 webpacker本身可能有问题。