[vz-users] [Error] Failed to load resource: the server responded with a status of 400 (Bad Request) (channel.json, line 0)

applicationMGR ecoCuyo applicationMGR at ecoCuyo.de
Di Sep 12 11:49:00 CEST 2023


Leider weiterhin bleibt der Fehler wie oben zzgl. folgendem Fehler, egal ob url: '‘ oder url: ‚api', :

WebSocket connection to 'wss://demo.volkszaehler.org/ws' failed: There was a bad response from the server.

Und dazu folgende Warnings:

jQuery.Deferred exception: undefined is not an object (evaluating 'xhr.response.JSON') (2)
(anonyme Funktion) — wui.js:905
(anonyme Funktion) — functions.js:170
(anonyme Funktion) — functions.js:160
l — jquery-3.3.1.min.js:2:29381
(anonyme Funktion) — jquery-3.3.1.min.js:2:29679
undefined

Das führt mich in /home/pi/volkszaehler.org/htdocs/js/functions.js zu folgenden code snippets: 

               function (xhr) {
                        return vz.load.errorHandler(xhr, skipDefaultErrorHandling);
                }

und

vz.load.errorHandler = function(xhr, skipDefaultErrorHandling) {
        if (!skipDefaultErrorHandling) {
                vz.wui.dialogs.middlewareException(xhr);
        }
        return xhr;
};

In der jquery-3.3.1.min.js kann ich leider nicht suchen, weil ohne Zeilenumbrüche.  

Sagt das jemandem etwas, ist die jquery-3.3.1.min.js out of date?



> Am 12.09.2023 um 07:43 schrieb applicationMGR ecoCuyo <applicationMGR at ecoCuyo.de>:
> 
> Oups… habe übersehen, dass ich jetzt beides drin hab:
> 
>> middleware: [
>>                 {
>>                         title: 'Local (default)',
>>                         url: '',
>>                         url: 'api',
>>                         live: 8082  
> 
> 
> Das muss ich noch ändern.
> 
> 
>> Am 12.09.2023 um 07:11 schrieb applicationMGR ecoCuyo <applicationMGR at ecocuyo.de>:
>> 
>> 
>> 
>> Hallo Daniel et alii
>> 
>> die /var/www/volkszaehler.org/htdocs//middleware.php hat folgenden Inhalt:    
>> 
>> namespace Volkszaehler;
>> 
>> use Symfony\Component\HttpFoundation\Request;
>> 
>> define('VZ_DIR', realpath(__DIR__ . '/..'));
>> 
>> // default response if things go wrong
>> http_response_code(500);
>> 
>> require VZ_DIR . '/lib/bootstrap.php';
>> 
>> $router = new Router();
>> 
>> // create Request from PHP global variables
>> $request = Request::createFromGlobals();
>> 
>> // handle request
>> $response = $router->handle($request);
>> $response->send();
>> 
>> für die /lib/bootstrap.php gibt es eine ganze Reihe von Kopien:
>> 
>> # find / -name bootstrap.php -type f
>> /home/pi/volkszaehler.org/lib/bootstrap.php
>> /home/pi/volkszaehler.org/vendor/symfony/polyfill-php81/bootstrap.php
>> /home/pi/volkszaehler.org/vendor/symfony/polyfill-mbstring/bootstrap.php
>> /home/pi/volkszaehler.org/vendor/symfony/polyfill-intl-grapheme/bootstrap.php
>> /home/pi/volkszaehler.org/vendor/symfony/polyfill-php73/bootstrap.php
>> /home/pi/volkszaehler.org/vendor/symfony/polyfill-intl-normalizer/bootstrap.php
>> /home/pi/volkszaehler.org/vendor/symfony/polyfill-ctype/bootstrap.php
>> /home/pi/volkszaehler.org/vendor/symfony/polyfill-php80/bootstrap.php
>> /home/pi/volkszaehler.org/vendor/symfony/polyfill-php72/bootstrap.php
>> /home/pi/volkszaehler.org/vendor/cboden/ratchet/tests/bootstrap.php
>> /home/pi/volkszaehler.org/vendor/phpstan/phpstan/bootstrap.php
>> /home/pi/volkszaehler.org/vendor/ringcentral/psr7/tests/bootstrap.php
>> /home/pi/volkszaehler.org/vendor/ratchet/rfc6455/tests/bootstrap.php
>> /home/pi/volkszaehler.org/vendor/webpatser/laravel-uuid/tests/bootstrap.php
>> /usr/share/php/phpseclib/bootstrap.php
>> 
>> Ich denke jedoch die tatsächlich verwendetet liegt unter:
>> 
>> /home/pi/volkszaehler.org/lib/bootstrap.php
>> 
>> Drin steht folgendes:
>> 
>> use Volkszaehler\Util;
>> 
>> function fail($msg) {
>>         // JSON request?
>>        if (preg_match('/\.json/', @$_SERVER['REQUEST_URI'])) {
>>                 header('Content-type: application/json');
>>                 echo json_encode([
>>                         'version' => VZ_VERSION,
>>                         'exception' => array(
>>                                 'message' => $msg
>>                         )
>>                 ]);
>>                 die();
>>         }
>> 
>>         // normal request or command line
>>         throw new \Exception($msg);
>> }
>> 
>> // enable strict error reporting
>> error_reporting(E_ALL | E_STRICT);
>> 
>> // api version
>> define('VZ_VERSION', '0.3');
>> 
>> // Note: users of bootstrap.php can set VZ_DIR before calling bootstrap
>> if (!defined('VZ_DIR')) {
>>         define('VZ_DIR', realpath(__DIR__ . '/..'));
>> }
>> 
>> if (!file_exists(VZ_DIR . '/vendor/autoload.php')) {
>>         fail('Could not find autoloader. Check that dependencies have been installed via `composer install`.');
>> }
>> 
>> if (!file_exists(VZ_DIR . '/etc/config.yaml')) {
>>         fail('Could not find config file. Check that etc/config.yaml exists.');
>> }
>> 
>> require_once VZ_DIR . '/vendor/autoload.php';
>> 
>> // load configuration
>> Util\Configuration::load(VZ_DIR . '/etc/config.yaml');
>> 
>> // set timezone
>> $tz = (Util\Configuration::read('timezone')) ? Util\Configuration::read('timezone') : @date_default_timezone_get();
>> date_default_timezone_set($tz);
>> 
>> // set locale
>> setlocale(LC_ALL, Util\Configuration::read('locale'));
>> 
>> // force numeric output to C convention (issue #121)
>> setlocale(LC_NUMERIC, 'C');
>> 
>> ?>
>> 
>> Und nicht zuletzt ist ein Link wie folgt gesetzt:
>> 
>> lrwxrwxrwx 1 root root 25 16. Apr 2022  /var/www/volkszaehler.org -> /home/pi/volkszaehler.org
>> 
>> 
>> Das sieht erst mal unauffällig aus - was siehst Du darin ggf?
>> 
>> Der einzige Abweichung konnte ich in ~/volkszaehler.org/htdocs/js/options.js finden - da war url:’’ auskommentiert. Das hab ich jetzt geändert.
>> 
>>         middleware: [
>>                 {
>>                         title: 'Local (default)',
>>                         url: '',
>>                         url: 'api',
>>                         live: 8082  
>> 
>> Das hat nicht geholfen.
>> Freue mich über Tipps…
>> 
>> Viele Grüße
>> Armin
>> 
>>> Am 04.09.2023 um 15:09 schrieb Daniel Lauckner <vz at jahp.de>:
>>> 
>>> Hallo,
>>> 
>>> 
>>> am Sonntag, 3. September 2023 um 12:28 hat applicationMGR ecoCuyo geschrieben:
>>>> habe nach einem Datenbank Crash die Volkszähler DB mit purge entfernt und wieder neu installiert. Sowie die Middleware mit install.sh neu installiert.
>>> 
>>> Wie ist bei dir der Middleware bzw. der Webserver konfiguriert?
>>> Letzte Empfehlung war PHP-PM und Apache als Proxy.
>>> 
>>>> Im Safari-Debugger kommt der Fehler im Betreff oben und verweist auf http://<ip-des servers>/api/channel.json
>>>> Im code hängt das ganze dann hier fest:
>>> 
>>> Die Fehlermeldung sagt mir nix konkretes. Das spricht meist für einen Fehler beim Composer.
>>> Mal bitte wieder holen und schauen was an möglichen Störungen auftritt:
>>> 
>>> cd /var/www/volkszaehler.org/
>>> composer update
>>> 
>>>> Die User Rechte sollten so stimmen, nehm ich an?
>>> 
>>> Ja, das passt.
>>> Wenn du es zusätzlich ausschließen möchtest kannst du mal in ./ect/config.yaml bei 'user:' und 'password:' die Zugangsdaten vom vz_admin eintragen.
>>> 
>>> 
>>> mfg Daniel
>>> 
>> 

-------------- nächster Teil --------------
Ein Dateianhang mit HTML-Daten wurde abgetrennt...
URL: <http://demo.volkszaehler.org/pipermail/volkszaehler-users/attachments/20230912/010878fc/attachment-0001.htm>


Mehr Informationen über die Mailingliste volkszaehler-users