Skip to content

bug: Client Crash Report after installation #148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jakewelliott opened this issue May 9, 2025 · 12 comments
Open

bug: Client Crash Report after installation #148

jakewelliott opened this issue May 9, 2025 · 12 comments
Labels
bug Something isn't working

Comments

@jakewelliott
Copy link

What happened?

I have the entire system setup on my Unraid server. I had to work around a couple version issues but finally got everything to a point where all containers would start and were healthy. I have my NGINX proxy pointing to Caddy and updated the toml and env files as described in the readme. Cloudflare DNS is set up to proxy it so that I get HTTPS connections. When I visit the domain, I get a "Client Crash Report" which is clearly something created by Revolt. The stack trace makes no sense to me. I visited the Sources tab in my dev tools and looked at the two files mentioned. Most of the column numbers are not even valid column numbers, there is one line that is part of the stack trace which is just a variable declaration (not even being initialized), the function names don't match with the line mentioned, as well as other random issues. Below is a look at the stack trace but I have removed all instances of my domain. For instance, if it was running on subdomain.domain.tld then that entire block was replaced with {my domain}. I think it is important to note that I did use Postman to make a GET request to https://{my domain}/api and got back a 200 ok response with some details about Revolt. So clearly my api is working and the frontend is too since this Revolt page is appearing, leading me to believe that the issue is not with any of the proxying that is going on but rather something else under the hood. Could anyone provide any insight into what is going on as well as how to fix it? I have a little bit of experience with this but not ever a stack trace that didn't match up with the code like this so don't even understand what the issue is. If more information is needed, I would be happy to provide; I just don't know where the issue could even be so what relevant pieces of information might be needed to troubleshoot this.

@https://{my domain}/assets/Login.c46a8a30.js:1:12504
@https://{my domain}/assets/main.08ce25a6.js:134:50452
trackDerivedFunction$1@https://{my domain}/assets/main.08ce25a6.js:114:20020
@https://{my domain}/assets/main.08ce25a6.js:114:26644
useObserver@https://{my domain}/assets/main.08ce25a6.js:134:50431
j$6@https://{my domain}/assets/main.08ce25a6.js:1:7698
w$8@https://{my domain}/assets/main.08ce25a6.js:1:3465
j$6@https://{my domain}/assets/main.08ce25a6.js:1:7955
w$8@https://{my domain}/assets/main.08ce25a6.js:1:3465
j$6@https://{my domain}/assets/main.08ce25a6.js:1:7955
w$8@https://{my domain}/assets/main.08ce25a6.js:1:3465
j$6@https://{my domain}/assets/main.08ce25a6.js:1:7955
w$8@https://{my domain}/assets/main.08ce25a6.js:1:3465
j$6@https://{my domain}/assets/main.08ce25a6.js:1:7955
w$8@https://{my domain}/assets/main.08ce25a6.js:1:3465
j$6@https://{my domain}/assets/main.08ce25a6.js:1:7955
w$8@https://{my domain}/assets/main.08ce25a6.js:1:3465
j$6@https://{my domain}/assets/main.08ce25a6.js:1:7955
w$8@https://{my domain}/assets/main.08ce25a6.js:1:3465
j$6@https://{my domain}/assets/main.08ce25a6.js:1:7955
w$8@https://{my domain}/assets/main.08ce25a6.js:1:3465
L$5@https://{my domain}/assets/main.08ce25a6.js:1:9348
j$6@https://{my domain}/assets/main.08ce25a6.js:1:8169
w$8@https://{my domain}/assets/main.08ce25a6.js:1:3465
L$5@https://{my domain}/assets/main.08ce25a6.js:1:9348
j$6@https://{my domain}/assets/main.08ce25a6.js:1:8169
w$8@https://{my domain}/assets/main.08ce25a6.js:1:3465
L$5@https://{my domain}/assets/main.08ce25a6.js:1:9348
j$6@https://{my domain}/assets/main.08ce25a6.js:1:8169
w$8@https://{my domain}/assets/main.08ce25a6.js:1:3465
j$6@https://{my domain}/assets/main.08ce25a6.js:1:7955
w$8@https://{my domain}/assets/main.08ce25a6.js:1:3465
j$6@https://{my domain}/assets/main.08ce25a6.js:1:7955
w$8@https://{my domain}/assets/main.08ce25a6.js:1:3465
j$6@https://{my domain}/assets/main.08ce25a6.js:1:7955
w$8@https://{my domain}/assets/main.08ce25a6.js:1:3465
j$6@https://{my domain}/assets/main.08ce25a6.js:1:7955
w$8@https://{my domain}/assets/main.08ce25a6.js:1:3465
j$6@https://{my domain}/assets/main.08ce25a6.js:1:7955
@https://{my domain}/assets/main.08ce25a6.js:1:2717
some@[native code]
g$7@https://{my domain}/assets/main.08ce25a6.js:1:2596

@jakewelliott jakewelliott added the bug Something isn't working label May 9, 2025
@github-project-automation github-project-automation bot moved this to 🆕 Untriaged in Revolt Project May 9, 2025
@Docteh
Copy link

Docteh commented May 10, 2025

First thing I'd check is if the URLs mentioned in /api are correct.

"ws": "wss://subdomain.domain.tld/ws",

Oh, are you getting an error just getting the first page, not asking for either a login or to create a new account? hmm.

@jakewelliott
Copy link
Author

@Docteh
I assume you're talking about when I make the GET request to the api endpoint. In which case, yes they are all correct and ws looks exactly like what you commented.
Yes, this error comes up before ever seeing any other pages. I can't even get to a login screen or anything.

@Docteh
Copy link

Docteh commented May 10, 2025

(in a code block otherwise I think a user named https gets a notification)
@https://{my domain}/assets/Login.c46a8a30.js:1:12504

looks like in that file they're trying to read the invite_only variable from somewhere, as a test I replaced the /api/ response with something else on mine and I get the following

Revolt has crashed. Here's the error:

TypeError: Cannot read properties of undefined (reading 'invite_only')
    at https://{my thing}/assets/Login.c46a8e30.js:1:12505

In the browser dev tools, look at the response the front end is getting when it hits the api

Maybe throw the json stuff at a json validator? but invite_only should be either true or false

@insertish
Copy link
Member

I've come to associate the invite_only error with a web server configuration error serving non-JSON data where JSON should be. Can you inspect network requests and see what the exact response is for the root API route?

@jakewelliott
Copy link
Author

@insertish @Docteh
The frontend never even contacts the backend. The only request it makes is to https://reporting.revolt.chat/ in order to report the failure, which fails due to origin issues.

@jakewelliott
Copy link
Author

I moved it to a different domain temporarily to assist with troubleshooting. You can see the error for yourself if you go to https://chat.jakee.dev/

@jakewelliott
Copy link
Author

Here are some of my configuration files:

Revolt.toml (keys removed for security purposes)

[hosts]
app = "https://chat.jakee.dev"
api = "https://chat.jakee.dev/api"
events = "wss://chat.jakee.dev/ws"
autumn = "https://chat.jakee.dev/autumn"
january = "https://chat.jakee.dev/january"

[pushd.vapid]
private_key = ""
public_key = ""

[files]
encryption_key = ""

[sentry]
# Configuration for Sentry error reporting
api = ""
events = ""
files = ""
proxy = ""

Caddyfile

:80 {
        route /api* {
                uri strip_prefix /api
                reverse_proxy http://api:14702
        }

        route /ws {
                uri strip_prefix /ws
                reverse_proxy http://events:14703
        }

        route /autumn* {
                uri strip_prefix /autumn
                reverse_proxy http://autumn:14704
        }

        route /january* {
                uri strip_prefix /january
                reverse_proxy http://january:14705
        }

        reverse_proxy http://web:5000
}

.env.web

HOSTNAME=:80
REVOLT_PUBLIC_URL=https://chat.jakee.dev
REVOLT_APP_URL=https://chat.jakee.dev
VITE_API_URL=https://chat.jakee.dev/api
REVOLT_EXTERNAL_WS_URL=wss://chat.jakee.dev/ws
AUTUMN_PUBLIC_URL=https://chat.jakee.dev/autumn
JANUARY_PUBLIC_URLhttps://chat.jakee.dev/january

docker-compose.yaml

name: skylinkk

services:
  # MongoDB: Database
  database:
    image: mongo:4.4
    env_file: .env
    restart: always
    volumes:
      - ${DATA_LOCATION}/data/db:/data/db
    healthcheck:
      test: echo 'db.runCommand("ping").ok' | mongo localhost:27017/test --quiet
      interval: 10s
      timeout: 10s
      retries: 5
      start_period: 10s

  # Redis: Event message broker & KV store
  redis:
    image: eqalpha/keydb:x86_64_v6.3.3
    restart: always
    
  rabbit:
    image: docker.io/rabbitmq:4
    restart: always
    environment:
      RABBITMQ_DEFAULT_USER: rabbituser
      RABBITMQ_DEFAULT_PASS: rabbitpass
    volumes:
      - ${DATA_LOCATION}/data/rabbit:/var/lib/rabbitmq
    healthcheck:
      test: rabbitmq-diagnostics -q ping
      interval: 10s
      timeout: 10s
      retries: 3
      start_period: 20s
      
  # MinIO: S3-compatible storage server
  minio:
    image: minio/minio
    command: server /data
    volumes:
      - ${DATA_LOCATION}/data/minio:/data
    environment:
      MINIO_ROOT_USER: minioautumn
      MINIO_ROOT_PASSWORD: minioautumn
      MINIO_DOMAIN: minio
    networks:
      default:
        aliases:
          - revolt-uploads.minio
          # legacy support:
          - attachments.minio
          - avatars.minio
          - backgrounds.minio
          - icons.minio
          - banners.minio
          - emojis.minio
    restart: always
    ports:
      - "$MINIO_PORT:9000"
    
  # Caddy: Web server
  caddy:
    image: caddy
    restart: always
    env_file: ${DATA_LOCATION}/.env.web
    ports:
      - "4480:80"
      - "4443:443"
    volumes:
      - ${DATA_LOCATION}/Caddyfile:/etc/caddy/Caddyfile
      - ${DATA_LOCATION}/data/caddy:/data
      - ${DATA_LOCATION}/config/caddy:/config
  
  # API server
  api:
    image: ghcr.io/revoltchat/server:20250210-1
    depends_on:
      database:
        condition: service_healthy
      redis:
        condition: service_started
      rabbit:
        condition: service_healthy
    volumes:
      - type: bind
        source: ${DATA_LOCATION}/Revolt.toml
        target: /Revolt.toml
    ports:
      - "$REVOLT_API_PORT:14702"
      - "$REVOLT_API_WS_PORT:14703"
    restart: always
  
  # Events service
  events:
    image: ghcr.io/revoltchat/bonfire:20250210-1
    depends_on:
      database:
        condition: service_healthy
      redis:
        condition: service_started
    volumes:
      - type: bind
        source: ${DATA_LOCATION}/Revolt.toml
        target: /Revolt.toml

  # Web App
  web:
    image: ghcr.io/revoltchat/client:master
    env_file: ${DATA_LOCATION}/.env.web
    ports:
      - "$REVOLT_APP_PORT:5000"
    restart: always

  # Create buckets for minio.
  createbuckets:
    image: minio/mc
    depends_on:
      - minio
    entrypoint: >
      /bin/sh -c "
      while ! /usr/bin/mc ready minio; do
        /usr/bin/mc config host add minio http://192.168.86.78:9000 minioautumn minioautumn;
        echo 'Waiting minio...' && sleep 1;
      done;
      /usr/bin/mc mb minio/revolt-uploads;
      exit 0;
      "

  # File server
  autumn:
    image: revoltchat/autumn:20250210-1
    depends_on:
      database:
        condition: service_healthy
      createbuckets:
        condition: service_started
    volumes:
      - type: bind
        source: ${DATA_LOCATION}/Revolt.toml
        target: /Revolt.toml
    ports:
      - "$AUTUMN_PORT:14704"
    restart: always

  # Metadata and image proxy
  january:
    image: ghcr.io/revoltchat/january:20250210-1
    volumes:
      - type: bind
        source: ${DATA_LOCATION}/Revolt.toml
        target: /Revolt.toml
    ports:
      - "$JANUARY_PORT:14705"
    restart: always

  # Regular task daemon
  crond:
    image: ghcr.io/revoltchat/crond:20250210-1-debug
    depends_on:
      database:
        condition: service_healthy
      minio:
        condition: service_started
    volumes:
      - type: bind
        source: ${DATA_LOCATION}/Revolt.toml
        target: /Revolt.toml
    restart: always

  # Push notification daemon
  pushd:
    image: ghcr.io/revoltchat/pushd:20250210-1
    depends_on:
      database:
        condition: service_healthy
      redis:
        condition: service_started
      rabbit:
        condition: service_healthy
    volumes:
      - type: bind
        source: ${DATA_LOCATION}/Revolt.toml
        target: /Revolt.toml
    restart: always

@Docteh
Copy link

Docteh commented May 13, 2025

from revites inject.js, a script that runs in the web container

let target = /__API_URL__/g;
let replacement = process.env.REVOLT_PUBLIC_URL;

#!/usr/bin/env bash
# set hostname for Caddy
echo "HOSTNAME=https://$1" > .env.web
echo "REVOLT_PUBLIC_URL=https://$1/api" >> .env.web

Your .env.web has

REVOLT_PUBLIC_URL=https://chat.jakee.dev

slap /api on the end of that REVOLT_PUBLIC_URL, and then likely need to compose down/up the web container rather than just a restart.

docker compose down web && docker compose up web -d

Separately, I'm not sure if your port assignments in your Docker compose.yml matter, but

    - "$REVOLT_API_WS_PORT:14703"

The websocket is actually handled by events, which is one down from api

Also I tried manually going to https://chat.jakee.dev/api just cause and got a gateway error from cloudflare

@jakewelliott
Copy link
Author

I will update those two things later and will update the status. In the meantime, I wanted to mention the following:
In the README under the section for custom domains, the instructions say to remove the /api in the TOML file. If changing this fixes the issue, the README must be incorrect.

@jakewelliott
Copy link
Author

And regarding the Cloudflare issue: I tried changing something earlier and had to docker compose down and back up to update it and see if it made a difference. My assumption is that was what caused the issue for you; you had attempted to navigate to it while it was going down/back up. I just verified and it is working right now

@Docteh
Copy link

Docteh commented May 13, 2025

Ohhh, okay. I followed their VPS instructions further above which had me run generate_config.sh instead of editing a bunch of files

I guess I'll file a PR for the readme.


Now, we can pull in the configuration for Revolt:

git clone https://github.com/revoltchat/self-hosted revolt
cd revolt

Generate a configuration file by running:

chmod +x ./generate_config.sh
./generate_config.sh your.domain

@Docteh
Copy link

Docteh commented May 13, 2025

There, #151 is filed to edit the README

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 🆕 Untriaged
Development

No branches or pull requests

3 participants