cockpit-project / cockpit

Cockpit is a web-based graphical interface for servers.
http://www.cockpit-project.org/
GNU Lesser General Public License v2.1
11.23k stars 1.11k forks source link

No longer able to fetch manifest.json #20984

Open jsaarija opened 2 months ago

jsaarija commented 2 months ago

Explain what happens

I'm fetching manifest.json in my Cockpit package code according to related documentation:

fetch('./manifest.json')
    .then(response => {
        if (response.status === 200) {
            response.json().then((json: any) => {
                cockpitManifest = json;
                isInitialized = true;
                isInitializing = false;
            });
        } else {
            throw new Error('Failed downloading manifest.json');
        }
    });

This used to work fine in Cockpit 264 (Ubuntu 20.04.6 LTS) but now in 314 (Ubuntu 24.04.1 LTS) trying to fetch manifest.json fails with 404 and returns a "Not found" HTML page instead:

image

image

Fetching any other files from the same directory works fine with no issues whatsoever. Likewise fetching ../manifests.json or ../manifests.js work both just fine.

Is there something I'm possibly missing here, or has something broken or changed in fetching manifest.json files directly and possibly not reflected in the documentation?

Version of Cockpit

314

Where is the problem in Cockpit?

None

Server operating system

Ubuntu

Server operating system version

24.04.1 LTS

What browsers are you using?

Chrome

System log

Sep 06 16:26:08 local-ubuntu24 cockpit-tls[4412]: cockpit-tls: gnutls_handshake failed: A TLS fatal alert has been received.
Sep 06 16:26:08 local-ubuntu24 cockpit-tls[4412]: cockpit-tls: gnutls_handshake failed: A TLS fatal alert has been received.
Sep 06 16:26:08 local-ubuntu24 cockpit-tls[4412]: cockpit-tls: gnutls_handshake failed: A TLS fatal alert has been received.
Sep 06 16:26:09 local-ubuntu24 cockpit-tls[4412]: cockpit-tls: gnutls_handshake failed: A TLS fatal alert has been received.
Sep 06 16:26:09 local-ubuntu24 cockpit-tls[4412]: cockpit-tls: gnutls_handshake failed: A TLS fatal alert has been received.
Sep 06 16:26:09 local-ubuntu24 cockpit-tls[4412]: cockpit-tls: gnutls_handshake failed: A TLS fatal alert has been received.
Sep 06 16:26:09 local-ubuntu24 cockpit-tls[4412]: cockpit-tls: gnutls_handshake failed: A TLS fatal alert has been received.
Sep 06 16:26:09 local-ubuntu24 cockpit-tls[4412]: cockpit-tls: gnutls_handshake failed: A TLS fatal alert has been received.
Sep 06 16:26:09 local-ubuntu24 cockpit-tls[4412]: cockpit-tls: gnutls_handshake failed: A TLS fatal alert has been received.
Sep 06 16:26:09 local-ubuntu24 cockpit-tls[4412]: cockpit-tls: gnutls_handshake failed: A TLS fatal alert has been received.
Sep 06 16:26:09 local-ubuntu24 cockpit-tls[4412]: cockpit-tls: gnutls_handshake failed: A TLS fatal alert has been received.
Sep 06 16:26:09 local-ubuntu24 cockpit-tls[4412]: cockpit-tls: gnutls_handshake failed: A TLS fatal alert has been received.
Sep 06 16:26:09 local-ubuntu24 cockpit-tls[4412]: cockpit-tls: gnutls_handshake failed: A TLS fatal alert has been received.
Sep 06 16:26:09 local-ubuntu24 cockpit-tls[4412]: cockpit-tls: gnutls_handshake failed: A TLS fatal alert has been received.
Sep 06 16:26:09 local-ubuntu24 cockpit-tls[4412]: cockpit-tls: gnutls_handshake failed: A TLS fatal alert has been received.
Sep 06 16:26:09 local-ubuntu24 cockpit-tls[4412]: cockpit-tls: gnutls_handshake failed: A TLS fatal alert has been received.
Sep 06 16:26:09 local-ubuntu24 cockpit-tls[4412]: cockpit-tls: gnutls_handshake failed: A TLS fatal alert has been received.
Sep 06 16:26:09 local-ubuntu24 cockpit-tls[4412]: cockpit-tls: gnutls_handshake failed: A TLS fatal alert has been received.
Sep 06 16:26:10 local-ubuntu24 cockpit-tls[4412]: cockpit-tls: gnutls_handshake failed: A TLS fatal alert has been received.
Sep 06 16:26:10 local-ubuntu24 cockpit-tls[4412]: cockpit-tls: gnutls_handshake failed: A TLS fatal alert has been received.
Sep 06 16:26:13 local-ubuntu24 sudo[143474]: <user name> : TTY=pts/1 ; PWD=/home ; USER=root ; COMMAND=/usr/bin/journalctl --since -10m
Sep 06 16:26:13 local-ubuntu24 sudo[143474]: pam_unix(sudo:session): session opened for user root(uid=0) by <user name>(uid=1001)
jelly commented 1 month ago

What's the use case for fetching the manifest? If you have access to the window.cockpit object you can query the manifests there as window.cockpit.manifests.

The Python bridge removed manifest.json and replaced it with manifests.js.

jsaarija commented 1 month ago

In my use case I often have several copies of the same package installed in a Cockpit environment -- say, for example, that I have packages package-dev and package-prod in this case and they really only differentiate by the contents of their manifest.json file and the directory they're in. I've used the manifest file to have instance-specific attributes (such as a relevant backend server port number for either prod or dev) that each instance of the package has been able to read by just handily reading its own manifest.json file. Reading these same values from manifests.js (or manifests.json) does not seem to be very straightforward, though, as it seems there's no easy way for the package to know which manifest it actually needs to read when there's multiple copies of it installed in Cockpit.

This is a bit of legacy code from the earliest days of the package and these days the package code itself already reads a separate configuration JSON file for other use cases, so I believe I can just move the custom fields that are now in manifest.json to over there instead. However if this deprecation of loading the manifest.json directly is intended behavior then the documentation should probably be updated?