spacebarchat / spacebarchat/server
Creating Guild failing with Fermi
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.2k
- Forks
- 323
- Avg merge
- 14h 48m
- Merged PRs (30d)
- 4
Description
Describe the bug
When creating a guild on the self-hosted instance using the official web version of Fermi, the log shows an error and the guild is not created.
Real domain replaced with sub.domain.com where applicable.
To Reproduce
Steps to reproduce the behavior:
- Install the server with default SQLite config
- Run server with
/usr/bin/pnpm run startas a service using systemd - Go to https://fermi.chat/channels/@me and sign up & login on the Instance:
https://sub.domain.com - Create Guild with any regular name ("Test", "test", "GuildName", "Guild Name") with or without icon and hit submit
Expected behavior
The guild gets created
Console Logs
[Error] 400 /api/v9/guilds
TypeError: Cannot read properties of undefined (reading 'indexOf')
at arrayRemove (/var/www/vhosts/spacebar-server/src/util/util/extensions/Array.ts:36:25)
at Function.insertChannelInOrder (/var/www/vhosts/spacebar-server/src/util/entities/Guild.ts:423:20)
at Function.createGuild (/var/www/vhosts/spacebar-server/src/util/entities/Guild.ts:402:25)
at async <anonymous> (/var/www/vhosts/spacebar-server/src/api/routes/guilds/index.ts:55:23)
body: [Object: null prototype] { name: 'Test' }
System Information (please complete the following information):
- OS: Ubuntu
- Version: 24.04 LTS
- Node Version: v24.11.0
- Python 3 Version: 3.10.12
Env and Software info
- Release: 1.0.0 (according to package.json)
- Branch master
- Database: SQLite
- Reverse Proxy: apache2
- Thread Count: 1
Additional context
The API is reachable via https://sub.domain.com/api/v9/guilds and returns "code":401,"message":"Error: Missing Authorization Header","request":"GET /api/v9/guilds"} when opened in the browser.
The server runs on the default port of 3001, there is a reverse proxy in place with apache2 and SSL via letsencrypt:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName sub.domain.com
ProxyPreserveHost On
ProxyRequests Off
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://127.0.0.1:3001/$1 [P,L]
<Location />
ProxyPass http://127.0.0.1:3001/
ProxyPassReverse http://127.0.0.1:3001/
RequestHeader set X-Real-IP %{REMOTE_ADDR}s
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-For %{REMOTE_ADDR}s
RequestHeader set X-Forwarded-Host %{REMOTE_ADDR}s
Header set Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0"
Header set Last-Modified "expr=%{TIME}"
Header set Pragma "no-cache"
Header set Expires "0"
</Location>
ErrorLog ${APACHE_LOG_DIR}/bar_error.log
CustomLog ${APACHE_LOG_DIR}/bar_access.log combined
SSLCertificateFile /etc/letsencrypt/live/sub.domain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/sub.domain.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
Config values:
api_endpointPublic: "https://sub.domain.com/api/v9"
cdn_endpointPublic: "https://sub.domain.com"
cdn_endpointPrivate: "https://sub.domain.com"
gateway_endpointPublic: "wss://sub.domain.com"
general_frontPage: "https://sub.domain.com"
general_serverName: "https://sub.domain.com"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/util/entities/Guild.ts at createGuild and insertChannelInOrder, then inspect src/util/util/extensions/Array.ts at arrayRemove using the reported stack trace. Reproduce guild creation through POST /api/v9/guilds with the default SQLite configuration; done means a guild is created successfully without the TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100