Topic on Extension talk:VisualEditor

VisualEditor doesn't work with wiki markups since MW 1.29.2

4
Summary by Spas.Z.Spasov

I've managed to solve this issue in this way:

1. I've switched the Parsoid configuration from settings.js to config.yaml.

2. I've simplified the setup as it is possible.

Spas.Z.Spasov (talkcontribs)

Hello!

Yesterday I've updated to MW 1.29.2 (16.04 LTS + Apache2). Now VisualEditor produces the following HTTP 500 error message when on the page have wiki markups as [[page name]]:

Error loading data from server: apierror-visualeditor-docserver-http: HTTP 500. Would you like to retry?

The problem doesn't appear within '2017 wikitext editor'. The problem doesn't appear with the master branch of MW and VE.

Here is an animated screenshot: https://drive.google.com/file/d/1wFCwG_ZSdhs6ZXisdkD6tHZdNFrzXLCw/view

How could I solve this issue? Any ideas?

Kraba (talkcontribs)

Same problem! I'm working on it...

Ubuntu 16.04 LTS + NGINX + 1.29.2

[02/Dec/2017:20:04:54 +0100] "GET /Main_Page HTTP/1.1" 200 5630 "http://wiki.*.info/Main_Page?action=edit&veswitched=1&oldid=7" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/62.0.3202.94 Chrome/62.0.3202.94 Safari/537.36"
[02/Dec/2017:20:04:56 +0100] "GET /api.php?action=visualeditor&format=json&paction=parse&page=Main_Page&uselang=en HTTP/1.1" 200 334 "http://wiki.*.info/Main_Page?veaction=edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/62.0.3202.94 Chrome/62.0.3202.94 Safari/537.36"
[02/Dec/2017:20:04:57 +0100] "POST /api.php HTTP/1.1" 200 32 "http://wiki.*.info/Main_Page?veaction=edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/62.0.3202.94 Chrome/62.0.3202.94 Safari/537.36"
[02/Dec/2017:20:05:03 +0100] "POST /api.php HTTP/1.1" 200 32 "http://wiki.*.info/Main_Page?veaction=edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/62.0.3202.94 Chrome/62.0.3202.94 Safari/537.36"

Now appear error and ...

[02/Dec/2017:20:05:03 +0100] "GET /Main_Page?action=edit&veswitched=1&oldid=7 HTTP/1.1" 200 7686 "http://wiki.*.info/Main_Page?veaction=edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/62.0.3202.94 Chrome/62.0.3202.94 Safari/537.36"

Parsoid write this error on log:

"name":"parsoid","hostname":"*","pid":23269,"level":60,"err":{"message":"Failed to parse the JSON response for Config Request","name":"lib/index.js","stack":"lib/index.js: Failed to parse the JSON response for Config Request\n    at ConfigRequest.ApiRequest._handleBody (/usr/local/lib/node_modules/parsoid/lib/mw/ApiRequest.js:470:12)\n    at ConfigRequest.ApiRequest._requestCB (/usr/local/lib/node_modules/parsoid/lib/mw/ApiRequest.js:421:8)\n    at Request.self.callback (/usr/local/lib/node_modules/parsoid/node_modules/request/request.js:186:22)\n    at emitTwo (events.js:126:13)\n    at Request.emit (events.js:214:7)\n    at Request.<anonymous> (/usr/local/lib/node_modules/parsoid/node_modules/request/request.js:1163:10)\n    at emitOne (events.js:116:13)\n    at Request.emit (events.js:211:7)\n    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/parsoid/node_modules/request/request.js:1085:12)\n    at Object.onceWrapper (events.js:313:30)\n    at emitNone (events.js:111:20)\n    at IncomingMessage.emit (events.js:208:7)\n    at endReadableNT (_stream_readable.js:1056:12)\n    at _combinedTickCallback (internal/process/next_tick.js:138:11)\n    at process._tickCallback (internal/process/next_tick.js:180:9)","httpStatus":500,"levelPath":"fatal/request"},"msg":"Failed to parse the JSON response for Config Request","time":"2017-12-02T19:11:30.770Z","v":0}
Kraba (talkcontribs)

now it work. config.yaml:

 worker_heartbeat_timeout: 300000

logging:
    level: info 

services:
  - module: ../src/lib/index.js  
    entrypoint: apiServiceWorker
    conf:
        mwApis:
        - uri: 'http://wiki.MYSITE.info/api.php'
        serverPort: 8142

LocalSettings.php:

...
$wgServer = "http://wiki.MYSITE.info";
..
WfLoadExtension( 'VisualEditor' );
$wgDefaultUserOptions['visualeditor-enable'] = 1;
$wgHiddenPrefs[] = 'visualeditor-enable';
$wgVirtualRestConfig['modules']['parsoid'] = array(
	'url' => 'http://localhost:8142', 
	'domain' => 'wiki.MYSITE.info',
);
Spas.Z.Spasov (talkcontribs)

I also managed to solve this issue in a similar way.

1. I switched the Parsoid configuration from using of settings.js to using of config.yaml.

2. I simplified the setup as it is possible.


Here is the setup of my wiki family:

  • wiki-BG/LocalSettings.php
$wgServer = "https://bg.example.org";

...

## Visual Editor -----
wfLoadExtension( 'VisualEditor' );
        $wgVisualEditorAvailableNamespaces = array( 
                NS_USER => true, NS_HELP => true, NS_PROJECT => true, NS_DEF => true
        );

        $wgDefaultUserOptions['visualeditor-enable'] = 1;
        $wgVisualEditorEnableExperimentalCode = true;
        $wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;

        $wgVisualEditorEnableWikitext = true;
        $wgDefaultUserOptions['visualeditor-newwikitext'] = false;
        //$wgVisualEditorEnableTocWidget = true;

## Flow -----
wfLoadExtension( 'Flow' );
        $wgFlowContentFormat = 'html';
        $wgFlowEditorList = array( 'visualeditor', 'none' );
        $wgFlowParsoidTimeout = 100;
        $wgFlowParsoidForwardCookies = true;

## Parsoid ----
wfLoadExtension( 'ParsoidBatchAPI' );

$wgVirtualRestConfig['modules']['parsoid'] = array(
                'url' => 'http://127.0.0.1:8142',
        );

        $wgSessionsInObjectCache = true;
        $wgVirtualRestConfig['modules']['parsoid']['forwardCookies'] = true;
  • wiki-EN/LocalSettings.php
$wgServer = "https://en.example.org";

...

## Parsoid ----
wfLoadExtension( 'ParsoidBatchAPI' );

$wgVirtualRestConfig['modules']['parsoid'] = array(
                'url' => 'http://127.0.0.1:8142',
        );

        $wgSessionsInObjectCache = true;
        $wgVirtualRestConfig['modules']['parsoid']['forwardCookies'] = true;
  • /etc/mediawiki/parsoid/config.yaml
worker_heartbeat_timeout: 300000

logging:
    level: info
 
services:
  - module: ../src/lib/index.js
    entrypoint: apiServiceWorker
    conf:
        #localsettings: /etc/mediawiki/parsoid/settings.js
        mwApis:
        - uri: 'https://bg.example.org/api.php'
        - uri: 'https://en.example.org/api.php'
        serverPort: 8142
        serverInterface: '127.0.0.1'