שגיאת בנייה: אין הרשאה ליצור את ההרחבה "vector"

סיכום מבוסס בינה מלאכותית

yaxu encountered a build error while rebuilding their multisite Discourse install, specifically a “permission denied to create extension ‘vector’” error in PostgreSQL 15.13. Despite running as root and disabling plugins, the issue persisted. NateDhaliwal confirmed they were running as root, which yaxu affirmed. The problem was resolved by manually entering the PostgreSQL container via ./launcher enter app, switching to the postgres user, and executing CREATE EXTENSION IF NOT EXISTS vector; for each site’s database after restarting Docker yaxu. The root cause was that the discourse database user lacked superuser privileges needed to install the vector extension.

שלום,

אני נתקל בבעיות בעת בנייה מחדש של התקנת ה-multisite discourse שלי. אני מקבל את השגיאות המודבקות למטה.

  • אני מריץ את הפקודה ./launcher rebuild app כ-root.
  • git status ב-/var/discourse אומר שאני מעודכן עם branch main.
  • הוא מדווח על הרצת postgres 15.13:
    2025-08-14 10:35:04.390 UTC [45] LOG: starting PostgreSQL 15.13 (Debian 15.13-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
  • השבתתי את כל התוספים מלבד docker_manager.

להלן השגיאות:

I, [2025-08-14T10:35:56.213949 #1]  INFO -- : > cd /var/www/discourse & cd /var/www/discourse && su discourse -c 'find /var/www/discourse/vendor/bundle -name cache -not -path "/gems/*" -type d -exec rm -rf {} +'
I, [2025-08-14T10:35:56.325831 #1]  INFO -- : 
I, [2025-08-14T10:35:56.325961 #1]  INFO -- : > cd /var/www/discourse & cd /var/www/discourse && su discourse -c 'find /var/www/discourse/vendor/bundle -name tmp -type d -exec rm -rf {} +'
I, [2025-08-14T10:35:56.430781 #1]  INFO -- : 
I, [2025-08-14T10:35:56.431139 #1]  INFO -- : > cd /var/www/discourse & cd /var/www/discourse && sudo -E -u discourse bundle exec rake multisite:migrate
`/root` is not writable.
Bundler will use `/tmp/bundler20250814-776-hjo98w776` as your home directory temporarily.
2025-08-14 10:36:05.626 UTC [872] discourse@b_discourse ERROR:  permission denied to create extension "vector"
2025-08-14 10:36:05.626 UTC [872] discourse@b_discourse HINT:  Must be superuser to create this extension.
2025-08-14 10:36:05.626 UTC [872] discourse@b_discourse STATEMENT:  CREATE EXTENSION IF NOT EXISTS "vector"
2025-08-14 10:36:05.627 UTC [872] discourse@b_discourse ERROR:  current transaction is aborted, commands ignored until end of transaction block
2025-08-14 10:36:05.627 UTC [872] discourse@b_discourse STATEMENT:  SELECT 1 FROM pg_available_extensions WHERE name = 'vector';
2025-08-14 10:36:05.753 UTC [873] discourse@c_discourse ERROR:  permission denied to create extension "vector"
2025-08-14 10:36:05.753 UTC [873] discourse@c_discourse HINT:  Must be superuser to create this extension.
2025-08-14 10:36:05.753 UTC [873] discourse@c_discourse STATEMENT:  CREATE EXTENSION IF NOT EXISTS "vector"
2025-08-14 10:36:05.753 UTC [873] discourse@c_discourse ERROR:  current transaction is aborted, commands ignored until end of transaction block
2025-08-14 10:36:05.753 UTC [873] discourse@c_discourse STATEMENT:  SELECT 1 FROM pg_available_extensions WHERE name = 'vector';
2025-08-14 10:36:05.870 UTC [874] discourse@d_discourse ERROR:  permission denied to create extension "vector"
2025-08-14 10:36:05.870 UTC [874] discourse@d_discourse HINT:  Must be superuser to create this extension.
2025-08-14 10:36:05.870 UTC [874] discourse@d_discourse STATEMENT:  CREATE EXTENSION IF NOT EXISTS "vector"
2025-08-14 10:36:05.870 UTC [874] discourse@d_discourse ERROR:  current transaction is aborted, commands ignored until end of transaction block
2025-08-14 10:36:05.870 UTC [874] discourse@d_discourse STATEMENT:  SELECT 1 FROM pg_available_extensions WHERE name = 'vector';

כל עזרה/הכוונה תתקבל בברכה רבה!

האם אתה עושה זאת כמשתמש root (הפעלת sudo -s לפני כן)?

שלום @NateDhaliwal , כן, אני פועל כ-root.

פתרתי את זה ב-Postgres (ראשית הייתי צריך להפעיל מחדש את Docker עם service restart docker)

./launcher enter app
sudo -u postgres psql

ואז הרצתי את זה עבור מסד הנתונים של כל אתר:

\c b_discourse
CREATE EXTENSION IF NOT EXISTS vector;