Heroku Build Succeed but ----< Application Error> Code H10 Status 503 [duplicate] - heroku

I have a RoR app working on my local computer, but when I send it to heroku, it crashes. The error log gives an error H10 & says:
2012-11-21T15:26:47+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.2/lib/new_relic/control/instance_methods.rb:95:in `start_agent'
2012-11-21T15:26:48+00:00 heroku[web.1]: State changed from starting to crashed
2012-11-21T15:26:48+00:00 heroku[web.1]: Process exited with status 1
2012-11-21T15:26:59+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
2012-11-21T15:27:00+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
2012-11-21T15:30:08+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
2012-11-21T15:30:08+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
2012-11-21T15:30:59+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
2012-11-21T15:31:19+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
2012-11-21T15:31:19+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
2012-11-21T15:32:08+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
2012-11-21T15:32:08+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
Edit:
2012-11-22T10:00:58+00:00 app[web.1]:
2012-11-22T10:00:59+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=xxx.herokuapp.com fwd= dyno=web.1 queue=0 wait=0ms connect=1ms service=26ms status=200 bytes=0
Has anyone had this before, and know what might be causing the problem? I cannot find a solution.
Thanks.

I ran into the same error above, app was crashing on heroku (running fine in dev) but error logs on heroku were not revealing any clues. I read other answers on this page and broke out in a sweat after seeing "rebuilding the app." I figured maybe I could get in the heroku console and look around. I did and even the console crashed, but this time it told me why. It was some obscure variable I forgot to delete during a troubleshooting session hours earlier. I am not saying you will run into the same problem, but I found more info when I tried to go through the console.
$ heroku run rails console

I was having the same issue. Logs weren't giving me any clues either.
So I scaled down and scaled back up the dynos. This solved the problem for me:
heroku ps:scale web=0
Waited a few seconds...
heroku ps:scale web=1

$heroku run rails console
This is the best option since it will give you an error in your terminal which will be much more detailed than the 'app crashed' error in your Heroku logs.

$ heroku restart
helped me get my dyno running again. I'm new to Heroku but glad I know now.

this happened to me when I was listening on the wrong port
I changed my listen() to "process.env.PORT" so:
http.listen((process.env.PORT || 5000), function(){
console.log('listening on *:5000');
});
instead of
http.listen(5000, function(){
console.log('listening on *:5000');
});

Had same problem this evening. Not a very helpful error so I tried running in the console
heroku run rails c
it failed and gave me a much more helpful error. I had neglected to delete a method call in production. Once I fixed that, the app worked fine.

I solved this problem by pushing to Git:
git add .
git commit -am "some text"
git push
then push to Heroku:
git push heroku
then rake db:migrate on Heroku:
heroku run rake db:migrate

If you're using Node, you can try running the serve command directly in the console. In my case I'm running an angular application, so I tried with:
heroku run npm start
This showed me the exact error during the application startup.

I managed to not include my .gitignore file -> that breaks heroku. #doh
Here is a working .gitignore file
/.bundle
/vendor/bundle/
/vendor/ruby/
db/*.sqlite3
/db/*.sqlite3-journal
/log/*
/tmp/*
**.war
*.rbc
*.sassc
.redcar/
.sass-cache
/config/config.yml
/config/database.yml
/coverage.data
/coverage/
/db/*.javadb/
/db/*.sqlite3
/doc/api/
/doc/app/
/doc/features.html
/doc/specs.html
/public/cache
/public/stylesheets/compiled
/public/system/*
/spec/tmp/*
/cache
/capybara*
/capybara-*.html
/gems
/specifications
rerun.txt
pickle-email-*.html
.zeus.sock
**.orig
.DS_Store
/nbproject/
.idea
/*.tmproj
**.swp
.env
.powenv
To create a .gitignore file, in terminal navigate to your apps directory and use the following command
touch .gitignore
Then you can open it up in a your text editor and put the above code into it.

In my case i was using ENV variables in my app, but it was not set in heroku config.
heroku console gave proper error:
heroku console
`validate_options': Missing required arguments: aws_access_key_id, aws_secret_access_key (ArgumentError)
Then set the ENV config
heroku config:set AWS_ACCESS_KEY_ID='key'
Restart the Heroku
heroku restart
it works!!

I was getting this same H10 app crashed error in Heroku. I clicked 'restart all dynos' in the heroku interface, and problem solved.

I had H10 with Heroku and Node due to wrong name of the main code file. Edit package.json:
{
...
"main": "correct_file_name.js",
...
"scripts": {
"start": "node correct_file_name.js"
}
}
Or rename the file.

In my case the Procfile I used was breaking everything. Heroku looks for Procfile and applies its settings when launching the app - clearly the dev settings I used didn't make any sense for the prod server. I had to rename it to Procfile.dev and everything started working normally.

Solution Worked for me, Try running the command: :
Heroku restart

See if you get
bash: bin/rails: No such file or directory
in logs while running (heroku logs -t) command if yes then please Run
bundle exec rake rails:update
Don't overwrite your files, in the end this command will create
create bin
create bin/bundle
create bin/rails
create bin/rake
push these files to heroku and you are done.

The root of the problem I was facing was due to not having a database. To resolve the problem I first exported my local database:
$ heroku addons:add heroku-postgresql:dev
$ heroku addons:add pgbackups
$ PGPASSWORD=mypassword pg_dump -Fc --no-acl --no-owner -h localhost -U myuser mydb > mydb.dump
Then imported it into Heroku:
$ heroku pgbackups:restore DATABASE 'http://site.tld/mydb.dump'
The variables to replace in these examples are: mypassword, myuser, mydb & http://site.tld/mydb.dump. Note that I had to upload the dump to a temporary server.
Resolving all my problems I wrote up a quick guide on how to deploy Enki to Heroku, which can be found here.

I got the same above error as "app crashed" and the heroku app logs is not showing much info related to the error msg reasons. Then I restarted the dynos in heroku and then it showed the error saying additional curly brace in one of the index.js files in my setup. The issue got fixed once it is removed and redeployed the app on heroku.
Hope this will be helpful to someone facing the same issue.

After going through the entire list of answers I stumbled upon this website: https://status.heroku.com/ which details the current status/incidents with Heroku. Its always safe to check out for incidents before banging your head against the wall. For me, it was the attached incident report published on the above mentioned link that was causing the error.

I had the same problem, I did the following
heroku run rails c
It identified a syntax error and missing comma within a controller permitted params. As mentioned above the Heroku logs did not provide sufficient information to problem solve the problem.
I have not seen the application crashed message on Heroku previously.

I traced my problem back to the Puma server as did #Ahmed Elkoussy, but I solved just by commenting the following line on the puma.rb file:
# pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }

I encountered the same problem today. I did heroku run rake db:migrate though I migrated the model before, and the app doesn't crash.

Be very cautious of copy and pasting code. Sometimes when you add a block into a file, it is formatted incorrectly and will yield an error.
I've had this problem before and got this error: unexpected tIDENTIFIER, expecting keyword_end

Had same problem. for me it was error in before_action filters(because empty DB)
Check your before_action filters, maybe they throw unhendled exeptions.

I had this problem when trying to run Rails in a subdirectory, and not in /. For example, I had Angular/Node/Gulp app running in /client and a Rails app running in /server, but both of them were in the same git repo, so I could track changes across the front end and back end. I got this error when trying to deploy them to Heroku. For anyone else having this issue, here is a custom buildpack that will allow running Rails in a subdirectory.
https://github.com/aarongray/heroku-buildpack-ruby

I had the same issue (same error on heroku, working on local machine) and I tried all the solutions listed here including
heroku run rails console
which ran without error messages. I tried heroku run rake db:migrate and heroku run rake db:migrate:reset a few times. None of this solved the problem. On going through some files that are used in production but not in dev environment, I found some whitespace in the puma.rb file to be the culprit. Hope this helps someone who has the same issue.
Changing this made it work
ActiveRecord::Base.establish_connection
End
to
ActiveRecord::Base.establish_connection
end

I ran into the same issue while deploying to Heroku (app crash). Logs did not indicate what the problem could be. Heroku console displayed syntax error in the code of an extra bracket. Surprisingly, I did not have an issue on local rails while running the app and hence missed it. After correction and git push to Heroku, the app started working on Heroku!

I updated my settings from
app.set('ip_address', process.env.IP || '127.0.0.1');
to
app.set('ip_address', process.env.IP || '0.0.0.0');
which i changed for Openshift hosting

I had the same issue when I started using Puma in heroku as per their guide page, this issue was solved when I commented the port line shown below
# port ENV['PORT'] || 3000
So, disabling the above line in the puma.rb in the config directory solved the issue
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
threads threads_count, threads_count
preload_app!
rackup DefaultRackup
# port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'production'
on_worker_boot do
# Worker specific setup for Rails 4.1+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
ActiveRecord::Base.establish_connection
end

In my case I was performing git push heroku master when I am not on the master branch.
I had to go to master branch first, merge the code with my other branch and then git pushed.

I also encountered the same error. Adding a .gitignore file to my project resolved my issue.
My .gitignore file is here:
# Node build artifacts
node_modules
npm-debug.log
# Local development
*.env
*.dev
.DS_Store
# Docker
Dockerfile
docker-compose.yml
And I changed listen() function;
app.listen(5000, function() {
console.log("Server running on port 5000...");
});
I changed it to;
const PORT = process.env.PORT || 5000
...
app.listen(PORT, function() {
console.log("Server running on port 5000...");
});

Related

assets not being used with Heroku and Cloudflare

I have ruby on rails 6 app that is running on heroku and I am setting it up to run on a custom domain. I done the following
heroku domains:add www.example.com
heroku domains:add example.com
heroku domains # noted the herokudns.com names for www.example.com and example.com
# in cloudflare added cnames for www.example.com and example.com
# in cloudflare, checked the example.com cname is flattened
heroku config:set APPLICATION_HOST=www.example.com
heroku config:set ASSET_HOST=www.example.com
When I access www.example.com I see the raw html, but no styling. But in the log I see
2020-08-22T05:42:36.262127+00:00 heroku[router]: at=info method=GET path="/packs/js/application-aaf9d9c806bf765590e6.js" host=www.example.com request_id=e833945b-54bc-4d4a-bbf7-d7c502444b15 fwd="2001:8003:2d82:b901:5821:c882:4a71:5ba0,108.162.250.97" dyno=web.1 connect=0ms service=6ms status=200 bytes=302 protocol=https
2020-08-22T05:42:36.261767+00:00 heroku[router]: at=info method=GET path="/assets/application-90a7667ebe1530b7281dc7743ca54268ab23286f578c9a356684ecd84321b0fd.css" host=www.example.com request_id=d2ffabfa-fe6e-4ef9-b6a4-d8bd771181dc fwd="2001:8003:2d82:b901:5821:c882:4a71:5ba0,108.162.250.69" dyno=web.1 connect=0ms service=8ms status=200 bytes=331 protocol=https
If I look at the source code for page in the <head> tag I have
<link rel="stylesheet" media="all" href="https://www.philomaths.org/assets/application-90a7667ebe1530b7281dc7743ca54268ab23286f578c9a356684ecd84321b0fd.css" />
<script src="https://www.philomaths.org/packs/js/application-aaf9d9c806bf765590e6.js"></script>
So, the correct asset files are being loaded. But when I view the asset files, both the js and css are empty.
How do I fix this?
I made a minor change and pushed it to heroku to make sure it was compiling properly, and I saw this message
remote: You set `config.action_dispatch.x_sendfile_header = 'X-Sendfile'` in production,
remote: but you do not have `apache` installed on this app. This setting will cause any assets
remote: being served by your application to be returned without a body.
remote:
remote: To fix this issue, please set:
remote:
remote: config.action_dispatch.x_sendfile_header = nil
I realised I had incorrectly set the x_sendfile_header. I fixed it in production.rb and
then pushed it to heroku, but still the same problem.
I then used the heroku repo:reset and heroku repo:purge_cache command, reset the Cloudflare cache, and cleared my browser cache, and ... it is now working!

Problem publishing Streamlit app with Heroku

This is my first time trying to use Streamlit or Heroku. My app runs locally with Streamlit but I hit this error when trying to open the app after publishing it with Heroku:
2020-07-22T19:20:13.577096+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=ewan-app.herokuapp.com request_id=99a5e93d-8caa-458a-bf01-fae69aaa46e9 fwd="81.156.68.48" dyno= connect= service= status=503 bytes= protocol=https
2020-07-22T19:20:13.791262+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=ewan-app.herokuapp.com request_id=e4eea2e8-4fe3-46c4-996e-0d463bb36de0 fwd="81.156.68.48" dyno= connect= service= status=503 bytes= protocol=https
The same thing happens when I change the app script to the following:
import streamlit as st
st.write("Hello world!")
So I'm guessing it's due to one of the other files. I have the requirements.txt:
streamlit==0.63.1
Procfile:
web:sh setup.sh && streamlit run app.py
setup.sh:
mkdir -p ~/.streamlit
echo "[server]
headless = true
port = $PORT
enableCORS = false
" > ~/.streamlit/config.toml
I've tried a few different suggestions I've found, like removing the space between web: and sh in Procfile, and tried different layouts in setup.sh, but no luck so far. Any suggestions would be greatly appreciated.
I do not have a setup.sh and I have a simple Streamlit app working.
My Procfile is slightly different, though:
web: streamlit run --server.enableCORS false --server.port $PORT app.py

Connecting Laravel to iRedMail on separate server

I have set up my iredmail server at mail.rys.com (in this example ip 45.65.36.114). i have a website running laravel at rys.com. i also have installed let's encrypt - with separate instances on each server. i am able to send emails and add accounts fine via the provided email programs, but i need laravel to generate these and have had difficulty getting this to validate
i have tried a number of examples but have not had success. i haven't changed anything on the iredmail side and i can send mail from the admin#rys.com account but not via laravel
any help would be greatly appreciated.
Regards,
Peter
Config:
MAIL_DRIVER=smtp
MAIL_HOST=45.65.36.114
MAIL_PORT=587
MAIL_USERNAME=admin
MAIL_PASSWORD=xxxxx
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=admin#rys.com
MAIL_FROM_NAME="admin#rys.com"
Result:
Swift_TransportException (530)
Expected response code 250 but got code "530", with message "530 5.7.0 Must issue a STARTTLS command first "
Config:
MAIL_DRIVER=smtp
MAIL_HOST=45.65.36.114
MAIL_PORT=587
MAIL_USERNAME=admin
MAIL_PASSWORD=xxxxx
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=admin#rys.com
MAIL_FROM_NAME="admin#rys.com"
Result:
stream_socket_enable_crypto(): Peer certificate CN=mail.rys.com' did not match expected CN=45.65.36.114'
Config:
MAIL_DRIVER=sendmail
MAIL_HOST=45.65.36.114
MAIL_PORT=587
MAIL_USERNAME=admin
MAIL_PASSWORD=xxxxx
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=admin#rys.com
MAIL_FROM_NAME="admin#rys.com"
Result:
Swift_TransportException
Expected response code 220 but got an empty response
Config:
MAIL_DRIVER=smtp
MAIL_HOST=45.65.36.114
MAIL_PORT=80
MAIL_USERNAME=admin
MAIL_PASSWORD=xxxxx
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=admin#rys.com
MAIL_FROM_NAME="admin#rys.com"
Result:
Connection to 45.65.36.114:80 Timed Out
This was solved in a similar by adding what's below to the mail config. Answer's towards the bottom but it got the job done in Laravel 6
how to fix stream_socket_enable_crypto(): SSL operation failed with code 1
'stream' => [
'ssl' => [
'allow_self_signed' => true,
'verify_peer' => false,
'verify_peer_name' => false,
],
],

Laravel email sends only in debug mode

I hope someone can help me. Searched every combination for this issue.
I have an Laravel (5.4) app for invoicing. Its called Akaunting. App domain is app.mydomain.com
Everything works fine, except it doesn't sends email to customers when debug mode is off.
My .env file is setup properly.
Previousely I received maximum size exceeded, but only debug mode as well. Thats now sorted by increasing upload_max_filesize = 254M and post_max_size = 254M
I've tried mail_driver=log the email with success. First line production.DEBUG: Message-ID: <3369a7418b3f17c887fd27888ebe9f12#app.mydomain.com>
My .env looks like this and the emails are not send unless in debug mode:
APP_NAME=Akaunting
APP_ENV=production
APP_LOCALE=en-GB
APP_INSTALLED=true
APP_KEY=MySecureKey
APP_DEBUG=false
APP_LOG_LEVEL=debug
APP_SCHEDULE_TIME="09:00"
DB_CONNECTION=mysql
DB_HOST=mysql.host.com
DB_PORT=3306
DB_DATABASE=akaunting_db
DB_USERNAME=akunting_usr
DB_PASSWORD=MyDbPassword
DB_PREFIX=gvf_
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
# QUEUE_DRIVER=database
# QUEUE_DRIVER=sync
MAIL_DRIVER=SMTP
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=myemail#gmail.com
MAIL_PASSWORD=GmailAppPassword
MAIL_ENCRYPTION=ssl
MAIL_FROM_NAME="My App"
MAIL_FROM_ADDRESS=info#myapp.com
Thanks for your support.

Can't get Craft cms/server running on Heroku

I'm familiar with heroku, but new to Craft cms. In order to get a site running, I followed this tutorial: https://medium.com/#aj1215/craft-cms-on-heroku-79b991665b0b#.8b561b1b4
But the site isn't functioning. My heroku app just results in: “Application Error An error occurred in the application and your page could not be served. Please try again in a few moments. If you are the application owner, check your logs for details.”
My development server runs fine. But I have no idea what I need to do to get the heroku app to function. I'm pulling my hair out.
I've tried everything I can think of, but can't get it to work. I'm not sure what I'm doing wrong.
These are messages toward the end of my heroku logs:
2016–01–31T03:09:21.480751+00:00 app[web.1]: nginx: [emerg] “server”
directive is not allowed here in /app/nginx_app.conf:1
2016–01–31T03:09:21.475721+00:00 app[web.1]: Starting nginx…
2016–01–31T03:09:21.481090+00:00 app[web.1]: Process exited
unexpectedly: nginx 2016–01–31T03:09:21.481236+00:00 app[web.1]:
Going down, terminating child processes…
2016–01–31T03:09:22.183035+00:00 heroku[web.1]: Process exited with
status 1 2016–01–31T03:09:22.182791+00:00 heroku[web.1]: State
changed from starting to crashed 2016–01–31T03:09:27.185620+00:00
heroku[router]: at=error code=H10 desc=”App crashed” method=GET
path=”/” host=paradata2.herokuapp.com
request_id=1e502143–94ac-4aea-b34b-3087addd1d20 fwd=”172.11.56.78"
dyno= connect= service= status=503 bytes=
nginx_app.conf file:
server {
http {
location / {
# try to serve file directly, fallback to rewrite
try_files $uri #rewriteapp;
}
location #rewriteapp {
# rewrite all to index.php
rewrite ^(.*)$ /index.php?p=$1 last;
}
location ~ ^/(index)\.php(/|$) {
client_max_body_size 20M;
fastcgi_pass heroku-fcgi;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS on;
}
}
}
I've solved the issue.
I needed to remove calls to 'server' and 'http' in my enginx_app.conf file. Now the file only makes calls to 'location'.

Resources