A user reports an issue with logging in as an admin on a Vagrant-based Discourse installation, encountering a 500 error due to an undefined method username for nil:NilClass. The logs indicate a missing system user, prompting a suggestion to run rake db:migrate. However, this results in a LoadError related to the Version constant, likely due to a gem or environment issue. Another user notes the same error occurs outside of Vagrant, and a fix is identified in a recent commit 0e656ff. The original user confirms the fix resolves the issue. The discussion also clarifies that the Vagrant setup is for development, not production, and the user’s goal is to modify default templates for local testing. almonetgxworldalmonetgxworldalmonetgxworldalmonetgxworldtgxworldalmone
I’m having an issue with logging in as admin user.
I made a clean Vagrant install according to this guide.
Now when I try to log in I’m getting 500 Internal Server Error.
Here are log records:
I, [2017-08-16T13:50:13.258735 #14047] INFO -- : Started GET "/" for 10.0.2.2 at 2017-08-16 13:50:13 -0400
D, [2017-08-16T13:50:14.494951 #14047] DEBUG -- : UserAuthToken Load (1.5ms) SELECT "user_auth_tokens".* FROM "user_auth_tokens" WHERE ((auth_token = 'St0sllamsnLV2NjCPEschUDeDzQ=' OR
prev_auth_token = 'St0sllamsnLV2NjCPEschUDeDzQ=' OR
(auth_token = '4716df97e4a99a37b3d9b8a8f34af626' AND legacy)) AND rotated_at > '2017-06-17 17:50:14.492802') LIMIT 1
D, [2017-08-16T13:50:14.505749 #14047] DEBUG -- : User Load (2.7ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1 [["id", 1]]
I, [2017-08-16T13:50:14.510414 #14047] INFO -- : Processing by ListController#latest as HTML
D, [2017-08-16T13:50:14.527868 #14047] DEBUG -- : UserOption Load (1.0ms) SELECT "user_options".* FROM "user_options" WHERE "user_options"."user_id" = 1 LIMIT 1 [["user_id", 1]]
D, [2017-08-16T13:50:14.534377 #14047] DEBUG -- : UserVisit Load (1.3ms) SELECT "user_visits".* FROM "user_visits" WHERE "user_visits"."user_id" = 1 AND "user_visits"."visited_at" = '2017-08-16' LIMIT 1 [["user_id", 1], ["visited_at", Wed, 16 Aug 2017]]
D, [2017-08-16T13:50:14.553588 #14047] DEBUG -- : SQL (3.5ms) UPDATE "users" SET "last_seen_at" = '2017-08-16 17:50:14.509563' WHERE "users"."id" = 1 [["id", 1]]
D, [2017-08-16T13:50:14.560300 #14047] DEBUG -- : (3.9ms) SELECT categories.id FROM "categories" LEFT OUTER JOIN "uploads" ON "uploads"."id" = "categories"."uploaded_logo_id" LEFT OUTER JOIN "uploads" "uploaded_backgrounds_categories" ON "uploaded_backgrounds_categories"."id" = "categories"."uploaded_background_id" WHERE "categories"."read_restricted" = 't' [["read_restricted", true]]
D, [2017-08-16T13:50:14.569177 #14047] DEBUG -- : Category Load (4.5ms) SELECT categories.*, t.slug topic_slug FROM "categories" LEFT JOIN topics t on t.id = categories.topic_id WHERE (NOT categories.read_restricted OR categories.id IN (2,3,4)) ORDER BY "categories"."position" ASC
D, [2017-08-16T13:50:14.580481 #14047] DEBUG -- : (0.9ms) SELECT "category_users"."category_id", "category_users"."notification_level" FROM "category_users" WHERE "category_users"."user_id" = 1
D, [2017-08-16T13:50:14.585194 #14047] DEBUG -- : (1.4ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "topics" WHERE ("topics"."deleted_at" IS NULL) LIMIT 16) subquery_for_count
D, [2017-08-16T13:50:14.591761 #14047] DEBUG -- : (1.6ms) SELECT "users"."id" FROM "users" INNER JOIN "user_auth_tokens" ON "user_auth_tokens"."user_id" = "users"."id" WHERE "users"."admin" = 't' AND (users.id > 0) ORDER BY user_auth_tokens.created_at [["admin", true]]
D, [2017-08-16T13:50:14.597011 #14047] DEBUG -- : Topic Load (1.5ms) SELECT "topics".* FROM "topics" WHERE ("topics"."deleted_at" IS NULL) AND "topics"."slug" = 'welcome-to-discourse' ORDER BY "topics"."id" ASC LIMIT 1 [["slug", "welcome-to-discourse"]]
D, [2017-08-16T13:50:14.602911 #14047] DEBUG -- : User Load (1.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = -1 LIMIT 1 [["id", -1]]
D, [2017-08-16T13:50:14.608340 #14047] DEBUG -- : CACHE (0.0ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "topics" WHERE ("topics"."deleted_at" IS NULL) LIMIT 16) subquery_for_count
D, [2017-08-16T13:50:14.613361 #14047] DEBUG -- : (1.8ms) SELECT "users"."id" FROM "users" INNER JOIN "user_auth_tokens" ON "user_auth_tokens"."user_id" = "users"."id" WHERE "users"."admin" = 't' AND (users.id > 0) ORDER BY user_auth_tokens.created_at [["admin", true]]
D, [2017-08-16T13:50:14.616927 #14047] DEBUG -- : CACHE (0.0ms) SELECT "topics".* FROM "topics" WHERE ("topics"."deleted_at" IS NULL) AND "topics"."slug" = 'welcome-to-discourse' ORDER BY "topics"."id" ASC LIMIT 1 [["slug", "welcome-to-discourse"]]
D, [2017-08-16T13:50:14.620538 #14047] DEBUG -- : CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = -1 LIMIT 1 [["id", -1]]
I, [2017-08-16T13:50:14.624538 #14047] INFO -- : Completed 500 Internal Server Error in 101ms (ActiveRecord: 26.5ms)
I, [2017-08-16T13:50:14.744330 #14047] INFO -- : Rendered /home.rvm/gems/ruby-2.3.1/gems/actionpack-4.2.9/lib/action_dispatch/middleware/templates/rescues/_source.erb (9.6ms)
I, [2017-08-16T13:50:14.755912 #14047] INFO -- : Rendered /home.rvm/gems/ruby-2.3.1/gems/actionpack-4.2.9/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (6.0ms)
I, [2017-08-16T13:50:14.765246 #14047] INFO -- : Rendered /home.rvm/gems/ruby-2.3.1/gems/actionpack-4.2.9/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (2.5ms)
I, [2017-08-16T13:50:14.769481 #14047] INFO -- : Rendered /home.rvm/gems/ruby-2.3.1/gems/actionpack-4.2.9/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (38.0ms)
I’m not going to use it on production. I’m trying to install in on my local dev server. The reason is what I want to make some changes to default template. For example I want best authors (most liked) to be shown on front page. Right now I have no idea how to do this. I think it would be easier to understand how template works on dev environment. But that’s another story…
Ic. I got confused when mention the Docker based install which I took as you’re trying to get your production Discourse up and running. I’m personally don’t use Vagrant in development so you’ll have to wait for someone else that does.