Parsoid/JS/Troubleshooting
This page is obsolete. It is being retained for archival purposes. It may document extensions or features that are obsolete and/or no longer supported. Do not rely on the information here being up-to-date. |
These instructions are specific to Parsoid/JS which is only used in MediaWiki 1.34 and below.
First, follow the setup instructions. If you aren't using Ubuntu or Debian, then you might have to follow the developer setup instructions instead.
Check that your localhost interwiki is set up correctly
[edit]1) Check that curl is installed, working, and can be accessed from anywhere on the command line:
curl
- If it says "'curl' is not recognized as an internal or external command, operable program or batch file.", then install curl and/or add its install directory to the system variables path (or move it somewhere that is in the path).
2) Check that your api is accessible from the server Parsoid is going to run on:
curl http://your-mediawiki-server/api.php
- You should get something other than (less than 10 lines) that have "<title>404 Not Found</title>" as one of the lines.
3) Set this URL in your /etc/mediawiki/parsoid/settings.js
(Parsoid/js/api/localsettings.js
in a developer install):
parsoidConfig.setMwApi({ uri: 'https://your-mediawiki-server/api.php', prefix: 'localhost', domain: 'localhost' });
- (In older versions of mediawiki, the api.php file is located in a subfolder, e.g. '/w/'. In this case, the uri would be: 'https://your-mediawiki-server/w/api.php'.)
- (The domain does not have to be localhost, it can be anything, as long as the domain in the parsoid config and LocalSettings.php match. This is especially relevant when Multiple wikis sharing the same parsoid service)
4) Now (re-)start Parsoid (sudo service parsoid restart
on Ubuntu or Debian, node server &
in a developer install) and verify that it is working:
curl -L http://localhost:8142/localhost/v3/page/html/<pagename>/
# or, for a developer install:
curl -L http://localhost:8000/localhost/v3/page/html/<pagename>/
- Usually "Main_Page" is a good candidate for <pagename>.
- The first "localhost:8xxx" is yours (Apache) web server virtual host, for example it can be: your.public-domain.com; localhost; 127.0.0.1; 192.168.0.xxx; etc.). The second "/localhost/" is those set up in: parsoidConfig.setMwApi({ ... domain: 'localhost' })
.
- You can set up any number of wikis by adding more parsoidConfig.setMwApi
statements in settings.js / localsettings.js.
5) In the Parsoid bin (or maybe tests) directory where the "parse.js" and "parserTests.js" files are, run $ echo "some harmless wikitext" | node parse
and node parserTests
.
6) If you're having troubles getting Visual Editor working, check that Parsoid works with your version of MediaWiki using the compatibility table located at: Parsoid/JS.
- Run npm version
in the command prompt to find your Parsoid version.
- The MediaWiki and Visual Editor versions can be found at "https://your-mediawiki-server/index.php?title=Special:Version"
Invalid Domain Error
[edit]Invalid domain: localhost
This error likely means there is an issue with the Parsoid configuration file. Some items to check about the configuration file are:
- Has the Parsoid service been restarted? Are there any errors in the Parsoid log file?
- Is the configuration file being read? Try putting errors in the file then restart the service and check the log to see that it saw those errors. <-- where is log file/what's it called? Try: ps aux | grep -i parsoid.log -->
- Is there an error in the configuration section for that domain? For example, "#- # This is the only required parameter," would need the first hash removed in order for for the mwApi section to be read.
Other things to check
[edit]- If your MediaWiki is private, then you need to set up VisualEditor to forward the cookie to Parsoid. See the VisualEditor instructions for this case. [1]
- If you enabled cookie forwarding, but Parsoid logs
ETIMEDOUT
(causes VisualEditor to 'load' indefinitely) when accessing a page, you may want to make sure you included the$wgSessionsInObjectCache = true
in your config, as documented in the VE instructions.
- If you enabled cookie forwarding, but Parsoid logs
- If your MediaWiki runs via SSL, make sure that your Parsoid server can access your MediaWiki without certificate errors. In other words; make sure that the certificate is valid and added to the certificate storage on your Parsoid-running system.
- Parsoid config.yaml is indentation space sensitive. Watch for correct space and placement of dashes when adding more than one wiki.
Alternatively and similarly, you can set up your webserver to listen on another port, that is not open on your firewall, thus it can be standard http without SSL, therefore be accessed by Parsoid.
- Debian package version of Parsoid stores its logs in
/var/log/parsoid/parsoid.log
. - You might also want to check the Troubleshooting section of the Extension:VisualEditor page.
VisualEditor 1.27: Image alignment causes VisualEditor to not load in REL1_27
[edit]- Check if your LocalSettings.php have '//' in the $wgUrlProtocols [2]
- If it is missing, add the '//', save the LocalSettings.php, and restart the parsoid server
- Missing the '//' will cause Visual Editor to hang at 100% blue bar on page with image
$wgUrlProtocols = array( '//' );
SELINUX ERROR "Error loading data from server: no_vrs: The VirtualRESTService"
[edit]This error occurs usually on CENTOS 6 / 7 servers running SELINUX. In order to resolve this problem please disable SELINUX. How to disable SELINUX
Parsoid 0.9.0 update brings 406 Not Acceptable docserver error in VisualEditor REL_30 on Mediawiki 1.30
[edit]You can change the config file instead of Parsoid code: edit /etc/mediawiki/parsoid/config.yaml and add strictAcceptCheck: false at the same level as "userAgent" in the beginning, i.e. just under "conf". Example:
services:
- module: lib/index.js
entrypoint: apiServiceWorker
conf:
# For backwards compatibility, and to continue to support non-static
# configs for the time being, optionally provide a path to a
# localsettings.js file. See localsettings.example.js
#localsettings: ./localsettings.js
# Set your own user-agent string
# Otherwise, defaults to:
# 'Parsoid/<current-version-defined-in-package.json>'
#userAgent: 'My-User-Agent-String'
# /!\ COMPATIBILITY for Parsoid 0.9.0 with MediaWiki before 1.31
strictAcceptCheck: false
# Configure Parsoid to point to your MediaWiki instances.
mwApis:
...
Intermittent or occasional missing images after clicking Edit for Visual Editor
[edit]With some very awesome help from #mediawiki-parsoid on IRC I've been able to resolve this error through modifications in config.yaml
for Parsoid for my installation.
The intermittent showing of images is suspected to be due to simultaneous shell sessions for the thumbnail resizing running out of memory with the default settings.
The fix is to force them to be carried out serially and to use batching. We did two things:
- Use the ParsoidBatchAPI extension
- In the
config.yaml
set:batchConcurrency: 1
andbatchSize: 1
underneath the follow YAML keys:
services: - module: lib/index.js entrypoint: apiServiceWorker conf: # ParsoidBatchAPI extension useBatchAPI: true # Serialise requests batchConcurrency: 1 batchSize: 1
Error loading data from server: apierror-visualeditor-docserver-http-error: (curl error: 7) Couldn't connect to server.
[edit]- Use the netstat command to verify that parsoid is listening on the desired port
- Use curl manually on the command line to try to connect to the parsoid api
- Check to make sure that there are no firewalls that would prevent the connection
- Verify that SELinux or other sandboxing techniques on your system do not prevent MediaWiki from making networking connections or parsoid from receiving them.
- Check the parasoid log file (ie. /var/log/parsoid/parsoid.log)
/usr/bin/nodejs: not found in log file
[edit]If on Debian, a recent update may have deleted the /usr/bin/nodejs symlink.
- Replace "nodejs" with "node" in /etc/init.d/parsoid
- sudo systemctl daemon-reload, sudo service parsoid restart
References
[edit]Parsoid is maintained by the Editing Department (Parsing Team).
Get help:
|