简体   繁体   English

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

[英]Deploying app on Heroku with Rails (error 500)

I am trying to deploy my application on Heroku, but it is showing following error我正在尝试在 Heroku 上部署我的应用程序,但它显示以下错误

"We're sorry, but something went wrong." “我们很抱歉,但有些不对劲。”

So I've check my heroku logs, here is 2 problems I have所以我检查了我的 Heroku 日志,这是我遇到的两个问题

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

This is for an app with devise, I've already tried heroku restart in order to restart my dyno's这是一个带有设计的应用程序,我已经尝试过heroku restart以重新启动我的 dyno

But I don't understand the error 500, in local everything works但我不明白错误 500,在本地一切正常

Here is my heroku logs这是我的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'```

My routes我的路线

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

My Layouts我的布局

<!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>

Thanks you if you can help me or give me any advice谢谢你,如果你能帮助我或给我任何建议

From your heroku logs looks like you have issues with webpacker.从您的 heroku 日志来看,您似乎对 webpacker 有问题。 As you can see here正如你在这里看到的

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.

Did you run webpacker:compile command on heroku?您是否在 heroku 上运行了 webpacker:compile 命令? Also based on info here https://github.com/rails/webpacker/issues/1494 .同样基于这里的信息https://github.com/rails/webpacker/issues/1494 There may be an issue with webpacker itself. webpacker 本身可能有问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将应用程序部署到 Heroku 在后端抛出 500 内部服务器错误 Java Spring 在本地环境中完美运行时启动 - Deploying app to Heroku throwing a 500 Internal Server Error in Back End Java Spring Boot while works perfect on local enviroment 将Rails应用程序部署到Heroku时出现语法错误:ExecJS :: RuntimeError:SyntaxError:Unexpected character - Syntax error when deploying Rails app to Heroku: ExecJS::RuntimeError: SyntaxError: Unexpected character 在 Heroku 上部署 JS 应用程序 - 错误状态 503 - Deploying JS app on Heroku - error status 503 部署节点应用程序时出现heroku错误 - heroku error while deploying node app 在 Heroku 上部署 Node.js 应用程序时出现 403 错误 - 403 error when deploying a Node.js app on Heroku 将 Django-React 应用程序部署到 Heroku 时出错 - Error when deploying Django-React app to Heroku 在 Heroku 中部署 React 应用程序时 mapBox 出错 - Error in mapBox when I am deploying react app in Heroku 将Node / Express应用程序部署到Heroku / Production - Babel / ES6错误 - Deploying Node/Express App to Heroku/Production — Babel/ES6 Error 将 mern 应用程序部署到 heroku。 错误信息:未找到 - deploying mern app to heroku. error message: Not found Nodemon 在部署 Heroku 应用程序后崩溃,错误:无效的 ELF header - Nodemon crashing after deploying Heroku App, ERROR: Invalid ELF header
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM