1

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}

ay43210
  • 15
  • 1
  • 9
  • Ok, It seems Parsoid is the issue here. http://40.68.204.191:8142 should show Parsoid documentation. Are you sure that's the port it is running on? Are you sure it is running? If the answer to both these question is yes It might be something to do with your firewall blocking requests. – Dylan Feb 13 '19 at 19:10
  • What happens if you navigate to http://40.68.204.191:8000 ? – Dylan Feb 13 '19 at 19:14
  • I am getting the same error when accessing it via :8000 (see above) – ay43210 Feb 14 '19 at 00:35
  • Are you on linux? If so can you let me know what the output of `lsof -i -n -P | grep LISTEN` is? – Dylan Feb 14 '19 at 01:19
  • @Dylan I am having nothing displayed after executing `lsof -i -n -P | grep LISTEN`, however see above my results for executing `netstat -plantu` – ay43210 Feb 14 '19 at 17:47
  • Try `service parsoid restart` and see if it produces any errors. Also try running `lsof` as root – Dylan Feb 14 '19 at 18:43
  • What distribution of linux are you on and did you install parsoid as a package? – Dylan Feb 14 '19 at 18:47
  • 1
    @Dylan I just executed `service parsoid restart` and received no error at all. These are the details of my VM where MediaWiki is installed: `Static hostname: MediaWiki Icon name: computer-vm Chassis: vm Virtualization: microsoft Operating System: Ubuntu 16.04.5 LTS Kernel: Linux 4.15.0-1036-azure Architecture: x86-64` – ay43210 Feb 14 '19 at 20:55
  • And was there any output from running `sudo lsof -i -n -P | grep LISTEN`? – Dylan Feb 14 '19 at 20:56
  • 1
    I assume I have installed Parsoid as a package as I have literally followed the installation instructions found here: https://www.mediawiki.org/wiki/Parsoid/Setup#Ubuntu_/_Debian – ay43210 Feb 14 '19 at 20:57
  • I suspect it is a problem with your `/etc/mediawiki/parsoid` file. Parsoid is quite strict on formatting – Dylan Feb 14 '19 at 21:05
  • If i were you i would remove parsoid and reinstall, then edit the `/etc/mediawiki/parsoid` file again being careful not to accidentally add extra formatting. – Dylan Feb 14 '19 at 21:07
  • To be honest, I do not think it's a formatting issue. On the Wiki forum I found that Parsoid's config.yaml file doesn't respond well to tabs, however, I do not have any tabs within my file. I only have spaces. I already reinstalled Parsoid in a different VM on a totally different Azure environment. I reinstalled MediaWiki and all the extensions I needed for a second time. I got the exact same error in the previous VM as well. Even Parsoid.log looks almost identical. I have really no idea what the issue is. – ay43210 Feb 14 '19 at 21:21

1 Answers1

1

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

Dylan
  • 305
  • 3
  • 18
  • Thanks Dylan. I tried this as well but still no luck: `Nodejs -v` displays: v8.15.0 `npm -v` is now: 6.4.1 I am still getting the same error as before and Parsoid.log looks almost identical again. – ay43210 Feb 14 '19 at 22:00
  • What version of parsoid are you running? – Dylan Feb 14 '19 at 22:07
  • I got this after executing: `curl http://localhost:8142/version` `{"name":"parsoid","version":"0.10.0"}` so version 0.10.0 – ay43210 Feb 14 '19 at 22:10
  • Yes it does! I have also changed LocalSettings.php and Config.yaml to point towards localhost instead of pointing it towards 40.68.204.191. Now, while trying to use VisualEditor within my wiki I am getting the following error displayed: `Error loading data from server: apierror-visualeditor-docserver-http: HTTP 401. Would you like to retry?` – ay43210 Feb 14 '19 at 22:22
  • That's definitely progress! – Dylan Feb 14 '19 at 22:23
  • In Parsoid.log I am getting this message: "Your wiki requires a logged-in account to access the API." But it seems like this link can help me out: https://www.mediawiki.org/wiki/User:Andrujhon/Allow_Parsoid_Server Let's see how it goes.. – ay43210 Feb 14 '19 at 22:33
  • IT'S WORKINGGGG!!!!!! @Dylan I love you man! Wouldn't be able to do it without your help. For those interested in knowing how I solved this: 1) upgrade nodejs to v8.15.0 or latest stable version 2) upgrade npm to 6.4.1 or latest stable version 3) I changed in config.yaml and LocalSettings.php the the IP address / domain name to localhost 4) if you are getting the HTTP 401 error, see the following link to solve your issues: https://www.mediawiki.org/wiki/User:Andrujhon/Allow_Parsoid_Server Thanks a lot Dylan! – ay43210 Feb 14 '19 at 22:45
  • Glad to hear, I will update my answer with what you have said. – Dylan Feb 14 '19 at 22:46