Closed bfeldman89 closed 8 months ago
Hmm, looks like maybe your database didn't get properly set up. Can you confirm that you have a postgres instance listed in your Resources tab?
I didn't mean to close this. But maybe I should because adding the Heroku Postgres add-on did result in the build not failing. But once the build completes, unlike in the README, I can only "view" the app (there's no button to manage the app).
And when I do, it's a 500 error.
Is there a more updated/current version of the documentation/instructions somewhere? I'm sorry if this should be a brand new issue...
Looks like because things happened in a slightly different order for you, you were already in the "manage app" section. You just need to click over to the resources tab to continue the setup process. You might need to check the logs to see what that 500 error was about if finishing up the setup process doesn't resolve it.
I'm sorry but I just cannot for the life of me figure out what is wrong 😫... I've done all of the setup steps but I still get the 500 error page. Here is my build log, and the request/response headers for the app:
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/ruby
-----> Ruby app detected
-----> Installing bundler 2.3.10
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.7.2
-----> Installing dependencies using bundler 2.3.10
Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
Using rake 13.0.3
Using concurrent-ruby 1.1.8
Using i18n 1.8.10
Using minitest 5.14.4
Using thread_safe 0.3.6
Using tzinfo 1.2.9
Using zeitwerk 2.4.2
Using activesupport 6.0.3.6
Using builder 3.2.4
Using erubi 1.10.0
Using mini_portile2 2.5.0
Using racc 1.5.2
Using nokogiri 1.11.3 (x86_64-linux)
Using rails-dom-testing 2.0.3
Using crass 1.0.6
Using loofah 2.9.1
Using rails-html-sanitizer 1.3.0
Using actionview 6.0.3.6
Using rack 2.2.3
Using rack-test 1.1.0
Using actionpack 6.0.3.6
Using nio4r 2.5.7
Using websocket-extensions 0.1.5
Using websocket-driver 0.7.3
Using actioncable 6.0.3.6
Using globalid 0.4.2
Using activejob 6.0.3.6
Using activemodel 6.0.3.6
Using activerecord 6.0.3.6
Using marcel 1.0.1
Using activestorage 6.0.3.6
Using mini_mime 1.1.0
Using mail 2.7.1
Using actionmailbox 6.0.3.6
Using actionmailer 6.0.3.6
Using actiontext 6.0.3.6
Using public_suffix 4.0.6
Using addressable 2.7.0
Using aws-eventstream 1.1.1
Using aws-partitions 1.444.0
Using aws-sigv4 1.2.3
Using jmespath 1.4.0
Using aws-sdk-core 3.113.1
Using aws-sdk-sqs 1.38.0
Using bcrypt 3.1.16
Using msgpack 1.4.2
Using bootsnap 1.7.3
Using bundler 2.3.10
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using coffee-script 2.4.1
Using method_source 1.0.0
Using thor 1.1.0
Using railties 6.0.3.6
Using coffee-rails 5.0.0
Using css_parser 1.9.0
Using diffy 3.4.0
Using dotenv 2.7.6
Using ffi 1.15.0
Using htmlentities 4.3.4
Using mime-types-data 3.2021.0225
Using mime-types 3.3.1
Using multi_xml 0.6.0
Using httparty 0.18.1
Using jquery-rails 4.4.0
Using jwt 2.2.2
Using rexml 3.2.5
Using kramdown 2.3.1
Using libv8-node 15.14.0.0 (x86_64-linux-musl)
Using mini_racer 0.4.0
Using pg 1.2.3
Using premailer 1.14.2
Using premailer-rails 1.11.1
Using puma 4.3.7
Using rack-cache 1.12.1
Using sprockets 3.7.2
Using sprockets-rails 3.2.2
Using rails 6.0.3.6
Using rails_serve_static_assets 0.0.5
Using rails_stdout_logging 0.0.5
Using rails_12factor 0.0.3
Using rb-fsevent 0.10.4
Using rb-inotify 0.10.1
Using rdoc 6.3.0
Using sass-listen 4.0.0
Using sass 3.7.4
Using tilt 2.0.10
Using sass-rails 5.1.0
Using sdoc 1.0.0
Using simple_form 5.1.0
Using turbolinks-source 5.2.0
Using turbolinks 5.2.1
Using uglifier 4.2.0
Bundle complete! 35 Gemfile dependencies, 93 gems now installed.
Gems in the groups 'development' and 'test' were not installed.
Bundled gems are installed into `./vendor/bundle`
Bundle completed (0.36s)
Cleaning up the bundler cache.
-----> Installing node-v16.13.1-linux-x64
-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
DEPRECATION WARNING: Including LoggerSilence is deprecated and will be removed in Rails 6.1. Please use `ActiveSupport::LoggerSilence` instead (called from <main> at /tmp/build_d09fb9c8/config/application.rb:16)
[ERROR] Failed to set default_host because: ActiveRecord::StatementInvalid. If this is the first deploy, this is expected and will be fixed after the database is migrated.
Asset precompilation completed (1.35s)
Cleaning assets
Running: rake assets:clean
DEPRECATION WARNING: Including LoggerSilence is deprecated and will be removed in Rails 6.1. Please use `ActiveSupport::LoggerSilence` instead (called from <main> at /tmp/build_d09fb9c8/config/application.rb:16)
[ERROR] Failed to set default_host because: ActiveRecord::StatementInvalid. If this is the first deploy, this is expected and will be fixed after the database is migrated.
-----> Detecting rails configuration
###### WARNING:
There is a more recent Ruby version available for you to use:
2.7.5
The latest version will include security and bug fixes. We always recommend
running the latest version of your minor release.
Please upgrade your Ruby version.
For all available Ruby versions see:
https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
-----> Discovering process types
Procfile declares types -> web
Default types for buildpack -> console, rake
-----> Compressing...
Done: 127.5M
-----> Launching...
Released v14
https://mcj-klaxon.herokuapp.com/ deployed to Heroku
GET / HTTP/1.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cache-Control: max-age=0
Connection: keep-alive
Host: mcj-klaxon.herokuapp.com
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36
sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="100", "Google Chrome";v="100"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "macOS"
HTTP/1.1 500 Internal Server Error
Server: Cowboy
Date: Fri, 08 Apr 2022 17:20:09 GMT
Connection: keep-alive
Content-Type: text/html; charset=UTF-8
X-Request-Id: 60e37f86-1fe3-432d-a9a7-e1f8471e7ce7
X-Runtime: 0.018569
Strict-Transport-Security: max-age=31536000; includeSubDomains
Content-Length: 1468
Via: 1.1 vegur
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Klaxon</title>
</head>
<body>
<style>
body {
color: #ff0b3a;
padding: 30px;
font-family: "Helvetica Neue", Helvetica, sans-serif;
}
p {
font-size: 14px;
line-height: 1.4em;
word-wrap: break-word;
}
h1, h2, h3, h4, h5, h6 {
border-top: 0.2em solid #ff0b3a;
padding-top: 10px;
}
h1 {
margin-top: 0;
margin-bottom: 0;
font-size: 5.063em;
}
h2 {font-size: 3.375em;}
h3 {font-size: 2.25em;}
h4 {font-size: 1.5em;}
.container {
max-width: 1200px;
margin: 0 auto;
}
.klax-app-name {
padding-bottom: 50px;
font-weight: bold;
font-size: 18px;
}
.klax-button {
padding: 10px 16px;
font-size: 18px;
line-height: 1.33333;
border: 1px solid #ff0b3a;
display: block;
text-align: center;
}
.klax-button:hover, .klax-button:hover a {
background-color: #ff0b3a;
color: #ffffff !important;
text-decoration: none;
}
.klax-button {
text-decoration: none !important;
}
.klax-lead {
margin-bottom: 20px;
font-size: 16px;
font-weight: 300;
line-height: 1.4;
font-size: 21px;
}
.klax-fine-print {
margin-top: 30px;
font-size: 12px;
}
a {
color: #ff0b3a;
}
</style>
<div class="container">
<div class="klax-app-name">
Klaxon
</div>
<h1>500</h1>
<p class="klax-lead">We’re sorry. Something went wrong. <a href="/">Go home?</a></p>
</div>
</body>
</html>
It's possible this is still a database setup problem. What I meant by look at the logs was the server side logs while the app is running. You can do that an add-on called Papertrail. It's free, and we should just install it by default, but alas I haven't gotten around to it. If you add papertrail, click on it, then visit the page, you should get a much better idea of what the problem is.
papertrail log:
Apr 12 08:08:15 [mcj-klaxon](https://my.papertrailapp.com/systems/mcj-klaxon/events?focus=1450553367779479552&selected=1450553367779479552) [app/web.1](https://my.papertrailapp.com/events?q=program%3Aapp%2Fweb.1&focus=1450553367779479552&selected=1450553367779479552) Started GET "/" for [50.86.97.58](https://my.papertrailapp.com/systems/mcj-klaxon/events?q=%2250.86.97.58%22&focus=1450553367779479552&selected=1450553367779479552) at 2022-04-12 15:08:14 +0000
Apr 12 08:08:15 [mcj-klaxon](https://my.papertrailapp.com/systems/mcj-klaxon/events?focus=1450553367779479553&selected=1450553367779479553) [app/web.1](https://my.papertrailapp.com/events?q=program%3Aapp%2Fweb.1&focus=1450553367779479553&selected=1450553367779479553) Processing by WatchingController#feed as HTML
Apr 12 08:08:15 [mcj-klaxon](https://my.papertrailapp.com/systems/mcj-klaxon/events?focus=1450553367779479554&selected=1450553367779479554) [app/web.1](https://my.papertrailapp.com/events?q=program%3Aapp%2Fweb.1&focus=1450553367779479554&selected=1450553367779479554) Completed 500 Internal Server Error in 76ms (ActiveRecord: 33.7ms | Allocations: 3484)
Apr 12 08:08:15 [mcj-klaxon](https://my.papertrailapp.com/systems/mcj-klaxon/events?focus=1450553367779479556&selected=1450553367779479556) [app/web.1](https://my.papertrailapp.com/events?q=program%3Aapp%2Fweb.1&focus=1450553367779479556&selected=1450553367779479556) ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "app_settings" does not exist
Apr 12 08:08:15 [mcj-klaxon](https://my.papertrailapp.com/systems/mcj-klaxon/events?focus=1450553367779479557&selected=1450553367779479557) [app/web.1](https://my.papertrailapp.com/events?q=program%3Aapp%2Fweb.1&focus=1450553367779479557&selected=1450553367779479557) LINE 8: WHERE a.attrelid = '"app_settings"'::regclass
Apr 12 08:08:15 [mcj-klaxon](https://my.papertrailapp.com/systems/mcj-klaxon/events?focus=1450553367779479558&selected=1450553367779479558) [app/web.1](https://my.papertrailapp.com/events?q=program%3Aapp%2Fweb.1&focus=1450553367779479558&selected=1450553367779479558) ^
Apr 12 08:08:15 [mcj-klaxon](https://my.papertrailapp.com/systems/mcj-klaxon/events?focus=1450553367779479559&selected=1450553367779479559) [app/web.1](https://my.papertrailapp.com/events?q=program%3Aapp%2Fweb.1&focus=1450553367779479559&selected=1450553367779479559) ):
Apr 12 08:08:15 [mcj-klaxon](https://my.papertrailapp.com/systems/mcj-klaxon/events?focus=1450553367779479561&selected=1450553367779479561) [app/web.1](https://my.papertrailapp.com/events?q=program%3Aapp%2Fweb.1&focus=1450553367779479561&selected=1450553367779479561) app/models/app_setting.rb:8:in `default_host_exists?'
Apr 12 08:08:15 [mcj-klaxon](https://my.papertrailapp.com/systems/mcj-klaxon/events?focus=1450553367779479562&selected=1450553367779479562) [app/web.1](https://my.papertrailapp.com/events?q=program%3Aapp%2Fweb.1&focus=1450553367779479562&selected=1450553367779479562) app/controllers/application_controller.rb:16:in `set_default_host'
Apr 12 08:08:15 [mcj-klaxon](https://my.papertrailapp.com/systems/mcj-klaxon/events?focus=1450553367931883571&selected=1450553367931883571) [heroku/router](https://my.papertrailapp.com/events?q=program%3Aheroku%2Frouter&focus=1450553367931883571&selected=1450553367931883571) at=info method=GET path="/" host=mcj-klaxon.herokuapp.com request_id=[0441789c-5a16-4c36-b2f9-b5c1e7cf0fc3](https://my.papertrailapp.com/systems/mcj-klaxon/events?q=%220441789c-5a16-4c36-b2f9-b5c1e7cf0fc3%22&focus=1450553367931883571&selected=1450553367931883571) fwd="[50.86.97.58](https://my.papertrailapp.com/systems/mcj-klaxon/events?q=%2250.86.97.58%22&focus=1450553367931883571&selected=1450553367931883571)" dyno=web.1 connect=0ms service=85ms status=500 bytes=1724 protocol=https
So it looks as if your database was not properly created. I'm not sure why, presumably related to the failed initial deployment. If you're comfortable on the command line, I recommend downloading the heroku cli and running a few commands. Try this:
heroku run rake db:create
and then heroku run bash ./postdeploy.sh
. You may need to append --app <your-app-name>
if you've got more than one heroku app.
Hope that helps! You could also try just starting over with a fresh deployment, and see if it succeeds on the first try this time.
That solved it! Well, for some reason heroku run rake db:create -a mcc-klaxon
resulted in an error ("User does not have CONNECT privilege"), but heroku rake db:schema:load -a mcj-klaxon
did the trick.
but now my admin and collaborator emails don't work. I'm sorry this is such a mess. Idk what I did wrong.
Yea db:schema:load
wipes out all the data, so that would have nuked your user account too.
Did you run the postdeploy.sh
command? Part of that is running rake users:create_admin
, which ensures that the admin user exists. It runs on every deploy, so you could always just trigger a fresh deploy too. Or just heroku run bash ./postdeploy.sh
, or heroku run rake users:create_admin
.
It's still not working. Here's my command line input and output:
14:58 ~ $ heroku rake db:schema:load -a mcj-klaxon DISABLE_DATABASE_ENVIRONMENT_CHECK=1
Running rake db:schema:load DISABLE_DATABASE_ENVIRONMENT_CHECK=1 on ⬢ mcj-klaxon... up, run.4012 (Free)
DEPRECATION WARNING: Including LoggerSilence is deprecated and will be removed in Rails 6.1. Please use `ActiveSupport::LoggerSilence` instead (called from <top (required)> at /app/config/application.rb:16)
AppSetting Exists? (8.7ms) SELECT 1 AS one FROM "app_settings" WHERE "app_settings"."key" = $1 LIMIT $2 [["key", "default_host"], ["LIMIT", 1]]
AppSetting Load (3.9ms) SELECT "app_settings".* FROM "app_settings" WHERE "app_settings"."key" = $1 LIMIT $2 [["key", "default_host"], ["LIMIT", 1]]
[SUCCESS] Setting default_url_options[:host] = 'mcj-klaxon.herokuapp.com'
SQL (7.9ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
(52.7ms) DROP TABLE IF EXISTS "app_settings" CASCADE
(44.4ms) CREATE TABLE "app_settings" ("id" serial NOT NULL PRIMARY KEY, "key" character varying, "value" text, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
(5.5ms) CREATE INDEX "index_app_settings_on_key" ON "app_settings" ("key")
(10.1ms) DROP TABLE IF EXISTS "changes" CASCADE
(10.7ms) CREATE TABLE "changes" ("id" serial NOT NULL PRIMARY KEY, "before_id" integer, "before_type" character varying, "after_id" integer, "after_type" character varying, "summary" text, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
(11.8ms) CREATE INDEX "index_changes_on_after_id" ON "changes" ("after_id")
(7.9ms) CREATE INDEX "index_changes_on_after_type" ON "changes" ("after_type")
(6.0ms) CREATE INDEX "index_changes_on_before_id" ON "changes" ("before_id")
(7.9ms) CREATE INDEX "index_changes_on_before_type" ON "changes" ("before_type")
(12.2ms) DROP TABLE IF EXISTS "page_snapshots" CASCADE
(18.7ms) CREATE TABLE "page_snapshots" ("id" serial NOT NULL PRIMARY KEY, "page_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "sha2_hash" character varying, "html" text, "text" character varying)
(8.4ms) CREATE INDEX "index_page_snapshots_on_page_id" ON "page_snapshots" ("page_id")
(9.8ms) CREATE INDEX "index_page_snapshots_on_sha2_hash" ON "page_snapshots" ("sha2_hash")
(9.0ms) DROP TABLE IF EXISTS "pages" CASCADE
(10.1ms) CREATE TABLE "pages" ("id" serial NOT NULL PRIMARY KEY, "name" text, "url" text, "css_selector" text, "user_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "exclude_selector" character varying)
(9.0ms) CREATE INDEX "index_pages_on_user_id" ON "pages" ("user_id")
(15.3ms) DROP TABLE IF EXISTS "slack_integrations" CASCADE
(11.8ms) CREATE TABLE "slack_integrations" ("id" serial NOT NULL PRIMARY KEY, "channel" character varying, "webhook_url" text, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
(14.7ms) DROP TABLE IF EXISTS "sqs_integrations" CASCADE
(11.3ms) CREATE TABLE "sqs_integrations" ("id" serial NOT NULL PRIMARY KEY, "queue_url" text, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
(11.2ms) DROP TABLE IF EXISTS "subscriptions" CASCADE
(15.4ms) CREATE TABLE "subscriptions" ("id" serial NOT NULL PRIMARY KEY, "watcher_id" integer, "watcher_type" character varying, "watching_id" integer, "watching_type" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
(5.8ms) CREATE INDEX "index_subscriptions_on_watcher_id" ON "subscriptions" ("watcher_id")
(15.9ms) CREATE INDEX "index_subscriptions_on_watcher_type" ON "subscriptions" ("watcher_type")
(11.9ms) CREATE INDEX "index_subscriptions_on_watching_id" ON "subscriptions" ("watching_id")
(7.9ms) CREATE INDEX "index_subscriptions_on_watching_type" ON "subscriptions" ("watching_type")
(19.3ms) DROP TABLE IF EXISTS "users" CASCADE
(15.4ms) CREATE TABLE "users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying, "last_name" character varying, "email" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "is_admin" boolean)
(7.9ms) CREATE INDEX "index_users_on_email" ON "users" ("email")
(7.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
ActiveRecord::InternalMetadata Load (3.9ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
ActiveRecord::InternalMetadata Load (1.9ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
ActiveRecord::InternalMetadata Load (3.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "schema_sha1"], ["LIMIT", 1]]
14:59 ~ $ heroku run bash ./postdeploy.sh -a mcj-klaxon
Running bash ./postdeploy.sh on ⬢ mcj-klaxon... up, run.4550 (Free)
DEPRECATION WARNING: Including LoggerSilence is deprecated and will be removed in Rails 6.1. Please use `ActiveSupport::LoggerSilence` instead (called from <top (required)> at /app/config/application.rb:16)
AppSetting Exists? (3.8ms) SELECT 1 AS one FROM "app_settings" WHERE "app_settings"."key" = $1 LIMIT $2 [["key", "default_host"], ["LIMIT", 1]]
(4.0ms) SELECT pg_try_advisory_lock(6479319469857567795)
(2.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
ActiveRecord::InternalMetadata Load (3.9ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
(13.3ms) SELECT pg_advisory_unlock(6479319469857567795)
DEPRECATION WARNING: Including LoggerSilence is deprecated and will be removed in Rails 6.1. Please use `ActiveSupport::LoggerSilence` instead (called from <top (required)> at /app/config/application.rb:16)
AppSetting Exists? (6.2ms) SELECT 1 AS one FROM "app_settings" WHERE "app_settings"."key" = $1 LIMIT $2 [["key", "default_host"], ["LIMIT", 1]]
postdeploy.sh done
15:00 ~ $ https://mcj-klaxon.herokuapp.com/
15:01 ~ $ heroku run rake users:create_admin -a mcj-klaxon
Running rake users:create_admin on ⬢ mcj-klaxon... up, run.6881 (Free)
DEPRECATION WARNING: Including LoggerSilence is deprecated and will be removed in Rails 6.1. Please use `ActiveSupport::LoggerSilence` instead (called from <top (required)> at /app/config/application.rb:16)
AppSetting Exists? (2.2ms) SELECT 1 AS one FROM "app_settings" WHERE "app_settings"."key" = $1 LIMIT $2 [["key", "default_host"], ["LIMIT", 1]]
AppSetting Load (0.9ms) SELECT "app_settings".* FROM "app_settings" WHERE "app_settings"."key" = $1 LIMIT $2 [["key", "default_host"], ["LIMIT", 1]]
[SUCCESS] Setting default_url_options[:host] = 'mcj-klaxon.herokuapp.com'
15:01 ~ $ heroku restart
› Error: Missing required flag:
› -a, --app APP app to run command against
› See more help with --help
15:16 ~ $ heroku restart -a mcj-klaxon
Restarting dynos on ⬢ mcj-klaxon... done
15:16 ~ $
Hi all. With the recent release of Klaxon Cloud, we're going back and revisiting old issues that we're not going to pursue or support as we consider any future development of the original standalone Klaxon. This one (almost 2 years old now) falls in that bucket. Thanks for the contributions and discussions on this, but we'll close it as WONTFIX.
new user setting up on heroku. Just forked GitHub repo and connected it, but build fails.
Here's the build log: