Skip to content
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

Synapse-admin does not work by displaying an error #15

Open
Nalla22 opened this issue Mar 21, 2022 · 46 comments · Fixed by #19
Open

Synapse-admin does not work by displaying an error #15

Nalla22 opened this issue Mar 21, 2022 · 46 comments · Fixed by #19

Comments

@Nalla22
Copy link

Nalla22 commented Mar 21, 2022

The application has not been working for several weeks

Hello, I tried to use the application a month ago, and it displayed the message next error message :

error

I left it out hoping that it was going to be updated and the problem fixed, but unfortunately it presents still the same malfunction, with this error that is constantly displayed at launch.

Thank you for helping me to solve the problem.

@tio-trom
Copy link

Same here.

@wrapper
Copy link

wrapper commented May 30, 2022

+1

@lapineige
Copy link
Member

I wonder were we can find the relevant log…

@tio-trom
Copy link

I think they are already working on a solution for this, but it takes a long time to release it seems. See #13

@tio-trom
Copy link

tio-trom commented Sep 2, 2022

I think this kinda stalled :D - I hope they can fix it soon so we can properly manage synapse.

@lapineige
Copy link
Member

It depends on volunteer time and energy, so we will see :)

@tio-trom
Copy link

tio-trom commented Sep 3, 2022

It depends on volunteer time and energy, so we will see :)

Always much appreciation for such volunteer efforts!

@retiolus
Copy link

retiolus commented Nov 3, 2022

This is still an issue

@tio-trom
Copy link

tio-trom commented Nov 3, 2022

Yes same here. I have the latest Synapse and Synapse Admin packages installed.....

@ericgaspar ericgaspar reopened this Nov 3, 2022
@Gredin67
Copy link

@ericgaspar
isn't the problem simply that the YunoHost User used to connect to synapse_admin should be a synapse administrator (in matrix-synapse postgresql DB)?
If yes, we should:

@Gredin67
Copy link

@mx4k
Copy link

mx4k commented Jan 20, 2023

@wrapper
Copy link

wrapper commented Jan 24, 2023

see also https://github.com/YunoHost-Apps/synapse_ynh#administration-api

I'm not able to fix via this method either

@tituspijean
Copy link
Member

Current state of the app should be OK. Please reopen an issue if it arises.

@lapineige
Copy link
Member

lapineige commented Apr 20, 2023

It's not working for a fresh Synapse admin install and up-to-date Synapse. Admin API has visitors rights.
(we can't reopen btw)

@tituspijean tituspijean reopened this Apr 20, 2023
@tituspijean
Copy link
Member

Can you share logs from the browser console and the app service?

@lapineige
Copy link
Member

lapineige commented Apr 20, 2023

Browser console:

Blocage d’une requête multiorigine (Cross-Origin Request) : la politique « Same Origin » ne permet pas de consulter la ressource distante située sur https://matrix.domain.tld/_synapse/admin/v2/users?deactivated=false&dir=f&from=0&guests=true&limit=10&order_by=name. Raison : la redirection externe de requêtes CORS n’est pas autorisée.

Blocage d’une requête multiorigine (Cross-Origin Request) : la politique « Same Origin » ne permet pas de consulter la ressource distante située sur https://matrix.domain.tld/_synapse/admin/v2/users?deactivated=false&dir=f&from=0&guests=true&limit=10&order_by=name. Raison : échec de la requête CORS. Code d’état : (null).

Those URLs redirects to SSO if I try to load them.

@tituspijean
Copy link
Member

On which domain have you installed Synapse Admin?
The app should have added a endpoint.nginx.conf file in Synapse's domain NGINX configuration. Can you check so?

@lapineige
Copy link
Member

I have this in synapse-admin.conf :

#sub_path_only rewrite ^/$ / permanent;
location / {

  alias /var/www/synapse-admin/;

  index index.html;
  try_files $uri $uri/ /index.html;

  # Include SSOWAT user panel.
  include conf.d/yunohost_panel.conf.inc;
}

@tituspijean
Copy link
Member

You have ignored my first question and misread my second 😇😅

@lapineige
Copy link
Member

lapineige commented Apr 22, 2023

Oh that's right joy

In synapse-admin.endpoint.conf:

location /_synapse/admin {

        proxy_pass http://127.0.0.1:SOMEPORTNUMBER;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $host;

        client_max_body_size 100M;

        proxy_http_version 1.1;
        
        more_set_headers "Access-Control-Allow-Origin: https://synapse-admin.domain.tld";
}

Synapse is on a different domain.

@tituspijean
Copy link
Member

I do not understand why it is not working. :/

It works on my server. Here is the directory tree of my NGINX files for Synapse and Synapse Admin, along with their content (port can change depending on the server). Can you check yours match?

/etc/nginx/conf.d
├ synapse.local.d
│  ├─ synapse.conf
│  ├─ synapse_server_name.conf
│  └─ synapse-admin.endpoint.conf   # has same port as synapse.conf
└ synapse-admin.local.d
   └─ synapse-admin.conf
#/etc/nginx/conf.d/synapse.local.d/synapse.conf
location /_matrix/ {
        proxy_pass http://localhost:8008;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $host;

        client_max_body_size 100M;

        # Use the specific path for the php file. It's more secure than global php path
        location /_matrix/cas_server.php {
            alias /var/www/synapse/;
            fastcgi_split_path_info ^(.+?\.php)(/.*)$;
            fastcgi_pass unix:/run/php7.4-fpm-synapse.sock;
            include fastcgi_params;
            fastcgi_param REMOTE_USER $remote_user;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_param SCRIPT_FILENAME cas_server.php;
        }
}
#/etc/nginx/conf.d/synapse.local.d/synapse_server_name.conf

location /.well-known/matrix/server {
    return 200 '{"m.server": "synapse.local:8448"}';
    add_header Content-Type application/json;
    add_header Access-Control-Allow-Origin '*';
}

location /.well-known/matrix/client {
    return 200 '{
        "m.homeserver": { "base_url": "https://synapse.local" },
        "im.vector.riot.jitsi": {"preferredDomain": "jitsi.riot.im"},
        "im.vector.riot.e2ee": {"default": true }
    }';
    add_header Content-Type application/json;
    add_header Access-Control-Allow-Origin '*';
}
# /etc/nginx/conf.d/synapse.local.d/synapse-admin.endpoint.conf
location /_synapse/admin {

        proxy_pass http://127.0.0.1:8008;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $host;

        client_max_body_size 100M;

        proxy_http_version 1.1;

        more_set_headers "Access-Control-Allow-Origin: https://synapse-admin.local";
}
# /etc/nginx/conf.d/synapse-admin.local.d/synapse-admin.conf
#sub_path_only rewrite ^/$ / permanent;
location / {

  proxy_pass        http://127.0.0.1:9090;
  proxy_redirect    off;
  proxy_set_header  Host $host;
  proxy_set_header  X-Real-IP $remote_addr;
  proxy_set_header  X-Forwarded-Proto $scheme;
  proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header  X-Forwarded-Host $server_name;

  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "upgrade";

  client_max_body_size 50M;

  # Include SSOWAT user panel.
  include conf.d/yunohost_panel.conf.inc;
}

@lapineige
Copy link
Member

lapineige commented Apr 23, 2023

"m.homeserver": { "base_url": "https://synapse.local" },

I have my synapse domain as URL here. I guess you changed yours, as for the rest of these URLs ?

The only particular thing I have is that synapse-admin is in a sub.sub.domain.

Wait…

/etc/nginx/conf.d/synapse-admin.local.d/synapse-admin.conf

This one is very different in my case.

I have:

 #sub_path_only rewrite ^/$ / permanent;
 location / {

   alias /var/www/synapse-admin/;

  index index.html;
  try_files $uri $uri/ /index.html;

  # Include SSOWAT user panel.
  include conf.d/yunohost_panel.conf.inc;
 }

Can I ask you how you generate that folder tree view ?

@lapineige
Copy link
Member

I also noticed synapse-admin service was stopped a few days ago 🤔

service synapse-admin status

Loaded: not-found (Reason: Unit synapse-admin.service not found.)
Active: failed (Result: exit-code)

Apr 20 systemd[1]: Stopping Synapse Admin...
Apr 20 systemd[1]: synapse-admin.service: Main process exited, code=exited, status=1/FAILURE
Apr 20 systemd[1]: synapse-admin.service: Failed with result 'exit-code'.
Apr 20 systemd[1]: Stopped Synapse Admin.
Apr 20 systemd[1]: synapse-admin.service: Consumed 35.833s CPU time.

But can't restart it:

service synapse-admin restart
Failed to restart synapse-admin.service: Unit synapse-admin.service not found.

@lapineige
Copy link
Member

If I try to use your nginx conf for synapse-admin, I have a 502 Bad Gateway.

No systemd service installed this time (it was from an old backup I guess ?).

@lapineige
Copy link
Member

I tried this version #36
403 forbidden.

@lapineige lapineige mentioned this issue Apr 23, 2023
2 tasks
@tituspijean
Copy link
Member

tituspijean commented Apr 24, 2023

/etc/nginx/conf.d/synapse-admin.local.d/synapse-admin.conf

This one is very different in my case.

I think that's an error on my end. I will check that tonight.

@lapineige
Copy link
Member

No hurry :)

@tituspijean
Copy link
Member

I was running an older version of the app (somehow the catalog was not updated on my server...) now it's up-to-date and still working:

# /etc/nginx/conf.d/synapse-admin.local.d/synapse-admin.conf
#sub_path_only rewrite ^/$ / permanent;
location / {

  alias /var/www/synapse-admin/;

  index index.html;
  try_files $uri $uri/ /index.html;

  # Include SSOWAT user panel.
  include conf.d/yunohost_panel.conf.inc;
}

Can I ask you how you generate that folder tree view ?

Manually. 😅

@lapineige
Copy link
Member

Ok, I have the same, it doesn't work.

@tituspijean
Copy link
Member

Hum... have you made the user you are logging in with an admin of Synapse? (cf. https://github.com/YunoHost-Apps/synapse_ynh#set-user-as-admin)

@lapineige
Copy link
Member

Yes, a long time ago.

@lapineige
Copy link
Member

I tried again with both version (normal, v2) with no success.

@tio-trom
Copy link

Same here. Updated to the latest both synapse and this package. Same error.

@tio-trom
Copy link

Fixed for me!

We realized that in the file /etc/ssowat/conf.json the synapse.admin_api "uris" was wrong. It had url/_matrix/_synapse instead of url/_synapse. Change that, restart Matrix. All works for me now!

@lapineige
Copy link
Member

Doesn't work for me, I can't connect (it seems to work and then "the session ended").
Did you change also the other lines ?

@tio-trom
Copy link

This is what I have in that file:

  "synapse.admin_api": {
            "auth_header": false,
            "label": "matrix.trom.tf (Server administration API.)",
            "public": true,
            "show_tile": false,
            "uris": [
                "matrix.trom.tf/_synapse"
            ],
            "use_remote_user_var_in_nginx_conf": true,
            "users": [
             ****
            ]
        },
        "synapse.main": {
            "auth_header": true,
            "label": "matrix.trom.tf",
            "public": false,
            "show_tile": false,
            "uris": [
                "matrix.trom.tf/_matrix/cas_server.php/login"
            ],
            "use_remote_user_var_in_nginx_conf": true,
            "users": [
            ****
            ]
        },
        "synapse.server_api": {
            "auth_header": false,
            "label": "matrix.trom.tf (Server access for client apps.)",
            "public": true,
            "show_tile": false,
            "uris": [
                "matrix.trom.tf/_matrix"
            ],
            "use_remote_user_var_in_nginx_conf": true,
            "users": [
              ****
            ]
        },
        "synapse.server_client_infos": {
            "auth_header": false,
            "label": "matrix.trom.tf (Server info for clients. (well-known))",
            "public": true,
            "show_tile": false,
            "uris": [
                "matrix.trom.tf/.well-known/matrix"
            ],
            "use_remote_user_var_in_nginx_conf": true,
            "users": [
               ****
            ]
        },

@lapineige
Copy link
Member

lapineige commented Jun 22, 2023

I have a similar one 🤔
Except users is empty.
And label is just Synapse and derivatives, not domain.tld like you.

@tio-trom
Copy link

Make sure you also did this change in nginx https://github.com/YunoHost-Apps/synapse_ynh/pull/392/files

My nginx is this:

location /_matrix/ {
        proxy_pass http://localhost:8008;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $host;

        client_max_body_size 100M;

        # Use the specific path for the php file. It's more secure than global php path
        location /_matrix/cas_server.php {
            alias /var/www/synapse/;
            fastcgi_split_path_info ^(.+?\.php)(/.*)$;
            fastcgi_pass unix:/run/php7.4-fpm-synapse.sock;
            include fastcgi_params;
            fastcgi_param REMOTE_USER $remote_user;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_param SCRIPT_FILENAME cas_server.php;
        }
}


location /_synapse/ {
        proxy_pass http://localhost:8008;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $host;

        client_max_body_size 10M;
}

@lapineige
Copy link
Member

Done, no change :(

@tio-trom
Copy link

Did you restart Nginx and also the Matrix service? Maybe reboot you server.

@lapineige
Copy link
Member

Oh no, just Nginx. I'll try.

No luck :(

@tio-trom
Copy link

Damn....but do you get the same exact error as before?

@lapineige
Copy link
Member

No.
I have the "the session ended" error that come back to the login page.

@tio-trom
Copy link

No. I have the "the session ended" error that come back to the login page.

Ok so perhaps this is another issue than the one in the OP.

@lapineige
Copy link
Member

Does anyone knows how to get some log to diagnose this ?

The only thing I found was in the web console : Blocage d’une requête multiorigine (Cross-Origin Request) : la politique « Same Origin » ne permet pas de consulter la ressource distante située sur https://matrix.mydomain.tld/_synapse/admin/v2/users?deactivated=false&dir=f&from=0&guests=true&limit=10&order_by=name. Raison : la redirection externe de requêtes CORS n’est pas autorisée.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants