Page MenuHomePhabricator

Visual Editor issue - Error contacting the Parsoid/RESTBase server: http-request-error
Open, Needs TriagePublic

Description

Hello,

installed a MediaWiki with latest stable version 1.36 and I enabled Visual Editor.
After some searches & configuration changes I have not found a solution :'(.

Current configuration:

  • OS: Debian 10.10
  • Web server: nginx/1.14.2
  • PHP: PHP FPM 7.3.29
  • DB: SQLite
  • MediaWiki: 1.36

Current NGinx configuration based on: https://www.nginx.com/resources/wiki/start/topics/recipes/mediawiki/

server {
        listen          80;
        server_name     cnameHere;
        return 301 https://$server_name$request_uri;
}

server {
        listen                  443;
        server_name             cnameHere;
        ssl on;
        ssl_certificate         /pathTo/crtFile;
        ssl_certificate_key     /pathTo/keyFile;
        root                    /pathToWebFiles/;
        index                   index.php;
        access_log              /var/log/nginx/access-cnameHere.log;
        error_log               /var/log/nginx/error-cnameHere.log;
        client_max_body_size    32m;
        client_body_timeout     60;
        location / {
                try_files $uri $uri/ @rewrite;
        }

        location @rewrite {
                rewrite ^/(.*)$ /index.php?title=$1&$args;
        }

        location ^~ /maintenance/ {

                return 403;

        }

        location /rest.php {
                try_files $uri $uri/ /rest.php?$args;
        }

        location ~ \.php$ {
                include /etc/nginx/fastcgi_params;
                #include        snippets/fastcgi-php.conf;
                fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
                fastcgi_param SCRIPT_FILENAME $request_filename;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                try_files $uri /index.php;
                expires max;
                log_not_found off;
        }

        location = /_.gif {
                expires max;
                empty_gif;
        }

        location ^~ /cache/ {
                deny all;
        }

        location /dumps {
                root /pathTo/dumps;
                autoindex on;
        }
}

I found some supports about some issues in related with Visual Editor and tried to add in the LocalSettings.php these lines:

$wgGroupPermissions['*']['read'] = true;
$wgGroupPermissions['*']['edit'] = true;
$wgGroupPermissions['*']['writeapi'] = true;
$wgVirtualRestConfig['modules']['parsoid']['forwardCookies'] = true;

But my issue is still present.

If I create a new page Visual Editor is loaded, but during save page I get the popup error message:
Something went wrong
Error contacting the Parsoid/RESTBase server: http-request-error

If I try to edit a page the Visual editor is not load with this popup error message:
Error contacting the Parsoid/RESTBase server: http-request-error

I checked quickly URL called from my browser:

Request headers:

GET /api.php?action=visualeditor&format=json&paction=parse&page=Main_Page&uselang=en&formatversion=2&oldid=1 HTTP/1.1
Host: cnameHere
Connection: keep-alive
sec-ch-ua: "Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"
Accept: application/json, text/javascript, */*; q=0.01
X-Requested-With: XMLHttpRequest
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://cnameHere/index.php?title=Main_Page&veaction=edit
Accept-Encoding: gzip, deflate, br
Accept-Language: en,fr-FR;q=0.9,fr;q=0.8,en-US;q=0.7
Cookie: mw_installer_session=eg8118stmk0vsgjkoqvq46brha; wikinameUserName=UsernameHere; wikiEditor-0-toolbar-section=advanced; VEE=wikitext

Response headers:

HTTP/1.1 200 OK
Server: nginx/1.14.2
Date: Wed, 01 Sep 2021 11:27:50 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Content-Type-Options: nosniff
MediaWiki-API-Error: apierror-visualeditor-docserver-http-error
X-Frame-Options: DENY
Content-Disposition: inline; filename=api-result.json
Cache-Control: private, must-revalidate, max-age=0
X-Request-Id: 72b8be7d761079a708ef3a78

Response:

{"error":{"code":"apierror-visualeditor-docserver-http-error","info":"Error contacting the Parsoid/RESTBase server: http-request-error","docref":"See https://cnameHere/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."}}

I can access correctly on: https://cnameHere/api.php without problem.

  • NGinx error log is empty for Visual Editor.
  • NGinx Access log when I tried to open page to edit (when I click on try again button):

client@IP - - [01/Sep/2021:13:33:36 +0200] "GET /api.php?action=visualeditor&format=json&paction=parse&page=Main_Page&uselang=en&formatversion=2&oldid=1 HTTP/1.1" 200 404 "https://cnameHere/index.php?title=Main_Page&veaction=edit" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36"

I also added in the LocalSettings.php these lines:

$wgShowExceptionDetails = true;
$wgDebugLogFile = '/var/log/nginx/wiki_debug.log';

But I have no stack trace vs. TinyMCE (I am not lucky with wysiwyg editors).

I suppose an issue with NGinx configuration, but I am not 100% sure.

I do not know if it is this issue can be merged with: https://phabricator.wikimedia.org/T266971 ?

Do you have any idea, please?

Event Timeline

Arlolra added a subscriber: Arlolra.

What does your Visual Editor configuration in LocalSettings.php look like?

I have just:

wfLoadExtension( 'VisualEditor' );

During installation I checked Visual Editor.
@Edit: Installation of MediaWiki

ppelberg added a subscriber: ppelberg.

@Magicwrite we appreciate you filing this task.

Unfortunately, the Editing Team is not able to prioritize work on issue related to third-party wikis at this time.

Should this issue prove to be more widespread, we revisit the low priority that we've assigned to it.