Search code examples
curlportmediawikiparsoidmediawiki-visualeditor

MediaWiki - VisualEditor Extension: (curl error: 28) Timeout was reached


I am getting the following error displayed while trying to edit a page with the aid of Visual Editor (It did not work previously yet):

Error loading data from server: apierror-visualeditor-docserver-http-error: (curl error: 28) Timeout was reached. Would you like to retry?

I think the above is a port issue as port 8142 cannot be accessed for some weird reason as I executed the command:

curl -L http://40.68.204.191:8142

and received the following response:

curl: (7) Failed to connect to 40.68.204.191 port 8142: Connection timed out

I have installed the VisualEditor extension by doing the following:

  1. Download VisualEditor from the ExtensionDistributor page. After getting the code, I saved it into the /opt/bitnami/apps/mediawiki/htdocs/extensions/VisualEditor directory of my wiki.

    I have installed version 1.32 (latest stable MediaWiki)

  2. I have installed Parsoid by following the installation instructions which can be found here: https://www.mediawiki.org/wiki/Parsoid/Setup

  3. I have added the following code into my LocalSettings.php file:

    wfLoadExtension( 'VisualEditor' );
    

    and 

    ##### VisualEditor Config #####
    
    // Enable by default for everybody
    
    $wgDefaultUserOptions['visualeditor-enable'] = 1;
    
    // Optional: Set VisualEditor as the default for anonymous users
    
    // otherwise they will have to switch to VE
    
    $wgDefaultUserOptions['visualeditor-editor'] = "visualeditor";
    
    // Don't allow users to disable it
    
    $wgHiddenPrefs[] = 'visualeditor-enable';
    
    // OPTIONAL: Enable VisualEditor's experimental code features
    
    #$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;
    
    $wgVirtualRestConfig['modules']['parsoid'] = array(
    
        // URL to the Parsoid instance
    
        // Use port 8142 if you use the Debian package
    
        'url' => 'http://40.68.204.191:8142',
    
        // Parsoid "domain", see below (optional)
    
        'domain' => '40.68.204.191',
    
        // Parsoid "prefix", see below (optional)
    
        'prefix' => '40.68.204.191'
    
    );
    
  4. I have changed the 2 lines of code within the config.yaml file (used for Parsoid configuration) which can be found within the "/etc/mediawiki/parsoid" folder on my virtual machine:

    # Configure Parsoid to point to your MediaWiki instances.
    
            mwApis:
    
            - # This is the only required parameter,
    
              # the URL of you MediaWiki API endpoint.
    
             
    
              #  uri: 'http://localhost/api.php'
    
              uri: 'http://40.68.204.191/w/api.php'
    
              # before >>  uri: 'http://localhost/w/api.php'
    
              # The "domain" is used for communication with Visual Editor
    
              # and RESTBase.  It defaults to the hostname portion of
    
              # the `uri` property below, but you can manually set it
    
              # to an arbitrary string.
    
             
    
              # domain: 'localhost'  # optional
    
              domain: '40.68.204.191'  # optional
    
              # before >> domain: 'localhost'  # optional
    
  5. I have also added SELINUX=permissive at the end of the semanage.conf file within the /etc/selinux folder.

I have followed the following instructions to install Parsoid and VisualEditor:

https://www.mediawiki.org/wiki/Parsoid/Setup

https://www.mediawiki.org/wiki/Extension:VisualEditor

VisualEditor and Parsoid are new extensions which I have installed on our MediaWiki.

The below image contains the error I am getting displayed on my wiki while trying to work with VisualEditor: enter image description here

And the below shows the Chrome error after trying to navigate to http://40.68.204.191:8142/:

enter image description here

The below shows my result after navigating to w/api.php in Google Chrome: enter image description here

And the below shows the Chrome error after trying to navigate to http://40.68.204.191:8000/: enter image description here

I am having the following displayed after executing the command netstat -plantu: enter image description here

I tried this: sudo lsof -i -n -P | grep LISTEN and got this as the result: enter image description here

The following is contained within /var/log/parsoid/parsoid.log

{"name":"parsoid","hostname":"MediaWiki","pid":20623,"level":30,"levelPath":"info/service-runner","msg":"master(20623) initializing 1 workers","time":"2019-02-11T17:17:27.490Z","v":0}

{"name":"parsoid","hostname":"MediaWiki","pid":20644,"level":60,"moduleName":"../src/lib/index.js","levelPath":"fatal/service-runner/worker","msg":"Unexpected token {","time":"2019-02-11T17:17:29.061Z","v":0} {"name":"parsoid","hostname":"MediaWiki","pid":20623,"level":40,"message":"first worker died during startup, continue startup","worker_pid":20644,"exit_code":1,"startup_attempt":1,"levelPath":"warn/service-runner/master","msg":"first worker died during startup, continue startup","time":"2019-02-11T17:17:30.091Z","v":0} Killed {"name":"parsoid","hostname":"MediaWiki","pid":22289,"level":30,"levelPath":"info/service-runner","msg":"master(22289) initializing 1 workers","time":"2019-02-11T17:43:47.240Z","v":0} {"name":"parsoid","hostname":"MediaWiki","pid":22298,"level":60,"moduleName":"../src/lib/index.js","levelPath":"fatal/service-runner/worker","msg":"Unexpected token {","time":"2019-02-11T17:43:48.803Z","v":0} {"name":"parsoid","hostname":"MediaWiki","pid":22289,"level":40,"message":"first worker died during startup, continue startup","worker_pid":22298,"exit_code":1,"startup_attempt":1,"levelPath":"warn/service-runner/master","msg":"first worker died during startup, continue startup","time":"2019-02-11T17:43:49.815Z","v":0} Killed {"name":"parsoid","hostname":"MediaWiki","pid":14815,"level":30,"levelPath":"info/service-runner","msg":"master(14815) initializing 1 workers","time":"2019-02-14T20:49:48.472Z","v":0} {"name":"parsoid","hostname":"MediaWiki","pid":14829,"level":60,"moduleName":"../src/lib/index.js","levelPath":"fatal/service-runner/worker","msg":"Unexpected token {","time":"2019-02-14T20:49:50.113Z","v":0} {"name":"parsoid","hostname":"MediaWiki","pid":14815,"level":40,"message":"first worker died during startup, continue startup","worker_pid":14829,"exit_code":1,"startup_attempt":1,"levelPath":"warn/service-runner/master","msg":"first worker died during startup, continue startup","time":"2019-02-14T20:49:51.131Z","v":0}


Solution

  • Your node should be at version 6 or newer to run Parsoid 0.9.0, to check this run:

    node -v
    

    If its not at least version 6 try updating node, you should be able to do so with the following:

    sudo npm cache clean -f
    sudo npm install -g n
    sudo n stable
    

    Try changing the address in Config.yaml and LocalSettings.php to localhost

    And if you get a HTTP:401 follow the instructions here