#[SOLVED] Errors on Fresh install

1 messages · Page 1 of 1 (latest)

humble radish
#

Hi, I am new to appwrite, I tried to install it on multiple servers, including self-hosted, and digitalocean droplet.. after each fresh install, the docker container keeps generating those 2 errors continuosly:

Error 1:

appwrite  | [Error] URL: /v1/realtime
appwrite  | [Error] Type: Appwrite\Extend\Exception
appwrite  | [Error] Message: The requested route was not found. Please refer to the API docs and try again.
appwrite  | [Error] File: /usr/src/code/app/controllers/general.php
appwrite  | [Error] Line: 860

Error 2:

appwrite  | [Error] Method: GET
appwrite  | [Error] URL: /v1/account
appwrite  | [Error] Type: Appwrite\Extend\Exception
appwrite  | [Error] Message: User (role: guests) missing scope (account)
appwrite  | [Error] File: /usr/src/code/app/controllers/shared/api.php
appwrite  | [Error] Line: 272
humble radish
#

I tried to manually test this endpoint using this request

curl -H "X-Appwrite-Project: your_project_id" \
     -H "X-Appwrite-Key: your_api_key" \
     -H "Content-Type: application/json" \
     -X GET "http://cms.itexpertnow.com/v1/account"

and got this response:

{
    "message": "[email protected] (role: applications) missing scope (account)",
    "code": 401,
    "type": "general_unauthorized_scope",
    "version": "1.5.4"
}
humble radish
#

also the data on the website is not automatically updated, I have to refresh the page to get the new data... is this because of the realtime error? how to troubleshoot please

pliant wing
pliant wing
pliant wing
humble radish
#

more digging, I hope someone will be able to help... btw this issue is on fresh install...

docker logs -f appwrite

[Error] Method: 
[Error] URL: /v1/realtime
[Error] Type: Appwrite\Extend\Exception
[Error] Message: The requested route was not found. Please refer to the API docs and try again.
[Error] File: /usr/src/code/app/controllers/general.php
[Error] Line: 860

Browser console log:

sdk.alo1Ck00.js:1  WebSocket connection to 'wss://cms.itexpertnow.com/v1/realtime?project=console&channels%5B%5D=project&channels%5B%5D=console' failed: 
createSocket @ sdk.alo1Ck00.js:1
(anonymous) @ sdk.alo1Ck00.js:1
r @ 0.DelvZ7a0.js:33
0.DelvZ7a0.js:15  Realtime got disconnected. Reconnect will be attempted in 1 seconds. 
(anonymous) @ 0.DelvZ7a0.js:15
(anonymous) @ sdk.alo1Ck00.js:1
r @ 0.DelvZ7a0.js:33
pliant wing
humble radish
#

Appwrite is selfhosted and behind nginx reverse proxy:

Current config:

location ~ ^/.* {
    proxy_pass http://0.0.0.0:32790;
    proxy_set_header Host              $host;
    proxy_set_header X-Real-IP         $remote_addr;
    proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Upgrade $http_upgrade;
    proxy_http_version 1.1;
}
pliant wing
elfin marsh
humble radish
#

I am running selfhosted appwrite behind nginx:

$:/home/appwrite# docker port appwrite-traefik
80/tcp -> 0.0.0.0:32080
80/tcp -> [::]:32080
443/tcp -> 0.0.0.0:32443
443/tcp -> [::]:32443

working:
wss://cms.itexpertnow.com:32443/v1/realtime?project=console&channels%5B%5D=project&channels%5B%5D=console

not working:
wss://cms.itexpertnow.com/v1/realtime?project=console&channels%5B%5D=project&channels%5B%5D=console

Nginx config:

location ~ ^/.* {
    proxy_pass http://0.0.0.0:32790;
    proxy_set_header Host              $host;
    proxy_set_header X-Real-IP         $remote_addr;
    proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Upgrade $http_upgrade;
    proxy_http_version 1.1;
}

location /v1/realtime {
    proxy_pass http://0.0.0.0:32443;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_read_timeout 600s;
    proxy_send_timeout 600s;
}

docker config:

  traefik:
    image: traefik:2.11
    container_name: appwrite-traefik
    <<: *x-logging
    command:
      - --providers.file.directory=/storage/config
      - --providers.file.watch=true
      - --providers.docker=true
      - --providers.docker.exposedByDefault=false
      - --providers.docker.constraints=Label(`traefik.constraint-label-stack`,`appwrite`)
      - --entrypoints.appwrite_web.address=:80
      - --entrypoints.appwrite_websecure.address=:443
    restart: unless-stopped
    ports:
      - 32080:80
      - 32443:443
pliant wing
humble radish
#

nginx > appwrite-traefik
32080 >> redirected you too many times
32443 >> 404 page not found

nginx > appwrite
32790 >> working but websocket is not working

pliant wing
humble radish
#

got it, I am working on it! ... how can I store the appwrite data in a different location? including the database, functions, cache and everything

pliant wing
humble radish
#

I changed all volumes and customized the yml file... but I am worried in case of update/upgrade, the new script will overwrite this config. That's why wanted to ask for the best practice... also in terms of live update, I mean when I create a document, is it possible to show the updated automatically on the web interface without having to refresh the page? I thought that was missing because of the realtime was not working..

#

After four challenging nights, I've finally succeeded in getting everything to work perfectly in my environment. To give back to the open-source community that has provided me with so much, I would like to create a detailed guide or tutorial detailing my journey and the solution. My setup, which I found to be quite complex, involves a VPS, Cloudflare, Plesk Server, and an Nginx reverse proxy. Where could I publish this guide to benefit others facing similar challenges? Finally, a very special thanks to you @pliant wing and @elfin marsh

pliant wing
pliant wing
elfin marsh