Stumped about ./launcher rebuild app error (Process::Status: pid 2096)

Today upon ./launcher rebuild app command (for no reason I could find) I get this error (also, this is after I have disabled all plugins in the app.yml file)… I would sure appreciate any help with this!

error-log_2024-10-31_1.txt (44.1 KB)

ending with…

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 2096 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"cd"=>"$home", "tag"=>"migrate", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP **
1 Like

The relevant part of the log is

undefined method `+' for nil
/var/www/discourse/db/migrate/20241025045928_add_invites_link_to_sidebar.rb:44:in `up'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4.2/lib/active_record/migration.rb:989:in `public_send'

So it seems related to FEATURE: Add invite link to the sidebar (#29448) · discourse/discourse@19672fa · GitHub (cc @osama)

4 Likes

Thanks much (and for the explanation), I saw that too, and wondered if it was that!

1 Like

@denvergeeks I’m going to fix the migration, but I’m a bit curious about how your site got into this state. What does the sidebar look like in your site? Have you deleted all links in the default sidebar from the database?

Sure – I don’t have a screenshot of the sidebar or the site, but nothing is modified except adding some basic menu items in the more…

It’s just one of my (non-public) personal research Discourse instances so I could help debug if you tell me what you want me to do in the command line. (I have my own dedicated server if it helps.)

1 Like

Can you tell me what the following queries output in your database?

SELECT id FROM sidebar_sections WHERE section_type = 0;
SELECT linkable_type, linkable_id, position FROM sidebar_section_links WHERE sidebar_section_id IN (SELECT id FROM sidebar_sections WHERE section_type = 0);
SELECT id, segment FROM sidebar_urls WHERE id IN (SELECT linkable_id FROM sidebar_section_links WHERE sidebar_section_id IN (SELECT id FROM sidebar_sections WHERE section_type = 0));

I sure can - could you please provide the commands from the start/prompt? (I am root user)

1 Like

I can’t tell the exact command(s) off of the top of my head, but I’ve looked around here in Meta and I think these will work:

./launcher enter app
su postgres
psql

After the psql command, you should be able to paste the queries and run them to see their results. Let me know if the commands don’t work.

root@JEN /var/discourse # ./launcher enter app101
su postgres
psql
x86_64 arch detected.
Error response from daemon: container 8ee36bdfa85b786ea149e6714f65048e136091fe31be2f5425be5fe04a852729 is not running
su: user postgres does not exist or the user entry does not contain all the required fields
Command 'psql' not found, but can be installed with:
apt install postgresql-client-common

Hmm it looks like your container is not running. Is your site down at the moment? Try:

./launcher start app101
root@JEN /var/discourse # ./launcher start app101
x86_64 arch detected.

starting up existing container
+ /usr/bin/docker start app101
app101
root@JEN /var/discourse # ./launcher enter app101
su postgres
psql
x86_64 arch detected.
root@JEN-app101:/var/www/discourse# SELECT id FROM sidebar_sections WHERE section_type = 0;
bash: SELECT: command not found
root@JEN-app101:/var/www/discourse#

Site is started and here is the sidebar and …more items

1 Like

Ok, it makes sense now. The migration expects at least 1 link outside ... more, but you have none so it blows up. I’ll update the migration so it accounts for this case.

2 Likes

I got the same error (and stopped container) on one of my other sites as well. (But not on some other sites.)

Edit: Yes so that one other site (where I found the same behavior) also has no link outside the ... more

So are we done?

The image is a blurry, low-resolution photograph of a young child's face, with the child looking directly at the camera and smiling. (Captioned by AI)

Sorry @denvergeeks, something personal urgent came up and I had to go AFK for a couple of hours. I’ve prepared a PR with a fix:

I’ll let you know when it’s merged and hits tests-passed.

3 Likes

@denvergeeks, the fix has made it to the tests-passed branch. If you rebuild again now it should succeed.

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.