Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku - Application Error

I've created simple application with Ruby on Rails and I’ve tried to commit it on Heroku. I’ve followed this Getting Started on Heroku guide, I finished it and try to open my page but I still see an Error: 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.

Anybody know how to deal with it?


I don’t know what was happen but I’ve done this step, unfortunately I have another problem, I run a few commands:

# git add .
# git commit -m "my commit"
On branch master nothing to commit (working directory clean)
# git push heroku master Everything up-to-date
# heroku open Opening http ://eerie-meadow-9207.heroku.com/
# heroku restart Restarting processes... done
# heroku open Opening http ://eerie-meadow-9207.heroku.com/

And I see a message:

We're sorry, but something went wrong.

We've been notified about this issue and we'll take a look at it shortly.

From heroku logs [timestamps removed for clarity]:

app[web.1]: Started GET "/" for 77.236.11.34 at 2011-10-31 11:50:38 -0700
app[web.1]:   Processing by StoreController#index as HTML
app[web.1]: Completed 500 Internal Server Error in 3ms
heroku[router]: GET eerie-meadow-9207.heroku.com/ dyno=web.1 queue=0 wait=0ms service=13ms status=500 bytes=728
heroku[nginx]: 77.236.11.34 - - [31/Oct/2011:11:50:38 -0700] "GET / HTTP/1.1" 500 728 "-" "Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.9.2.23) Gecko/20110921 Ubuntu/10.04 (lucid) Firefox/3.6.23" eerie-meadow-9207.heroku.com
app[web.1]:
heroku[web.1]: State changed from up to bouncing
heroku[web.1]: State changed from bouncing to created
heroku[web.1]: State changed from created to starting
heroku[web.1]: Starting process with command `thin -p 40376 -e production -R /home/heroku_rack/heroku.ru start`
heroku[web.1]: Process exited
app[web.1]: >> Maximum connections set to 1024 
app[web.1]: >> Listening on 0.0.0.0:40376, CTRL+C to stop
app[web.1]: >> Thin web server (v1.2.6 codename Crazy Delicious)
heroku[web.1]: State changed from starting to up
app[web.1]:
app[web.1]: Started GET "/" for 77.236.11.34 at 2011-10-31 11:50:59-0700
app[web.1]:
app[web.1]:   Processing by StoreController#index as HTML
app[web.1]: Completed 500 Internal Server Error in 4ms
app[web.1]:
app[web.1]: ActiveRecord::StatementInvalid (PGError: ERROR:  relation "products" does not exist
app[web.1]: :             SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
app[web.1]:               FROM pg_attribute a LEFT JOIN pg_attrdef d
app[web.1]:         ON a.attrelid = d.adrelid AND a.attnum = d.adnum
app[web.1]:              WHERE a.attrelid = '"products"'::regclass
app[web.1]:           AND a.attnum > 0 AND NOT a.attisdropped
app[web.1]:              ORDER BY a.attnum
app[web.1]: ):
app[web.1]:   app/controllers/store_controller.rb:3:in `index'
app[web.1]:
app[web.1]:
app[web.1]: cache: [GET /] miss
heroku[router]: GET eerie-meadow-9207.heroku.com/ dyno=web.1 queue=0 wait=0ms service=81ms status=500 bytes=728
heroku[nginx]: 77.236.11.34 - - [31/Oct/2011:11:50:59 -0700] "GET / HTTP/1.1" 500 728 "-" "Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.9.2.23) Gecko/20110921 Ubuntu/10.04 (lucid) Firefox/3.6.23" eerie-meadow-9207.heroku.com
app[web.1]:
app[web.1]:
app[web.1]: Started GET "/" for 77.236.11.34 at 2011-10-31 11:54:00-0700
app[web.1]:   Processing by StoreController#index as HTML

I cannot understand it because on my netbook it works on localhost, any ideas?

like image 897
ruhungry Avatar asked Oct 31 '11 12:10

ruhungry


People also ask

Why there is application error in Heroku?

"Application Error" or similar is always caused by your own application code. Routing errors will normally only surface themselves within the logs of your application. In most cases, you will be able to see the cause of the error there. To learn more about logging, please see our Logging article on DevCenter.

Why am I getting an application error?

However, most application errors occur because developers either unknowingly introduce logic errors into their code or do not discover potential problems during an application's test phase. Viruses and faulty hardware are also causes of application errors.

Is Heroku down today?

Current Heroku status is up.


4 Answers

I had this issue when I was starting to create a discord bot and make it online. And I figured out the reason for this was using the node latest current version(v17.1), I wasted about 2 days for this and tried downgrading node version to v16.7.And to my surprise it worked!.

So I recommend downgrading to v16.7 or the latest LTS version when you are checking this and do install the current latest version https://nodejs.org/ca/blog/release/v16.7.0/

Here's the full code

const { Client, Intents } = require('discord.js');
const { token } = require('./config.json');

// Create a new client instance
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
// WShen the client is ready, run this code (only once)
client.once('ready', () => {
    console.log('Ready!');
});

// Login to Discord with your client's token
client.login(token);
const http = require('http');
const PORT = process.env.PORT || 3000;

const requestListener = function (req, res) {
  res.writeHead(200);
  res.end('Bot is up and running');
}

const server = http.createServer(requestListener);
server.listen(PORT);
  setInterval(function() {
    http.get("http://<your app name>.herokuapp.com");
}, 300000); // every 5 minutes (300000)

Note:Last 3 lines of this code is completely additional and what they do is stop heroku from putting app to sleep every 30 minutes

like image 88
ExtendedMag Avatar answered Oct 27 '22 03:10

ExtendedMag


Most of the time heroku issues are due to lack of privileges to access file system. In order for your application to work on heroku you must make sure it wont try to write anything to disk (but in temporary folder).

The typical example is js/css compiling process, e.g. with compass, for which you will find a solution on their knowledge database: http://devcenter.heroku.com/articles/using-compass

You should look further in the heroku logs see if there is any "permission denied" issue at application startup or during the first requests.

like image 26
demental Avatar answered Oct 27 '22 05:10

demental


Try using the command

heroku run rake db:migrate

like image 38
shal Avatar answered Oct 27 '22 05:10

shal


Try restarting your app with heroku restart. Assuming your app runs fine locally, this should do the trick. It solved the issue for me as I only refactored the schema and the db:reset did not seem to do the trick.

like image 28
Ariejan Avatar answered Oct 27 '22 05:10

Ariejan