Talk:Parsoid/Archive

From mediawiki.org
Jump to navigation Jump to search

Parsoid working but getting JSON error

Hi,
Using windows 8- X64, ran through the the Parsoid/Setup instructions for windows.
installed git, nodejs 0.10 x86, visual studio 10 express... etc'.


localsettings.js has this:

parsoidConfig.setInterwiki( 'mywiki.server.com', 'http://mywikiserver.com/wiki/api.php' );
parsoidConfig.defaultAPIProxyURI = 'http://mycompany.proxy:8080';

Results:
I can connect to the wiki like so: http://localhost or http://mywiki.server.com

I can connect to http://localhost:8000 and get the parsoid server.
I can even run the /_rt/Parsoid test which pulls the Parsoid webpage and runs it through the parsoid server.

However, none of the following works:
http://localhost:8000/localhost/wiki/index.php/Main_Page
http://localhost:8000/localhost/Main_Page
http://localhost:8000/mywiki.server.com/Main_Page

I get a "failed to parse the JSON response" error..

Please Help!

Thanks,
M.g.
Nogmor (talk) 16:00, 25 February 2014


I used to have it working on Ubuntu 12.04 and 13.10.
But currently a new install gives the same JSON error:

ParserError: Failed to parse the JSON response for Page Fetch null

But basically everything seems to be ok:
- Parsoid can be reached on localhost:8000 and renders the page as expected
- The wiki api can be reached on the expected adress, which I did put in localsettings.js

Regards,
Henk, 19:00, 3 March 2014



I am using the latest version of Ubuntu 14.04 and installed Parsoid using parsoid repository. Then I modified settings.js to parsoidConfig.setInterwiki( 'localhost', 'http://wiki.server.com/api.php' ); which is reachable using curl and my webbrowser. I also applied changes to my LocalSettings.php. Maybe it is a permission issue? Anyway here is the error message:

500: error: Failed to parse the JSON response for Config Request path: /localhost/PinocchioP ParserError: Failed to parse the JSON response for Config Request at ApiRequest._handleBody (/usr/lib/parsoid/src/lib/mediawiki.ApiRequest.js:207:11) at ApiRequest._requestCB (/usr/lib/parsoid/src/lib/mediawiki.ApiRequest.js:171:8) at Request.self.callback (/usr/lib/parsoid/node_modules/request/request.js:123:22) at Request.EventEmitter.emit (events.js:98:17) at Request.<anonymous> (/usr/lib/parsoid/node_modules/request/request.js:1047:14) at Request.EventEmitter.emit (events.js:117:20) at IncomingMessage.<anonymous> (/usr/lib/parsoid/node_modules/request/request.js:998:12) at IncomingMessage.EventEmitter.emit (events.js:117:20) at _stream_readable.js:920:16 at process._tickCallback (node.js:415:13)

Regards,
Nekura, 19:00, 4 May 2015



Same type of error here:

 error: Failed to parse the JSON response for Config Request path: /kb/Main_page
 ParserError: Failed to parse the JSON response for Config Request
   at ApiRequest._handleBody (c:\xampp\apps\mediawiki\htdocs\extensions\parsoid\lib\mediawiki.ApiRequest.js:249:11)
   at ApiRequest._requestCB (c:\xampp\apps\mediawiki\htdocs\extensions\parsoid\lib\mediawiki.ApiRequest.js:214:8)
   at Request.self.callback (c:\xampp\apps\mediawiki\htdocs\extensions\parsoid\node_modules\request\request.js:123:22)
   at Request.emit (events.js:110:17)
   at Request.<anonymous> (c:\xampp\apps\mediawiki\htdocs\extensions\parsoid\node_modules\request\request.js:1047:14)
   at Request.emit (events.js:129:20)
   at IncomingMessage.<anonymous> (c:\xampp\apps\mediawiki\htdocs\extensions\parsoid\node_modules\request\request.js:998:12)
   at IncomingMessage.emit (events.js:129:20)
   at _stream_readable.js:908:16
   at process._tickCallback (node.js:355:11)

Windows installation went through smoothly (based on these instructions: http://www.mediawiki.org/wiki/Parsoid/Setup#Configuration) My configurations are as follows:

  • Windows 2012 x64 server
  • MediWiki 1.24
  • Python27, Node x86, Parsoid (latest from git)


Parsoid (localsettings.js) config:

// first tried this:
parsoidConfig.setMwApi('kb', 'http://localhost/mediawiki/api.php');
// and this: 
parsoidConfig.setInterwiki('kb', 'http://localhost/mediawiki/api.php');
// and even tried both...

MidiaWiki (LocalSettings.php) config:

$wgVisualEditorParsoidURL = 'http://localhost:8000'; 
$wgVisualEditorParsoidPrefix = 'kb';

Everything seems to work until MW page request comes to Parsoid for parsing...
Here is where it ends up breaking (parsoid\lib\mediawiki.ApiRequest.js):

ApiRequest.prototype._requestCB = function (error, response, body) {
    var self = this;

    if (error) {
        this.env.log('warning/api' + (error.code ? ("/" + error.code).toLowerCase() : ''),
			'Failed API request,', {
			    "error": error,
			    "status": response && response.statusCode,
			    "retries-remaining": this.retries
			}
		);
        if (this.retries) {
            this.retries--;
            // retry
            this.requestOptions.timeout *= 3 + Math.random();
            this.request(this.requestOptions, this._requestCB.bind(this));
            return;
        } else {
            var dnee = new Error(this.reqType + ' failure for '
					+ JSON.stringify(this.queueKey.substr(0, 80)) + ': ' + error);
            this._handleBody(dnee, '{}');
        }
    } else if (response.statusCode === 200) {
        this._handleBody(null, body); // <-- CODE BREAKS HERE
    } else {
        if (response.statusCode === 412) {
            this.env.log("info", "Cache MISS:", response.request.href);
        } else {
            this.env.log("warning", "non-200 response:", response.statusCode, body);
        }
        error = new Error(this.reqType + ' failure for '
					+ JSON.stringify(this.queueKey.substr(0, 80)) + ': ' + response.statusCode);
        this._handleBody(error, '{}');
    }

    // XXX: handle other status codes

    // Remove self from request queue
    delete this.env.requestQueue[this.queueKey];
};

ApiRequest.prototype._handleBody = function (error, body) {
    if (error) {
        this._handleJSON(error, {});
        return;
    }
    var data;
    try {
        data = JSON.parse(body); // <-- EXCEPTION THROWN HERE
    } catch (e) {
        error = new ParserError('Failed to parse the JSON response for ' +
				this.reqType);
    }
    this._handleJSON(error, data);
};

Any thoughts?


Exactly the same error, also when I try curl -L http://(localhost or domain which resolves locally to 127.0.0.1):8142/prefix/Article from web server's command line. MW 1.25.1.
Alex Mashin (talk) 03:07, 31 May 2015 (UTC)


I find out that when you use the Pasoid and the Media Wiki on a same sever the body star with UTF8 BOM so I managed to solve this problem with insert some extra codes on almost end of OnResponse function on /usr/lib/parsoid/src/node_modules/request/request.js file.

        if (response.body.substring(0,1) ===  "\uFEFF") {
                response.body = response.body.substring(1,response.body.length);
        }
        self.emit('complete', response, response.body);
      })
    }
    //if no callback


Mohsen Rahimi (talk) 09:30, 20 Jun 2015 (UTC)

Set up in web server?

My wiki is on the webserver running Linux 2.6. I've installed node by following

./configure --prefix=${HOME}/local/
make
make install

Now, I've downloaded Parsoid and copied into the wiki's extension directory: ${HOME}/public_html/testwiki/testwiki/extension/ And, I did

cd Parsoid/js
npm install

Edit the localsettings.js as

parsoidConfig.setInterwiki( 'testwiki', 'http://test.mydomain.com/testwiki/' );

and, run the Parsoid server like this:

cd Parsoid/js
node api/server.js

And when I checked the webpage of http://test.mydomain.com:8000/testwiki, but the browser failed to open the page.

Is there anything I missed? Would someone guide me how to set up properly in a webserver, please? (I don't have root access since it is on the webserver.)

There's a few things going on here. If this is on a remote server, is port 8000 exposed? If it's local, maybe map that subdomain to localhost in /etc/hosts. But the glaring problem is that setInterwiki is for setting the MediaWiki API path. (ie. http://test.mydomain.com/w/api.php, or some such.) Arlolra (talk) 15:37, 24 June 2015 (UTC)

Multiple wikis

Can several Mediawiki installation use the same Parsoid server? --Amir E. Aharoni (talk) 18:35, 13 October 2012 (UTC)

Yes. The Parsoid takes a prefix when the requests come in to determine which wiki you're talking about. Jdforrester (WMF) (talk) 22:34, 15 October 2012 (UTC)
Hello Jdforrester, could you please elaborate. In my setup, one Ubuntu server and two wikis (ohne http and one https) this is not working or lets say I do not know how to set it up correctly. --SmartK (talk) 08:34, 6 September 2013 (UTC)
Any news on how-to install more than one wiki on a server with Parsoid / VisualEditor running? This would be highly appreciated! Thank you!
I have tried to configure two of my wikis to use the same parsoid by adding the following to "Parsoid/js/api/localsettings.js"
parsoidConfig.setInterwiki( 'localhost', 'http://www.mytestwiki.com/api.php' );
parsoidConfig.setInterwiki( 'localhost', 'http://www.anotherwiki.com/api.php' ); 
This is sadly not working. Here (https://www.mediawiki.org/wiki/Parsoid/Troubleshooting) it said: "You can set up any number of interwikis by adding more parsoidConfig.setInterwiki statements in localsettings.js."
Could someone point me into the right direction? --SmartK (talk) 09:24, 21 January 2014 (UTC)
Is there someone how could help with this? --SmartK (talk) 16:25, 24 February 2014 (UTC)
You have to use different names for your Wikis, e.g.:
parsoidConfig.setInterwiki( 'mytest', 'http://www.mytestwiki.com/api.php' );
parsoidConfig.setInterwiki( 'another', 'http://www.anotherwiki.com/api.php' );·
Then, in the LocalSettings.php configuration file of these wikis, set $wgVisualEditorParsoidPrefix accordingly, e.g.:
$wgVisualEditorParsoidPrefix = 'mytest';
HTH, Fany (talk) 12:23, 3 March 2014 (UTC)
Dear Fany, THANK YOU. I have been trying this for at least a couple of months. With your help it now took my 5 minutes to get it running. Now both wikis are on one physical server and also have parsoid running :-) --SmartK (talk) 15:19, 3 March 2014 (UTC)


Mark
When I change the names for local host to another name the wiki gives an error server: parsoidserver-http-bad-statues-400. Yet, it works with localhost as the name. Any ideas.
Edit: Forgot to restart Parsoid. now it works great!
I was also chasing my tail with this. The parsoid configuration wiki should describe the usage of parsoidConfig.setInterwiki better! Thank you for the help.

VPS needed?

I'm running the VisualEditor on a shared server that doesn't allow background services like Parsoid to run. Is there any option to connect to a server running elsewhere? A group parsoid server perhaps? Or will everyone with a MediaWiki site have to upgrade to a VPN?

— Preceding unsigned comment added by 74.117.192.252 (talkcontribs) 13:47, 6 December 2012‎ (UTC)

Yes what? Everyone with a MediaWiki site has to upgrade to a VPS?
— Preceding unsigned comment added by 84.196.230.204 (talkcontribs) 00:35, 17 July 2013‎ (UTC)
The "yes" wasn't a reply to that comment (indeed, it was written two months previously - have now added the "unsigned" templates). To answer the question, we're looking at building out support for HTML-only wikis that will let you edit with VisualEditor without being able to run Parsoid. Stay tuned! Jdforrester (WMF) (talk) 00:43, 17 July 2013 (UTC)

Any progress on creating a shared Paroid server or an html-only wiki option with the Editor? Even an interim solution so users could avoid upgrading to a VPS? A VPS is a mighty big leap in expenses for most smaller wiki-projects (including myself). Mark Jurgens

There are fairly cheap VPS instances available these days. Examples: [1][2]. I'm using a $3/month VPS myself. -- Gabriel Wicke (GWicke) (talk) 16:45, 26 June 2014 (UTC)

Any progress on this? Shared Paroid server or an html-only wiki option with the Visual Editor? Thanks, --A2323545 (talk) 10:59, 17 February 2015 (UTC)

@Jdforrester: --Rob Kam (talk) 22:13, 21 February 2015 (UTC)

This is not planned to be begun for the next few months at the very least. Converting MediaWiki core to not use wikitext is a seriously-hard 2–3 year project. Jdforrester (WMF) (talk) 22:43, 21 February 2015 (UTC)

Gateway between NodeJS/PHP to provide MediaWiki hooks to handle third-party extensions?

Will it be possible to use the hooks from the code MediaWiki like SematicMediaWiki and processing properties Parsoid through a gateway PHP-NodeJS? Vit1251 (talk) 13:24, 19 March 2013 (UTC)

You plan to upgrade nodejs 0.9 and later? Yes Resolved

You plan to upgrade nodejs 0.9 and later? Vit1251 (talk) 13:24, 19 March 2013 (UTC)

We now support nodejs 0.10. Cscott (talk) 14:43, 14 August 2013 (UTC)

How about using the Travis-CI test Parsoid on GitHUB? Yes Resolved

How about using the Travis-CI test Parsoid on GitHUB? Vit1251 (talk) 13:24, 19 March 2013 (UTC)

We use the wikimedia foundation's repository, which uses Jenkins to do automatic integration testing. See Continuous integration/Jenkins. Cscott (talk) 14:45, 14 August 2013 (UTC)
We also have https://travis-ci.org/wikimedia/parsoid Arlolra (talk) 15:27, 24 June 2015 (UTC)

You do not plan to switch completely to GitHUB and hide you repository? Yes Resolved

Your repository is hard to see the changes and ask, and the user friendly interface and GitHUB availability issue tracker. Vit1251 (talk) 13:35, 19 March 2013 (UTC)

We use the wikimedia foundation's repository. See Gerrit for our code review tool and [3] is our gitblit installation for browsing source. There are also github mirrors at [4]. We use Bugzilla for bug tracking. See also bug 35497 which discusses ways to sync github and gerrit. I'll look into enabling yuvi's tools for the parsoid repo. Cscott (talk) 14:52, 14 August 2013 (UTC)

Running Parsoid on a "private" wiki - AccessDeniedError

I have a private wiki in which the users have to log in to read the contents. I managed to install Parsoid (for the VisualEditor extension), but when I run the API server (node api/server.js), I get the following error message.

AccessDeniedError: Your wiki requires a logged-in account to access the API. <br/>
Parsoid will not work for this wiki!

If I set

$wgGroupPermissions['*']['read'] = true;

it runs fine, but then the wiki is no longer private. I understand that mediawiki is designed to be "open", but for what I'm using it for, I need to make it private. Any idea?

Installing on a private wiki

If you want to install visual editor onto a private wiki:

$local_ip = '127.0.0.1';
if ( $_SERVER['REMOTE_ADDR'] == $local_ip ) {
   $wgGroupPermissions['*']['read'] = true;
   $wgGroupPermissions['*']['edit'] = true;
}else{
   # Disable reading by anonymous users
   $wgGroupPermissions['*']['read'] = false;
   $wgWhitelistRead = array ("Special:Userlogin", "MediaWiki:Common.css",
   "MediaWiki:Common.js", "MediaWiki:Monobook.css", "MediaWiki:Monobook.js", "-");
   # Disable anonymous editing
   $wgGroupPermissions['*']['edit'] = false;
}

--This code needs to be slightly, working on it.


Didn't work for me.. had to change it into this:
Removed: $local_ip = '127.0.0.1';
if ( $_SERVER['REMOTE_ADDR'] == "127.0.0.1" OR $_SERVER['REMOTE_ADDR'] == "public ip of the server" ) {
Ricmik (talk) 13:05, 1 September 2013 (UTC)
See here for a summary to this solution --[[kgh]] (talk) 12:13, 2 February 2018 (UTC)

Using the wiki public IP

By rarylson in March 16, 2014

If your Parsoid is configured pointing to a public IP, you need to permit this IP too:

parsoid/api/localsettings.js: (example)

parsoidConfig.setInterwiki( 'localhost', 'http://wiki.domain.com/wiki/api.php' );

wiki/LocalLocalSettings.php:

# Allow localhost (and all the loopback IPs) and the host IPs to use the api.
# See: http://www.mediawiki.org/wiki/Talk:Parsoid#Running_Parsoid_on_a_.22private.22_wiki_-_AccessDeniedError
#      http://pear.php.net/manual/en/package.networking.net-ipv4.ipinnetwork.php
#      hostname --help
$local_network = '127.0.0.0/8';
$local_ips = `hostname --all-ip-addresses`;
$local_ips = explode(" ", $local_ips);
if (Net_IPv4::ipInNetwork($_SERVER['REMOTE_ADDR'], $local_network) || 
        in_array($_SERVER['REMOTE_ADDR'], $local_ips)) {
    $wgGroupPermissions['*']['read'] = true;
    $wgGroupPermissions['*']['edit'] = true;
    $wgGroupPermissions['*']['createpage'] = true;
}

Using a local IP

By rarylson in March 16, 2014

If you set your wiki subdomain in /etc/hosts to point to localhost (or other reserved loopback IP), you doesn't need to do the $local_ips check:

/etc/hosts:

# parsoid needs comunicate with the wiki.domain.com via localhost
127.0.1.1 wiki.domain.com

wiki/LocalLocalSettings.php:

# Allow localhost (and all the loopback IPs) to use the api.
# See: http://www.mediawiki.org/wiki/Talk:Parsoid#Running_Parsoid_on_a_.22private.22_wiki_-_AccessDeniedError
#      http://pear.php.net/manual/en/package.networking.net-ipv4.ipinnetwork.php
$local_network = '127.0.0.0/8';
if (Net_IPv4::ipInNetwork($_SERVER['REMOTE_ADDR'], $local_network)) {
    $wgGroupPermissions['*']['read'] = true;
    $wgGroupPermissions['*']['edit'] = true;
    $wgGroupPermissions['*']['createpage'] = true;
}

More private wiki trouble

I may be making a silly mistake, but I've spent many many hours on it without success.

I just installed Parsoid and Visual Editor on my private mediawiki. (I use the wiki for my students to collaborate, and they sure don't like dealing with wikitext!)

I installed all the pieces, and followed the directions (I think) for the configuration. But when I click Edit, the page dims and I get an immediate "Error loading data from server: parsoidserver-http-curl-error: couldn't connect to host. Would you like to retry?" When I search for this specific error message, I get only a single hit (in Russian) which seems to be a case of another wiki admin with the same problem and no posted solution.

Here's the VisualEditor portion of my LocalSettings.php:

require_once("$IP/extensions/VisualEditor/VisualEditor.php");
$wgVisualEditorNamespaces[] = NS_PROJECT;
$wgDefaultUserOptions['visualeditor-enable'] = 1;
$wgHiddenPrefs[] = 'visualeditor-enable';
$wgVisualEditorParsoidURL = 'http://localhost:8000';
$wgVisualEditorParsoidPrefix = 'localhost';
$wgVisualEditorParsoidForwardCookies = true;
require_once( "$IP/extensions/UniversalLanguageSelector/UniversalLanguageSelector.php" );

And here's parsoid/api/localsettings.js:

exports.setup = function( parsoidConfig ) {
 parsoidConfig.setInterwiki( 'localhost', 'http://www.geometricfunctions.com/methodswiki/api.php');
 parsoidConfig.debug = true;
};

I don't know if I actually needed to install the UniversalLanguageSelector, but early on I had a message that the ULS hooks couldn't be found, and finding no definitive documentation as to whether ULS is required, I installed it.

Though I set parsoidConfig.debug to true, I wasn't sure where to find the debug output. There didn't seem to be anything from Parsoid in debug_log.txt at the top level of the wiki, nor do I see anything relevant in the error_log.

I have these versions:

mediawiki: 1.22.0
node: 0.10.25
Parsoid: 0.0.1
VisualEditor: 0.1.0  (though the package.json says 0.0.0)

If anyone is able to point me in the right direction, I'd be most grateful, as will my students; they won't miss wikitext one bit if I can get this going for them!--Scottsteketee (talk) 12:08, 9 March 2014 (UTC)

Update: I got this working, with some help, after updating to mediawiki 1.22.2 (which may or may not have been relevant) and after adding the code shown below to LocalSettings.php. (I actually used my server's IP address rather than 127.0.0.1.) The success of this approach suggests to me that setting $wgVisualEditorParsoidForwardCookies = true; was not enough to allow communications between parsoid and the mySQL database (and in fact, that setting seems to be irrelevant, in that the code below is sufficient even when $wgVisualEditorParsoidForwardCookies is set to false). Might there be something else that I've not understood?--Scottsteketee (talk) 00:11, 19 March 2014 (UTC)
if ( $_SERVER['REMOTE_ADDR'] == '127.0.0.1' ) {
 $wgGroupPermissions['*']['read'] = true;
 $wgGroupPermissions['*']['edit'] = true;
}
Another update: I updated my wiki to 1.22.4 and tested various settings in LocalSettings.php. I had the same results as before: $wgVisualEditorParsoidForwardCookies is irrelevant, and I have to set the permissions as if this is a public wiki for the VisualEditor to work. --Scottsteketee (talk) 00:47, 19 March 2014 (UTC)
Thanks for sharing this, your bit of code helped me set up Parsoid for my private wiki. --JimeoWan (talk) 16:14, 8 April 2014 (UTC)

Windows Server 2008 R2

Anyone knows how to get this running in Windows Server 2008 R2?

How can I config to allow Parsoid support multiple wiki? Yes Resolved

One of our programmer stubbornly believe that one Parsoid could only support one wiki. I know he is wrong since Wikipedia and Wikia use this in many many wikis. I just don't know how to config. Does anyone know how to config?

See js/lib/mediawiki.ParsoidConfig.js in the source code, and js/api/localsettings.js.example. Basically you need to set up 'interwiki' prefixes for all your wikis. Cscott (talk) 15:27, 14 August 2013 (UTC)
Could someone maybe show us a sample of the config for this interwiki setup? Would be great!--SmartK (talk) 08:38, 6 September 2013 (UTC)
SOLVED, see posting above (somewhere) --SmartK (talk) 16:04, 3 March 2014 (UTC)
There's an example on the setup page https://www.mediawiki.org/wiki/Parsoid/Setup#Configuration Arlolra (talk) 15:31, 24 June 2015 (UTC)

Error to install Parsoid on WAMP for Win-7x64...

Hello !

I'm French, sorry for my poor English...
I Try to install Parsoid for MediaWiki on WAMP in Windows 7 x64 from this link:
http://www.mediawiki.org/wiki/Parsoid#Getting_started

I launch the instal with:  "npm install" into :
D:\WEB\WAMP\WWW\Website\MyWiki\Extensions\Parsoid\js\

Then I get this final error at the line 281 of npm-debug.log=>
...
277 http 200 https://registry.npmjs.org/domino/1.0.8
278 silly registry.get cb [ 200,
278 silly registry.get   { vary: 'Accept',
278 silly registry.get     server: 'CouchDB/1.3.0 (Erlang OTP/R15B03)',
278 silly registry.get     etag: '"79B59T2JHOSGNNRDXW55UM8PK"',
278 silly registry.get     date: 'Fri, 14 Jun 2013 06:51:45 GMT',
278 silly registry.get     'content-type': 'application/json',
278 silly registry.get     'content-length': '3147' } ]
279 http 200 https://registry.npmjs.org/pegjs
280 silly registry.get cb [ 200,
280 silly registry.get   { vary: 'Accept',
280 silly registry.get     server: 'CouchDB/1.3.0 (Erlang OTP/R15B03)',
280 silly registry.get     etag: '"B1AA422IDG6T49O2B4HUMSAD2"',
280 silly registry.get     date: 'Fri, 14 Jun 2013 06:51:45 GMT',
280 silly registry.get     'content-type': 'application/json',
280 silly registry.get     'content-length': '19774' } ]
281 http GET https://registry.npmjs.org/events/-/events-0.5.0.tgz
282 error Error: No compatible version found: jshashes@'>=0.0.0- <1.0.0-'
282 error Valid install targets:
282 error ["1.0.2","1.0.3"]
282 error     at installTargetsError (C:\Program Files (x86)\nodejs\node_modules\npm\lib\cache.js:682:10)
282 error     at next (C:\Program Files (x86)\nodejs\node_modules\npm\lib\cache.js:661:17)
282 error     at C:\Program Files (x86)\nodejs\node_modules\npm\lib\cache.js:641:5
282 error     at saved (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\get.js:138:7)
282 error     at Object.oncomplete (fs.js:297:15)
283 error If you need help, you may report this log at:
283 error     <http://github.com/isaacs/npm/issues>
283 error or email it to:
283 error     <npm-@googlegroups.com>
284 error System Windows_NT 6.1.7601
285 error command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
286 error cwd D:\WEB\WAMP\WWW\Website\MyWiki\Extensions\Parsoid\js
287 error node -v v0.8.22
288 error npm -v 1.2.14
289 verbose exit [ 1, true ]
[EOF]

Maybe that's because "Win7" instead of "Unix" ?? Thanks for any reply, or advise to install this Parsoid...


Godvicien (talk) 07:36, 14 June 2013 (UTC)

This should be fixed, we no longer depend on jshashes. Cscott (talk) 15:27, 14 August 2013 (UTC)

Windows support

It's bad enough that only Debian based Linux distros have "apt" command, and the installation instructions are flawed for all other Linux users, but it also totally ignores Windows/Apache Windows/IIS users.

So can we even use VisualEditor and Parsoid??? If not, then this REALLY needs to be made clear upfront. As I just wasted hours updating a server to use this, only to fall at this hurdle.

We've had reports of users installing it on Windows machines, but not sure if they were using local POSIX emulation/compatibility. Sorry for the confusion. Jdforrester (WMF) (talk) 15:55, 5 July 2013 (UTC)
We could use help from the community to support Windows installation. It *should* work. If someone could write up good instructions, it would be very useful. No one on the dev team runs windows themselves. (Similarly for non-Debian/Ubuntu installs.) Cscott (talk) 14:42, 14 August 2013 (UTC)
I've installed parsoid on a Virtual ubuntu machine inside windows server. Bouncingmolar (talk) 16:11, 19 September 2013 (UTC)
I have Parsoid up, running, and working in Windows 7. See the Windows setup instructions. Basically, you need to install nodejs, which has a couple dependencies. Then you use npm (part of nodejs) to install Parsoid's dependencies. Or something like that. I'm actually struggling more to get Parsoid + VisualEditor working in an Ubuntu VM than in Windows. Oh, I almost forgot. I have Git Bash installed, but I've found CMD is much more reliable to use for running the Parsoid server. I think this is because Git Bash is not aware of environment variables. Cthughafish (talk) 16:41, 19 March 2014 (UTC)
We have recently removed the "contextify" binary dependency which was causing Windows users such hardship. Installing Parsoid on Windows should be much easier now. cscott (talk) 17:22, 22 May 2015 (UTC)

Error downloading node

I'm having difficulty downloading the correct node version as per the instructions. When I try to get the legacy version, I get:

apt-get install nodejs nodejs-legacy npm
E: Unable to locate package nodejs-legacy

And so I install the Chris Lea repository version, but then on install:

npm ERR! Not compatible with your version of node/npm: request@2.22.0
npm ERR! Required: ["node >= 0.8.0"]
npm ERR! Actual:   {"npm":"1.1.4","node":"0.6.12"}
apt-get install nodejs npm
nodejs is already the newest version.
npm is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.

Any help would be much appreciated!--Stuartbman (talk) 15:01, 21 July 2013 (UTC)

what system are you on? nodejs-legacy isn't strictly required, it just lets you type 'node' instead of 'nodejs' on the commandline. Cscott (talk) 15:27, 14 August 2013 (UTC)

TypeError: Cannot read property 'oldid' of undefined

Hello all :)

the newest Parsoid run on my server and parse all wiki text correctly. But if i want to save a page, the parsoid console output is this:

/var/www/services/Parsoid/js/api/ParserService.js:635
                var doc, oldid = req.body.oldid || null;
                                         ^
TypeError: Cannot read property 'oldid' of undefined
    at app.post.cb (/var/www/services/Parsoid/js/api/ParserService.js:635:28)
    at getParserServiceEnv (/var/www/services/Parsoid/js/api/ParserService.js:376:4)
    at MWParserEnvironment.getParserEnv (/var/www/services/Parsoid/js/lib/mediawiki.parser.environment.js:279:3)
    at setupWikiConfig (/var/www/services/Parsoid/js/lib/mediawiki.parser.environment.js:299:3)
    at ApiRequest._processListeners.processSome (/var/www/services/Parsoid/js/lib/mediawiki.ApiRequest.js:102:17)
    at process.startup.processNextTick.process._tickCallback (node.js:245:9)
worker 2942 died (1), restarting.
 - worker(2947) loading...
 - worker(2947) ready

The POST request from Wiki looks ok, Content type is "application/x-www-form-urlencoded; charset=UTF-8", the content of the request:

summary:Testedit
minor:1
format:json
action:visualeditoredit
page:Testpage
oldid:6833
basetimestamp:20130730144824
starttimestamp:20130803151237
html:htmlcontent
token:a6e377be0566413a23b9e2d52b18f115+\

Has anyone an idea what the error is? Thanks!

Had the same problem after resolving mine above, help would be really appreciated. --Stuartbman (talk) 13:22, 8 August 2013 (UTC)
Also have had the very same problem (identical trace). Solved it with switching to epress 3.x, as indicated in the article under "Install dependencies": "I had to manually change package.json for the express item from 2.5.x to 3.x in order to parsoid to work". After changing Parsoid/js/packacke.json in this way, do an "npm install" again. (When the server runs, you will get a lot of deprecation warnings, but it seems that these can be ignored.) --95.33.104.9 20:13, 11 August 2013 (UTC)
See bug 52840. It appears that this might be a 'connect' incompatibility. We don't actually recommend using express 3.x yet, since it's not compatible with express 2.x and we don't use it in production or development. Cscott (talk) 15:27, 14 August 2013 (UTC)

Error contacting the Parsoid server

Hi, I've been trying all night to get the VisualEditor to work, but no luck.

I'm running MediaWiki 1.22alpha on Ubuntu Precise. The parsoid is working ok at http://wikineering.org:8000/, the wiki too at http://wikineering.org/mediawiki/, the api too at http://wikineering.org/mediawiki/api.php

The relevant configuration variables in LocalSettings.php set as such:

$wgVisualEditorParsoidURL = 'http://localhost:8000';
$wgVisualEditorParsoidPrefix = 'localhost';

And in Parsoid/js/api/localsettings.js, I have:

parsoidConfig.setInterwiki( 'localhost', 'http://localhost/mediawiki/api.php' );

When I click on the "Edit" button, the VisualEditor loads. But when I hit "Save", I get a little "Error contacting the Parsoid server" error message right below the textarea for the edit summary. I've also tried with "wikineering" and "wikineering.org" instead of "localhost", and every combination I could come up with, but no luck. I downloaded the Lynx browser and checked that http://localhost:8000 and http://localhost/mediawiki/api.php are working. They are.

Any ideas? Thanks in advance!

See above? Does that help? Cscott (talk) 14:40, 14 August 2013 (UTC)
Indeed, I saw it only a while ago, my bad. The issue has been reported as bugzilla:52840.

Translating mathematics markup

Hello. In a discussion about the way Flow might handle mathematics markup here, I was told I don't think that anyone has said that HTML5+RDF storage precludes storage for mathematics work; that's something that the Parsoid team is working on. Is this something which is likely to be possible under Flow? It would be interesting to know how it is proposed to handle the translation and storage of <math>...</math>. There might be some interest, and even help, at en:WT:WPM. Spectral sequence (talk) 21:17, 18 August 2013 (UTC)

We are handling math just as any other tag extension. Attributes and extension content (latex in case of math) are exposed for editing. AFAIK the VisualEditor team is working both on a specialized math widget and generic tag extension editing that uses this.
Our current rendering uses the PHP default rendering (PNG images). We'd like to explore rendering to MathML with MathJax in the future (see bug 51698), but this won't affect the Latex-based editing interface at all. MathML-based editing would require a bidirectional conversion between MathML to Latex. -- Gabriel Wicke (GWicke) (talk) 19:19, 19 August 2013 (UTC)

vagrant

I tried to setup parsoid via vagrant. All I did is enabled the role. However if I try to click on that javascript edit box I get an error.

Error loading data from server:parsoidserver-http-request-error: MWHttpRequest error. Would you like to retry?

If I click yes the error occurs again and again. Do I need to configure something anything special?



I am getting the same error. Can't find the solution anywhere. Using MW 1.22.0rc2. If you create a new page and click 'Edit'. points to right section and shows up the edit bar correctly. But 'Edit' click with the existing page doesn't work and shows an alert box with that error. Also 'Edit Source' is showing a default editor in stead of visual editor.

Any solution/suggestion?




I had the same problem (though on Windows 7 using XAMPP). I solved it by prepending "http://" to the relevant URLs. In my setup:

From mediawiki/LocalSettings.php: $wgVisualEditorParsoidURL = 'http://localhost:8000';

From mediawiki/extensions/visualeditor/VisualEditor.php: $wgVisualEditorParsoidURL = 'http://localhost:8000';

From parsoid/api/localsettings.js: parsoidConfig.setInterwiki( 'localhost', 'http://localhost/mediawiki/api.php' );

Is this the correct way to do it? I don't know. But it worked for me.

Which Versions which Errors

It would be very nice to get detailed informations which 3rd party package-versions are used (node.js, D-BUS etc.). This would make it possible to follow with an optimized, dedicated system. For now I get the following output. Do I really have to install git too or is there a hint available? Actually I only want to install the extension, instead of a complete repository management system or dev- environment like Vagrant.

Debian 6:

# npm install
npm WARN package.json mediawiki-parsoid@0.0.1 No repository field.
[...]
npm ERR! not found: git
npm ERR!
npm ERR! Failed using git.
npm ERR! This is most likely not a problem with npm itself.
npm ERR! Please check if you have git installed and in your PATH.
[...]

--Steviex2 (talk) 04:40, 14 September 2013 (UTC)

Yes, I believe you need to install git at the moment. Better packaging is on our roadmap. You might also look into the https://gerrit.wikimedia.org/r/mediawiki/extensions/Parsoid/js/contrib.git repository, which should contain working versions of all the third-party npm modules used by Parsoid. Cscott (talk) 16:53, 17 September 2013 (UTC)

The mentioned directory "https://gerrit.wikimedia.org/r/mediawiki/extensions/Parsoid/js/contrib.git" is obviously empty, or the link is incorrect. Is there a trick to retrieve this info? Even after a git clone I can't see it.

--Steviex2 (talk) 07:58, 19 September 2013 (UTC)--

Run parsoid over https?

I'm installing the Visual Editor and Parsoid on a dev wiki for the company I work for to test out the visual editor before it gets released with the stable mediawiki 1.22 later this year.

The production wiki is externally faceable, and we're running over https rather than http. Is this a problem with running the webservice, which runs over http and port 8000?

Is it as simple as reconfiguring iptables, a configuration change, or something that requires fundamentally alter the Parsoid code?

Thanks, Silversonic (talk) 17:30, 14 September 2013 (UTC)

Parsoid can run over localhost on port 8000 and http. That is, VisualEditor will talk to the parsoid server, but the communication need not leave the host machine. Cscott (talk) 16:51, 17 September 2013 (UTC)

Unless I am very much mistaken, this could NOT affect http to https redirections or? --Steviex2 (talk) 05:37, 21 September 2013 (UTC)

you're correct, I was misinterpretting an error. It was due to private wikis not being supported --Silversonic (talk) 14:38, 15 November 2013 (UTC)

Error after updating Parsoid - cant start

Hi, im getting this error

/Parsoid/js$ sudo node api/server.js
 - master loading...

module.js:337
    throw new Error("Cannot find module '" + request + "'");
          ^
Error: Cannot find module 'html5'
    at Function._resolveFilename (module.js:337:11)
    at Function._load (module.js:279:25)
    at Module.require (module.js:359:17)
    at require (module.js:375:17)
    at Object.<anonymous> (/home/mham/Parsoid/js/lib/mediawiki.HTML5TreeBuilder.node.js:11:10)
    at Module._compile (module.js:446:26)
    at Object..js (module.js:464:10)
    at Module.load (module.js:353:32)
    at Function._load (module.js:311:12)
    at Module.require (module.js:359:17)

Im On Parsoid: commit d4350e6fa4c2a53bc51fdc2257a6b41a80909e9b Merge: 2f9f306 e2f1a2d Author: jenkins-bot <jenkins-bot@gerrit.wikimedia.org> Date: Wed Sep 18 00:54:36 2013 +0000

   Merge "Add a test for DSR update bug."

Is it possible to run Parsoid on "localhost" only

  • Parsoid and VisualEditor are now working great on my private Ubuntu 12.04 Server. But now I noticed that node is listening on port 8000 also on the external IP. I would prefer for node to only listen on port 8000 internally, so to speak on localhost:8000. Can someone help? --SmartK (talk) 15:29, 19 September 2013 (UTC)
    • Can someone look into this? It would be highly appreciated. --SmartK (talk) 09:22, 21 January 2014 (UTC)
      • "export INTERFACE=127.0.0.1" before node server.js will bind to 127.0.0.1 --floewe (talk) 18:46, 14 February 2014 (UTC)
      • Or if you are using the parsoid.conf for upstart, add this along with the other env variables: env INTERFACE="127.0.0.1" --Jlemley (talk) 22:02, 20 February 2014 (UTC)
        • Thank you both for replying! I tried the following as I use node server.js
Sadly Parsoid is still running on the external port :-( --SmartK (talk) 16:22, 24 February 2014 (UTC)
crontab -e (and I added the following) 
@reboot export INTERFACE=127.0.0.1
@reboot node /root/mw-parsoid/Parsoid/js/api/server.js 2>&1
I now also tried a script with:
#!/bin/bash
env INTERFACE="127.0.0.1"
node /root/mw-parsoid/Parsoid/js/api/server.js 2>&1
and also
#!/bin/bash
export INTERFACE=127.0.0.1
node /root/mw-parsoid/Parsoid/js/api/server.js 2>&1
But parsoid still responds on the external IP address!

Autostart, Restart & Stop the Service

Is there currently a run-level script available for Debian 6?

...edit...

Debian 6 Solution

Finally got it...could have been a little bit cleaner...I'm tired now :-)...

#! /bin/sh
# /etc/init.d/pslparsoid
### BEGIN INIT INFO
# Provides:		pslparsoid
# Required-Start:	$remote_fs $syslog
# Required-Stop:	$remote_fs $syslog
# Should-Start:		$local_fs
# Should-Stop:		$local_fs
# Default-Start:	2 3 4 5
# Default-Stop:		0 1 6
# Short-Description:	Start Parsoid daemon
# Description:		Start up Parsoid, Debian run-level script by PSL GbR (draft)
### END INIT INFO

# Some things that run always
env VCAP_APP_PORT="8000"
env NODE_PATH="/var/www/vhosts/xxx.vserver.de/httpdocs/extensions/Parsoid/js/node_modules"

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    cd "/var/www/vhosts/xxx.vserver.de/httpdocs/extensions/Parsoid/js"
    /usr/local/bin/node /var/www/vhosts/xxx.vserver.de/httpdocs/extensions/Parsoid/js/api/server.js >> nohup.out 2>&1 &
    ;;
  restart)
    echo "Stopping Parsoid..."
    echo "killall -9 node, could do more here..."
    killall -9 node
    ;;
  'reload'|'force-reload')
    echo "Could fail..."
    cd "/var/www/vhosts/xxx.vserver.de/httpdocs/extensions/Parsoid/js"
    /usr/local/bin/node /var/www/vhosts/xxx.vserver.de/httpdocs/extensions/Parsoid/js/api/server.js >> nohup.out 2>&1 &
    ;;  
  stop)
    echo "Stopping Parsoid..."
    killall -9 node
    ;;
  *)
    echo "Usage: /etc/init.d/pslparsoid {start|stop|restart|reload|force-reload}"
    exit 1
    ;;
esac

exit 0

...this works with often preinstalled Sysvinit too...

...any improvements???

Thx


--Steviex2 (talk) 12:07, 20 September 2013 (UTC)


A init.d script template to manage nodejs app can be found here: [node-startup]
Sunjizu (talk) 15:23, 6 July 2014 (UTC)

I would have created some function to reuse some of it, and your restart function is actually not restarting it, just killing it. My code is not tested, it might not work properly. To be good I think we should get the pid of parsoid, this code is killing every nodejs application.
#! /bin/sh
# /etc/init.d/pslparsoid
### BEGIN INIT INFO
# Provides:		pslparsoid
# Required-Start:	$remote_fs $syslog
# Required-Stop:	$remote_fs $syslog
# Should-Start:		$local_fs
# Should-Stop:		$local_fs
# Default-Start:	2 3 4 5
# Default-Stop:		0 1 6
# Short-Description:	Start Parsoid daemon
# Description:		Start up Parsoid, Debian run-level script by PSL GbR (draft)
### END INIT INFO

# Some things that run always
env VCAP_APP_PORT="8000"
env NODE_PATH="/var/www/vhosts/xxx.vserver.de/httpdocs/extensions/Parsoid/js/node_modules"

function stop() { 
  echo "Stopping Parsoid..."
  killall -9 node 
}
function start() {
  echo "Starting Parsoid..."
  cd "/var/www/vhosts/xxx.vserver.de/httpdocs/extensions/Parsoid/js"
  /usr/local/bin/node /var/www/vhosts/xxx.vserver.de/httpdocs/extensions/Parsoid/js/api/server.js >> nohup.out 2>&1 &
}

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    start
    ;;
  restart)
    stop
    start
    ;;
  'reload'|'force-reload')
    echo "Could fail..."
    start
    ;;  
  stop)
    stop
    ;;
  *)
    echo "Usage: /etc/init.d/pslparsoid {start|stop|restart|reload|force-reload}"
    exit 1
    ;;
esac
exit 0

Anyone has it working for Gentoo?

I'm a beginner there... This is in my /etc/init.d/parsoid:

// edited to working but not nice solution, see below for the final solution.

#!/sbin/runscript
# /etc/init.d/parsoid

description="Start Parsoid extension for MediaWiki"

start()
{
	ebegin "Starting Parsoid extension for MediaWiki"
 
	cd "/var/www/domain/wiki/extensions/Parsoid/js"
	nohup node api/server.js &

	eend $?
}

But obviously it runs in the console which needs to remain logged in (edit: not anymore, but sometimes throws some messages there), not speaking of remote restart of the server...

Thanks! --89.190.50.45 09:01, 26 September 2013 (UTC)

First test the script on the console. Then make sure you define the right states for rebooting etc. That helped me a lot :-). --Steviex2 (talk) 06:24, 29 September 2013 (UTC)

It works in console, but the output is shown in the console as well -> when I put it into init on boot it "hangs" on the Parsoid output and doesn't boot up properly. I need to figure out how to make it output to some log/nowhere instead of console so other programs run after it, probably in the line "node api/server.js". Stressing out I'm a linux newbie :)

Thanks, --146.102.34.101 16:04, 2 October 2013 (UTC)

For this I use ">> nohup.out" (log into file). Or "2>&1 &" send to nowhere. --Steviex2 (talk) 20:40, 2 October 2013 (UTC)


Thanks, but didn't work for me. nohup node api/server.js & kind of worked, but the final and nice solution is here:

Working init script for Gentoo

/etc/init.d/parsoid-daemon:

#!/sbin/runscript
# /etc/init.d/parsoid-daemon

description="Start Parsoid extension for MediaWiki as daemon"
pidfile="/var/run/parsoid.pid"

start() {
        ebegin "Starting Parsoid extension for MediaWiki as daemon"

        start-stop-daemon \
                --start \
                --make-pidfile --pidfile "${pidfile}" \
                --background \
                --stdout /var/log/parsoid.log \
                --stderr /var/log/parsoid-err.log \
                --exec node -- /usr/local/src/parsoid/api/server.js

        eend $?
}

stop() {
        ebegin "Stopping Parsoid extension for MediaWiki"

        start-stop-daemon --stop --pidfile "${pidfile}"

        eend $?
}

First edit the path to your server.js by your server's configuration. Then you may want to delete the stdout and stderr lines to disable logging - I think it's good only for debug use.

And ofc you need to make it default - rc-update add parsoid-daemon default.

Hope it helps others :) --89.190.50.45 21:06, 7 October 2013 (UTC)

Any working Task Manager Script for Windows Server

Does someone has it configured at run level on Windows Server?

Scripts for RHEL 6 / CentOS 6 ?

I'm a beginner on these systems. Does anybody have a working script to launch Parsoid ? _ Thanks !

I found this stackoverflow answer on how to daemonize node.js scripts. I haven't tried it but I will once I can actually get it working on our wiki that's running on cent. Please let me know if you tried it and if it works --Silversonic (talk) 03:18, 22 November 2013 (UTC)
I know your post is a few months old, but nevertheless I can confirm that it works on CentOS 6.5. I just tried it (I just had to modify the path to parsoid) and it looks just fine. Thanks for the script! --Bbommel (talk) 08:36, 17 September 2014 (UTC)
  
  #! /bin/bash
  #
  # parsoid start
  #
  # chkconfig: 345 86 14
  # description: parsoid
  #
  ### BEGIN INIT INFO
  # Provides: $parsoid
  ### END INIT INFO
  # Source function library.
  . /etc/init.d/functions
  rc=0
  # See how we were called.
  case "$1" in
    start)
          export INTERFACE=127.0.0.1
          cd /wiki/extensions/Parsoid/js
          nohup node api/server.js > /dev/null 2>&1 &
	  echo parsoid started
          ;;
    stop)
          process=`ps -ef | grep 'node api/server.js'| grep -v grep | awk '{print $2}'`
          if [ "${process}" != '' ]
	  then
	  	kill -9 $process
	  fi
          ;;
    status)
	  proc_find=`ps -ef | grep 'node api/server.js'| grep -v grep`
	  if [ "${proc_find}" = '' ]
	  then
           	echo
          	echo    parsoid is not started 
	  	echo
	  else
	  	echo ${proc_find}
          fi
	  ;;
    restart|reload)
          cd "$CWD"
	  $0 stop
          $0 start
	  ;;
    *)
          echo $"Usage: $0 {start|stop|restart|reload|status}"
          exit 1
  esac
  exit $rc

Additional Configurations

Are there any additional configuration settings for parsoid available, which are currently not mentioned? I want to play with it.

--Steviex2 (talk) 09:15, 23 September 2013 (UTC)

Cookies are forwarding, page times out

So I was able to enable cookie forwarding on our private wiki, but now the page hangs and then times out. The page itself gives an "Error loading data from server: timeout. Would you like to retry?". When I re-disable cookie forwarding I get authentication errors so I'm assuming I've at least fixed that part of the setup. On the console when I run server.js all it says is

starting parsing of localhost:Main_Page
completed parsing of localhost:Main_Page in 100501 ms

Some things about our wiki

  • we use strict ldap auth for login (although sysops can still create local accounts)
  • We run our site over https rather than http. I can run curl http://localhost:8000 and see the parsoid page but I cannot hit https://localhost:8000. I assume if Parsoid can see some aspect of the wiki that it does not matter but I have been wrong in the past.

I feel like I'm really close to getting this to work, I just can't figure out how to jump this last hurdle. Any thoughts and / or suggestions would be very welcome. Thanks --Silversonic (talk) 03:13, 22 November 2013 (UTC)

I had this problem too! Eventually found the solution. I spent all day scratching my head over this - I don't want others making the same mistake.

Short answer: In your LocalSettings.php you need:

$wgSessionsInObjectCache = true;

Long Answer: MediaWiki uses PHP sessions for storing variables unique to your session on the server. What happens is that only one script instance can access the same session. When you call session_start() it locks your session, and when the next script calls session_start() it waits for the previous session to unlock (which is usually when the script finishes running.)

However, VisualEditor which calls Parsoid, and Parsoid makes an API call back to MediaWiki. It looks something like:

'edit' -> api.php -> Parsoid -> api.php

If you're passing cookies, VisualEditor locks the session when your cookie, and Parsoid's API call also tries to lock the same session using your cookie. Of course, the API can't lock it, because VisualEditor is holding the lock, and VisualEditor is waiting for Parsoid - so we end up in a deadlock that eventually times out.

It would hang inside of GlobalFunctions.php for about 60 seconds until the outer session timed out (and by that time, the PHP script times out so nothing is returned).

Enabling $wgSessionsInObjectCache fixes this program, because rather than using a lockable session MediaWiki uses it's own object caching.

I hope that helps. --198.160.96.7 18:32, 8 May 2014 (UTC)

How to use "parsoidConfig.allowCORS" ?

I would like any subdomain of .moegirl.org allowed to use the parsoid. How to config the parsoidConfig.allowCORS to achieve this goal?

parsoidConfig.allowCORS = '*.moegirl.org'; ?

--Zoglun (talk) 03:36, 7 December 2013 (UTC)

services/parsoid versions extension/Parsoid

Can you clarify the relation between services/parsoid and extensions/Parsoid? The setup page only refers to services/parsoid, but on the main page there are references to e.g. Parsoid/js/tests. So is extensions/Parsoid not needed? Is it an old version that should be ignored, or a future version, or something completely different? When I tried, it seems that only services/parsoid is needed, but I'm confused, and it would be good to clear this up as VisualEditor is tricky enough as it is. Stephan Matthiesen (talk) 19:34, 21 December 2013 (UTC)


Yes can somebody please clarify the differece between the "service" and the "extension" as it seems the extension is wholly unnecessary when the service is installed?

In Browser MediaWiki article to HTML conversion

I want to make it easy for people with poor bandwidth and limited amounts of disk space to access the most important Wikipedia articles,

I've made a PageRanked list from December's dump and have output a highly ranked selection of articles to local files (based on available USB stick space).

I'd like to use Parsoid's parser and HTML generator as it could be a good cross-platform way to render articles fairly accurately, but it seems like there are a lot of dependencies and setup to parse an article, it's referenced templates and images. I want to do something like this:

//assuming loadArticle is a function that returns an article for the given name, as a string of markup to be parsed

html = getHTMLFromMarkup(loadArticle('United States'),loadArticle);
$('#article').html(html);

I imagine a whole bunch of templates would get looked up to render the article and some seconds later it would spit out the HTML. Can someone explain how to do this for real, or give an example that would work?

I'm not sure I'll notice any replies here so an email at luke dot stanley atsign g mail dotcom to poke me would be great!

Thank you!

Sincerely,

The Internets. —The preceding unsigned comment was added by 86.20.166.134 (talkcontribs) 18:43, 3 January 2014 (UTC)

Installing Parsoid on shared server

I'm using a shared server and don't have command line or ssh access. Is there a way to configure parsoid using node-cgi or another cgi script?

Please add support for HTTP authentication

My Wiki depends on HTTP authentication because I'm using NTLM authentication on IIS 8. Parsoid can't connect to the API. Please add this as a todo item (I realize it doesn't impact the Organization and won't be a high priority). It would help my corporate wiki's tremendously.

Thanks, Rob

--Robert.Labrie (talk) 19:54, 16 January 2014 (UTC)

Also my wikis depend on Apache HTTP Basic Authentication. I'm using in LocalSettings.php

require_once('extensions/Auth_remoteuser.php'); $wgAuth = new Auth_remoteuser();

but I think that it is basically the same problem. Parsoid can't acces api.php if it doesn't provide a valid username and password.

---

Just would like to add that I would also like Parsoid to be able to use Windows Authentication. We have an internal wiki and because of the Auth_remoteuser extension we don't have to log in to access the wiki. However, for this to work, basic authentication for the folder in IIS needs to be disabled. That makes it so that Parsoid can no longer access the API. It took me a while to figure out what was going on!

Thanks!

---

I have discovered a possible workaround to get this working with Windows Authentication. In ISS go to content view, and select API.php. Disable the windows authentication for just this file and allow anonymous connections. This allows parsoid to connect back to the Wiki API while keeping Windows Authentication working.

--GnomeSkull (talk) 18:39, 28 November 2014 (UTC)

You could alter your apache configuration to allow access from your localhost (where Parsoid is running) without Authentication:

<VirtualHost ...>
	...
	<Location />
		AuthType Basic
		AuthName "MyAwesomePage"
		AuthUserFile /etc/apache2/.htpasswd
		Require valid-user

		Order deny,allow
		Deny from all
		Allow from localhost, 10.12.10.0/24
		Satisfy any
	</Location>
</VirtualHost>

--- Seim

TypeError in Logger.js

I have this strange error:

/www/parsoid/lib/Logger.js:105
	} else if (typeof(o)==='object' && o.hasOwnProperty('msg')) {
	                                     ^
TypeError: Cannot call method 'hasOwnProperty' of null
    at Logger.flatten (/www/parsoid/lib/Logger.js:105:39)
    at /www/parsoid/lib/Logger.js:88:40
    at Array.map (native)
    at Logger.flatten (/www/parsoid/lib/Logger.js:88:9)
    at Logger.emitMessage (/www/parsoid/lib/Logger.js:173:17)
    at Logger.log (/www/parsoid/lib/Logger.js:206:9)
    at ApiRequest._requestCB (/www/parsoid/lib/mediawiki.ApiRequest.js:136:12)
    at self.callback (/www/parsoid/node_modules/request/request.js:121:22)
    at Request.EventEmitter.emit (events.js:95:17)
    at ClientRequest.self.clientErrorHandler (/www/parsoid/node_modules/request/request.js:230:10)
worker 17031 died (8), restarting.

Someone can help me? Thank you :-)

Andreabont (talk) 16:39, 14 March 2014 (UTC)

I've got the exact same problem. I tried to modify the code to test if the object 'o' is not null. The test is passed without error, but it doesn't solve the original problem. My modification is :
  105:  } else if (typeof(o)==='object' && o!=null && o.hasOwnProperty('msg')) {

And the error is now : 

  ~/src/parsoid/tests# echo '= foo =' | node parse 
  Failed API request for null ,  5 retries remaining.
  warning/api in null:Main_PageFailed API request for null ,  4 retries remaining.
  warning/api in null:Main_Page
  Failed API request for null ,  3 retries remaining.
  warning/api in null:Main_Page
  Failed API request for null ,  2 retries remaining.
  warning/api in null:Main_Page
  Failed API request for null ,  1 retries remaining.
  warning/api in null:Main_Page
  Failed API request for null ,  0 retries remaining.
  warning/api in null:Main_Page
  Page Fetch failure for null : Error: connect ETIMEDOUT
  Error
    at Logger.emitMessage (/home/nrm/src/parsoid/lib/Logger.js:178:15)
    at Logger.log (/home/nrm/src/parsoid/lib/Logger.js:206:9)
    at /home/nrm/src/parsoid/tests/parse.js:127:8
    at /home/nrm/src/parsoid/lib/mediawiki.parser.environment.js:246:3
    at setupWikiConfig (/home/nrm/src/parsoid/lib/mediawiki.parser.environment.js:300:3)
    at Object.processSome [as _onImmediate] (/home/nrm/src/parsoid/lib/mediawiki.ApiRequest.js:113:17)
    at processImmediate [as _immediateCallback] (timers.js:330:15)

Nrm (talk)

Problem with FlaggedRevs Extension

I tried to install VisualEditor on private wiki - http://www.enviwiki.cz, so we installed Parsoid + VisualEditor extension and it did not work and said - Error access server data: Parsererror. In error log I found message

PHP Fatal error: Call to a member function getTitle() on a non-object in /home/czpenviwiki/envw/w/extensions/FlaggedRevs/frontend/FlaggablePageView.php on line 1813, referer: http://www.enviwiki.cz/wiki/P%C5%AFj%C4%8Dov%C3%A1n%C3%AD_m%C4%9Bstsk%C3%BDch_kol_-_N%C4%9Bmecko?veaction=edit

When I deactivated FlaggedRevs, everything works fine (this is the current state). Any idea, where could be problem?--Jirka Dl (talk) 10:10, 15 March 2014 (UTC)

Where to locate it?

it would be nice if there is a suggested location for parsoid, does it go with extensions, should it be percived as something in /usr/local or maybe /opt .... etc.

— Preceding unsigned comment added by 197.161.84.55 (talkcontribs) 16:42, 16 January 2014‎ (UTC)

I second to to this --Harnas1977 (talk) 09:15, 4 March 2014 (UTC)
According to this change it should be located in "/usr/lib/parsoid" --[[kgh]] (talk) 19:16, 2 May 2014 (UTC)
If you install using the Ubuntu/Debian package then it's in /usr/lib/parsoid. Otherwise it doesn't matter, you specify the path/to/parsoid. -- SPage (WMF) (talk) 01:39, 16 October 2014 (UTC)

Error: SSL Error: CERT_UNTRUSTED

npm ERR! Error: SSL Error: CERT_UNTRUSTED
npm ERR!     at ClientRequest.<anonymous> (/usr/lib/nodejs/npm/node_modules/request/main.js:440:26)
npm ERR!     at ClientRequest.g (events.js:185:14)
npm ERR!     at ClientRequest.EventEmitter.emit (events.js:88:17)
npm ERR!     at HTTPParser.parserOnIncomingClient (http.js:1445:7)
npm ERR!     at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:111:23)
npm ERR!     at CleartextStream.socketOnData (http.js:1356:20)
npm ERR!     at CleartextStream.CryptoStream._push (tls.js:396:27)
npm ERR!     at SecurePair.cycle (tls.js:750:20)
npm ERR!     at EncryptedStream.CryptoStream.write (tls.js:131:13)
npm ERR!     at Socket.ondata (stream.js:38:26)
npm ERR!  [Error: SSL Error: CERT_UNTRUSTED]
npm ERR! You may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Linux 3.2.0-59-virtual
npm ERR! command "nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/nemobis/parsoid
npm ERR! node -v v0.8.2
npm ERR! npm -v 1.1.39
npm ERR! message SSL Error: CERT_UNTRUSTED
npm http GET https://registry.npmjs.org/colors
npm http GET https://registry.npmjs.org/diff
npm http GET https://registry.npmjs.org/es6-shim
npm http GET https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/html5
npm http GET https://registry.npmjs.org/pegjs
npm http GET https://registry.npmjs.org/alea
npm http GET https://registry.npmjs.org/simplediff/0.1.1
npm http GET https://registry.npmjs.org/domino
npm http GET https://registry.npmjs.org/express
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/nemobis/parsoid/npm-debug.log
npm ERR! not ok code 0

Sob.[5] --Nemo 08:22, 17 March 2014 (UTC)

dumpGrepper.js

Of course it depends on dumpReader.js which says "npm install libxmljs", but that didn't work for me.[6] --Nemo 11:02, 17 March 2014 (UTC)

Run the Server

On my debian-wheezy the start-command is not "node api/server.js" it is "nodejs api/server.js". Can anyone confirm this?

Not so for me my command is node, i think it depends on rather you build from source or install from backports.

Can we point parsoid to use node.js on a remote server?

We're running a wiki (ver 1.22.3) and would like to install parsoid for the visual editor. It runs on shared hosting that doesn't allow installing node.js. Can we point parsoid to use node.js on a remote server, eg with heroku.com's free service? If so--how would we need to tweak parsoid? --Tickle me (talk) 19:44, 28 April 2014 (UTC)

You can run parsoid on the remote heroku server, and (1) configure Parsoid to point to your openbike.org wiki so it fetches wikitext, tpls from there (2) point VE (running off your wiki) to your remote Parsoid install. Ssastry (talk) 13:46, 26 June 2014 (UTC)

auto startup sysvinit?

Debian has sysvinit instead of startup or systemd does anyone know how it might be setup with that?

http://askubuntu.com/questions/99232/how-to-make-a-jar-file-run-on-startup-and-when-you-log-out has some good information on sysvinit.
Well, two people wondering about the same thing at the same time. See me post just below. Hmm ... Probably we should work an a script and post it here. --[[kgh]] (talk) 19:17, 2 May 2014 (UTC)

Starting the Parsoid service automatically with ???

The docu only caters for upstart. So one should not dare to use sysvinit? Well one cannot since no script is provided. I am pretty lost here since I rely on Debian and not Ubuntu. :( --[[kgh]] (talk) 19:11, 2 May 2014 (UTC)

Hmm, perhaps there is something here to help the cause... --[[kgh]] (talk) 19:35, 2 May 2014 (UTC)
Oh my gosh, setting up Parsoid is being discussed here. Let's call it a day. What a waste. --[[kgh]] (talk) 19:48, 2 May 2014 (UTC)

Parsoid extension

Since Extension:Parsoid redirects here, it would probably make sense to add some instructions on how to install the actual Parsoid extension.

I second this. I found the extension and installed it - now VisualEditor is working (1.23wmf22). If the extension is required along-side the service it should be noted. I know third-party wikis are not the priority, but we are out there! --108.217.169.68 21:50, 12 May 2014 (UTC)
The extension is no longer required with the latest version of VE. It was being used temporarily (for about a month?) to provide CSS for VE. That CSS has since been moved into mediawiki core. Ssastry (talk) 03:40, 30 June 2014 (UTC)
@ssastry: However, MediaWiki 1.23 as released doesn't have that styling, so for the vast majority of third parties (who are never going to run master of MediaWiki), Parsoid's PHP extension is going to be required for a long time. :-( Jdforrester (WMF) (talk) 19:34, 30 June 2014 (UTC)

How to use Parsoid for a localhost wiki?

I installed Parsoid and it works fine. Now I want to use it for a second wiki that is installed at localhost. What are my actions?

Clear Manual Please

Hi. My name is Tim Maes. I would like to get a step by step instruction on how to set up a parsoid server on windows on a uniform server to run visual editor on a private mediawiki.
I need to set up a good working wiki site with visual editor for a very important government project in Belgium. I must finish it within one month. please help!!!
I plan to promote mediawiki as an educational tool in Belgium. I wish to present a example wiki site on a meeting next month. I hope to get founding then to expand this project. I will use a windows laptop with a Uniform Server running on a external USB drive. This server is running the mediawiki software (current stable version) and i have the visual editor extension installed on my wiki.
How do i now need to go on and get the parsoid working on my system.
I find many bits of information in this article and many others, but i can't find any clear step by step manual for how to proceed.
Can anyone please give me the instructions or tell me if there is any manual already existing.
I will need to pass on in the meeting how much effort it costs someone with basic computer knowledge to learn to set a wiki with visual editor up. It would therefore be helpfull to get a manual understandable to students with basic computing understanding.

— Preceding unsigned comment added by 86.82.150.99 (talkcontribs) 19:12, 15 June 2014‎ (UTC)

Hi, i created a mediawiki account. Thanks for inproving my comment, still new to talking on mediawiki. Got some more info and found i need to install node.js but still dont know how to start. Still need help.

Hi there. Is Parsoid Setup at all helpful? There are instructions for Windows setup. Rdicerb (WMF) (talk) 20:20, 20 June 2014 (UTC)

MediaWiki API to transform HTML into Wikitext

I would like to edit articles from pt.wikipedia but instead of getting the actual Wikitext I would like to:

  1. Fetch a HTML RDFa from an article
  2. Edit the HTML
  3. Submit the modified HTML

At the moment is it possible?

Other option would be an XSLT to transform this HTML5+RDFa into wikitext. (I'm looking for this now, but didn't find)

Guiwp (talk) 11:34, 22 June 2014 (UTC)

Please take a look @ http://www.mediawiki.org/wiki/Parsoid#The_Parsoid_web_API for converting HTML to wikitext. However, there is no direct save api in parsoid. You will still have to use the mediawiki edit api to save the converted wikitext. Ssastry (talk) 13:31, 26 June 2014 (UTC)

Error with npm install on CENTOS 6.5  : Error: No compatible version found: minimist@'^0.1.0'

Any Ideas?

17125 error Error: No compatible version found: minimist@'^0.1.0'
17125 error Valid install targets:
17125 error ["0.0.0","0.0.1","0.0.2","0.0.3","0.0.4","0.0.5","0.0.6","0.0.7","0.0.8","0.0.9","0.0.10","0.1.0","0.2.0"]
17125 error at installTargetsError (/usr/local/lib/node_modules/npm/lib/cache.js:682:10)
17125 error at /usr/local/lib/node_modules/npm/lib/cache.js:597:10
17125 error at saved (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:138:7)
17125 error at Object.oncomplete (fs.js:297:15)
17126 error If you need help, you may report this log at:
17126 error <http://github.com/isaacs/npm/issues>
17126 error or email it to:
17126 error <npm-@googlegroups.com>
17127 error System Linux 2.6.32-431.17.1.el6.x86_64
17128 error command "/usr/local/bin/node" "/usr/local/bin/npm" "install"
17129 error cwd /root/parsoid
17130 error node -v v0.8.22
17131 error npm -v 1.2.14
17132 verbose exit [ 1, true ]

apt repo broken?

I followed the instructions to install the apt repo on my machine (Ubuntu 14.04), but when running "apt-get update", I get this (other output removed for brevity):

...
Err http://parsoid.wmflabs.org:8080 wmf-production/main amd64 Packages
  404  Not Found
...
W: Failed to fetch http://parsoid.wmflabs.org:8080/debian/dists/wmf-production/main/binary-amd64/Packages  404  Not Found
(Use ~~~~ to sign your posts.) It worked for me just now. http://parsoid.wmflabs.org:8080/deb responds. There's a package at http://parsoid.wmflabs.org:8080/deb/dists/wmf-production/main/binary-amd64/Packages , note deb not debian as you typed. -- SPage (WMF) (talk) 01:45, 16 October 2014 (UTC)

Mwhttprequest error and blank page with VisualEditor & Parsoid

Getting the mwhttprequest error as stated by a couple people below, but using their solution didn't work for me. I have the objectcache flag uncommented for VisEd, api's are pointed to the right page, but if I try to edit a page, I get the parsoid mwhttp error, if I try to add a new page, I just get nothing, blank load. Anyone have ideas?

Pages need update for Ubuntu / Debian package

I was able to apt-get install parsoid following the instructions, it installed version 0.1.12. But some parts of the documentation are out of sync with this approach:

  • the tests and api directories are down a level inside src/
  • it's unclear if you need to run npm install (you don't)
  • it's very unclear if you have to make any configuration changes. The default /etc/mediawiki/parsoid/settings.js seems set up for a local wiki. But, /etc/default/parsoid has PORT="8142" which doesn't match localsettings.js, nor does it match $wgVisualEditorParsoidURL = 'http://localhost:8000';. To make Parsoid work I changed the latter line in LocalSettings.php to match 8142.

Thanks for all you do! -- SPage (WMF) (talk) 02:01, 16 October 2014 (UTC)

port bind AECCES in openshift node.js service

Hi. Eager to deploy the VisualEditor, I tried to install parsoid over Openshift cloud platform (which has a limited but very useful free account option).

I am trying to launch parsoid as writen in the extension page, but when I launch Server.js, I get Bind AECCES message (after getiing the 7 workers message), which I assume to be caused by port configuration problem I have'nt been able to solve.

Any suggestions over a possible solution? (posted also at http://stackoverflow.com/questions/26593862/port-bind-aecces-in-openshift-node-js-service-for-installing-mediawiki-parsoid)

localhost:8000 didn`t work

Hello, got some problems with Parsoid.

Have to install NodeJS(v0.10.33), npm(2.1.5) and parsoid on Ubuntu 14.04.1 LTS.

Do sudo npm install (there are no errors, its ok), then configure localsettings.js:

parsoidConfig.setInterwiki( 'localhost', 'http://yoursite.com/api.php' );

http://yoursite.com/api.php - opens well. But when I start Parsoid web service (it shows me, that there are 4 workers, and each of em is ready), I can`t access to http://localhost:8000/ - "Web page not available"

Can u help me, what should I fix? Maybe some problems with port?

Update

Now I have another problem, when already connect to server and trying to parse any page, I have getting an error

  Cannot read property 'length' of undefined Stack:
  peg$parsetlb (eval at <anonymous> (/opt/bitnami/apps/parsoid/lib/mediawiki.tokenizer.peg.js:89:38))
  peg$parsetoplevelblock (eval at <anonymous> (/opt/bitnami/apps/parsoid/lib/mediawiki.tokenizer.peg.js:89:38))
  Object.parse (eval at <anonymous> (/opt/bitnami/apps/parsoid/lib/mediawiki.tokenizer.peg.js:89:38))
  PegTokenizer.tokenizeAsync (/opt/bitnami/apps/parsoid/lib/mediawiki.tokenizer.peg.js:206:24)
  PegTokenizer._processText (/opt/bitnami/apps/parsoid/lib/mediawiki.tokenizer.peg.js:180:8)
  PegTokenizer.process (/opt/bitnami/apps/parsoid/lib/mediawiki.tokenizer.peg.js:119:7)
  ParserPipeline.process (/opt/bitnami/apps/parsoid/lib/mediawiki.parser.js:485:21)
  Object.Util.processContentInPipeline (/opt/bitnami/apps/parsoid/lib/mediawiki.Util.js:1109:12)

This is not the same error like bug 52840 coz my express and connect versions looks fine:

├── alea@0.0.9
├── async@0.9.0
├─┬ bunyan@1.0.1
│ └─┬ mv@2.0.3
│   ├─┬ mkdirp@0.5.0
│   │ └── minimist@0.0.8
│   ├── ncp@0.6.0
│   └── rimraf@2.2.8
├─┬ chai@1.9.2
│ ├── assertion-error@1.0.0
│ └─┬ deep-eql@0.1.3
│   └── type-detect@0.1.1
├── colors@0.6.2
├── diff@1.0.8
├── domino@1.0.18
├── entities@1.1.1
├── es6-shim@0.16.0
├─┬ express@2.5.11
│ ├─┬ connect@1.9.2
│ │ └── formidable@1.0.15
│ ├── mime@1.2.4
│ ├── mkdirp@0.3.0
│ └── qs@0.4.2
.......
Had the same problem but it dissapeared after updating all my wikis to 1.24. --Wess (talk) 10:30, 4 December 2014 (UTC)

error using the extension version

HI

See Extension talk:Parsoid

Christharp (talk) 18:19, 12 November 2014 (UTC)

problems in completing full round-trip: name lookup timed out error

Hi. I have installed parsoid over a remote node host, and managed to make it work with an experimental wiki instance. However, when I tried to bring VisualEditor to my stable wiki it resulted in the following behaviour - at first, the editor worked, but when re-editing, it "forgot" the last time edits. After repeating this action three or four times it resulted in the following error message: parsoid-server-http-request-error: "name lookup timed out". I tried many different settings (with/without object cache, with/without cookie forwarding with/withous https:) but didn't manage to change this. When trying to reproduce the problem from parsoid itself, I found that it was always bringing the latest wiki text, but it didn't always secceed in loading the latest html DOM, and sometimes needed couple of refreshes in order to do so. any idea? --Wess (talk) 21:50, 1 December 2014 (UTC)

That's a DNS resolution error. What Parsoid url are you using? Arlolra (talk) 16:44, 24 June 2015 (UTC)

Returning Categories in generated Html Yes Resolved

Is it possible to tell Parsoid to generate in addition to html from the usual wiki text also the links to the Category pages? --Tomaschwutz (talk) 15:34, 5 December 2014 (UTC)

No. Parsoid renders the categories as links in the page. See the spec. But you should be able to query the page with document.querySelectorAll('link[rel="mw:PageProp/Category"]') and produce it yourself. Hope that helps. Arlolra (talk) 16:41, 24 June 2015 (UTC)

Parsing a subPage Yes Resolved

How do I configure Parsoid to handel subpages? When I try to parse a subpage, Parsoid does not stop: http://localhost:8000/w/twutz:Panikov95/1_Historical_development_of_microbial_growth_theory yields in the console where I started the parsoid server:

[warning/api][w/Twutz:Panikov95/1_Historical_development_of_microbial_growth_theory?oldid=23884] Failed API request, {"error":{"code":"ETIMEDOUT"},"retries-remaining":0}
[warning/api][w/twutz:Panikov95/1_Historical_development_of_microbial_growth_theory] Failed API request, {"error":{"code":"ETIMEDOUT"},"retries-remaining":6}
[warning/api][w/Twutz:Panikov95/1_Historical_development_of_microbial_growth_theory?oldid=23884] Failed API request, {"error":{"code":"ETIMEDOUT"},"retries-remaining":5}

... And it tries so on for minutes. --Tomaschwutz (talk) 19:23, 5 December 2014 (UTC)

You need to url encode the / (ie. %2F). http://localhost:8000/w/twutz:Panikov95%2F1_Historical_development_of_microbial_growth_theory should work. Arlolra (talk) 16:36, 24 June 2015 (UTC)

Running Parsoid on Shared Hosting with Apache Yes Resolved

We are trying really hard to understand how to setup Parsoid so we can use Visual Editor on our public wiki. Our wiki is on a shared hosting plan and I am not clear if setting up parsoid on shared hosting is possible, can some one please enlighten us if it is possible, and if so, are there any instructions on setting up Parsoid on shared hosting? Thank you very much. John Morris (talk)

It should definitely be possible. Please see the setup instructions. Arlolra (talk) 16:34, 24 June 2015 (UTC)

Active Processes Always

I set up parasoids on my server and encountered very high levels of cpu average load. The parasoid processes stayed active on the process list even though no one was editing. Is there a way to put them to sleep while no one is editing (otherwise it runs too high a load all the time)? --129.98.153.143 01:37, 14 January 2015 (UTC)

I'd be interested to know what's causing the load. If you can produce a test case that produces a spike that'd be great. The processes should sit idle when not being used. Arlolra (talk) 16:32, 24 June 2015 (UTC)

Failed API request

I was using Parsoid for VisualEditor successfully on MediaWiki 1.23. I updated MediaWiki to 1.24.1 (and updated VE accordingly). Now VE fails to edit pages (all pages, even the simplest ones). I can see there's a problem in parsoid.log :

[info][localhost/myPageName] starting parsing
[warning/api][localhost/myPageName] Failed API request, 8 retries remaining.
[warning/api][localhost/myPageName] Failed API request, 7 retries remaining.
[info][localhost/myPageName?oldid=1994] completed parsing in 100683 ms

Each line (except the first) takes some time to show up one after the other (probably waiting for a timeout). And it always stops after "7 retries remaining" (I also imagine there's a global timeout). During the whole thing, my wiki hangs (VE loading progress bar running, and if I try to load another page, it loads until parsoid finishes the whole sequence).

I followed instructions there : http://www.mediawiki.org/wiki/Parsoid/Troubleshooting All is fine (as it was fine before the update)...

I tried to update parsoid (fresh git clone), and I also tried with a previous parsoid version (the one I used with 1.23). Same problem.

At least I'd like to print out the API request that fails in order to try to execute it by myself and see the result... But if someone has a better idea, let me know ! Thanks in advance.

EDIT : I used "tail -f access_log" to see the request done by Parsoid. I reproduced it using curl, and everything is fine (I get the JSON object containing my page's content).

I don't know if it's useful, but MediaWiki api requests (from the user and from parsoid) are shown at the very end only (but parsoid starts parsing at the beginning). To sum up :

I click on "Edit" on a wiki page
Loading progress bar is shown on the wiki
parsoid.log + [info][localhost/myPageName] starting parsing (nothing appear on access_log at this point !)
...Long wait...
parsoid.log + [warning/api][localhost/myPageName] Failed API request, 8 retries remaining.
...Long wait...
parsoid.log + [warning/api][localhost/myPageName] Failed API request, 7 retries remaining.
...Long wait...
parsoid.log + [info][localhost/myPageName?oldid=1994] completed parsing in 100683 ms
access.log + 192.168.1.247 - userName [06/Mar/2015:13:43:00 +0100] "GET /wiki/api.php?format=json&uselang=fr&action=visualeditor&paction=parse&page=myPageName HTTP/1.1" 200 109 "https://myMediaWiki/wiki/index.php/myPageName?veaction=edit" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0"
access.log + 127.0.0.1 - - [06/Mar/2015:13:43:01 +0100] "GET /wiki/api.php?format=json&action=query&prop=revisions&rvprop=content%7Cids%7Ctimestamp%7Cuser%7Cuserid%7Csize%7Csha1%7Ccontentmodel%7Ccomment&revids=883 HTTP/1.1" 200 941 "-" "Parsoid/0.1"
access.log + 127.0.0.1 - - [06/Mar/2015:13:43:41 +0100] "GET /wiki/api.php?format=json&action=query&prop=revisions&rvprop=content%7Cids%7Ctimestamp%7Cuser%7Cuserid%7Csize%7Csha1%7Ccontentmodel%7Ccomment&revids=883 HTTP/1.1" 200 941 "-" "Parsoid/0.1"
access.log + 127.0.0.1 - - [06/Mar/2015:13:44:21 +0100] "GET /wiki/api.php?format=json&action=query&prop=revisions&rvprop=content%7Cids%7Ctimestamp%7Cuser%7Cuserid%7Csize%7Csha1%7Ccontentmodel%7Ccomment&revids=883 HTTP/1.1" 200 941 "-" "Parsoid/0.1"

If I reproduce the first api request (sent by the wiki using VisualEditor), I get :

{"error":{"code":"parsoidserver-http-timed-out","info":"http://localhost:8000/localhost/myPageName?oldid=883: "}}

I don't know how to investigate further...

I would start by testing Parsoid independent of VE. What happens when you go http://localhost:8000/localhost/myPageName?oldid=883 in your browser? Does Parsoid render the page? If not, see what the MediaWiki API returns for these requests /wiki/api.php?format=json&action=query&prop=revisions&rvprop=content%7Cids%7Ctimestamp%7Cuser%7Cuserid%7Csize%7Csha1%7Ccontentmodel%7Ccomment&revids=883 Arlolra (talk) 16:52, 24 June 2015 (UTC)

Syntax error

I have been receiving the following error when I try to use Parsoid to edit mediawiki pages:

Error loading data from server: parsoidserver-http-bad-status: 500: Expected "!", "$", "&", "(", ".", character class, comment, end of line, identifier, literal or whitespace but "{" found.. Would you like to retry?

I have looked all over, but I couldn't find anything on this error. I think that it is a syntax error in one of the javascript files, but I have been unable to find which one. Has anyone else seen this?

Update: Changed line 542 in pegjs/lib/parser.js from

return "Expected " + expectedDesc + " but " + foundDesc + " found.";

to

return "Expected " + expectedDesc + " but " + foundDesc + " found."+input;

and I can now see the text of the file that is causing the error. Will post what I find.


After a few grep commands pointed at the parsoid folder I found that the file generating the error is: parsoid/lib/pegTokenizer.pegjs.txt.
Was able to get better error detection... Add the following the the pegjs/lib/parser.js file:
Make a new line under 481; these lines should be lines 482 and 483:

lines = Array();
lines.push("LINE: "+peg$computePosDetails(peg$currPos).line+" COLUMN: "+peg$computePosDetails(peg$currPos).column);

Make a new line under line 541; these lines should be lines 542-544:

var ttlines="";
for (var x = 0; x < lines.length; x++){
ttlines += lines[x]+" ";}

Edit line 545 to be:

return "Expected " + expectedDesc + " but " + foundDesc + " found. "+ttlines;

...and yay, we now actually get to know where in the parsoid/lib/pegTokenizer.pegjs.txt file it finds a syntax error! If a pegjs dev is looking at this I suggest you add this to the error code. It should have been there in the first place... A part to actually tell people what file is generating the error would be expected too. Since I found this in an earlier step I'm not going to figure out a different way to figure it out.

I'm not sure if it is the hacked together install I have (npm doesn't work behind our firewall) or an actual issue, but I got syntax errors on the following lines in parsoid/lib/pegTokenizer.pegjs.txt.:

254, 332, 432, 689, 734, 737, 808, 827, 1182, 1184, 1201, 1215, 1311, 1313, 1342, 1344,
1404, 1407, 1410, 1413, 1416, 1427, 1430, 1433, 1436, 1439, 1636, 1640, 1665, 1677,
1725, 1740, 1755, 1783, 1791, 1985

There are too many to report the changes, but refer to http://pegjs.org/documentation#generating-a-parser for help. I mostly needed to simply add a & before {, but for line 254 I needed a second &sol. Some progress, but now I get this:

Error loading data from server: parsoidserver-http-bad-status: 500: Infinite loop detected.. Would you like to retry?

Looks like it's time to edit pegjs/compiler/passes/report-infinite-loops.js to include useful error reporting...
Figured out how to get the line and column number where the error is coming from. Run: /pegjs/bin/pegjs /parsoid/lib/pegTokenizer.pegjs.txt

I was able to find and remove the infinite loops, but now I get the following:

Error loading data from server: parsoidserver-http-bad-status: 500: peg$reportedPos is not defined
ReferenceError: peg$reportedPos is not defined
    at peg$c11 (eval at <anonymous> (/home/appl/parsoid/lib/mediawiki.tokenizer.peg.js:91:38), <anonymous>:77:27)
    at peg$parseredirect_word (eval at <anonymous> (/home/appl/parsoid/lib/mediawiki.tokenizer.peg.js:91:38), <anonymous>:1892:16)
    at peg$parseredirect (eval at <anonymous> (/home/appl/parsoid/lib/mediawiki.tokenizer.peg.js:91:38), <anonymous>:1646:12)
    at peg$parseblock (eval at <anonymous> (/home/appl/parsoid/lib/mediawiki.tokenizer.peg.js:91:38), <anonymous>:2077:14)
    at peg$parsetlb (eval at <anonymous> (/home/appl/parsoid/lib/mediawiki.tokenizer.peg.js:91:38), <anonymous>:2032:14)
    at peg$parsetoplevelblock (eval at <anonymous> (/home/appl/parsoid/lib/mediawiki.tokenizer.peg.js:91:38), <anonymous>:1923:12)
    at Object.peg$parse (eval at <anonymous> (/home/appl/parsoid/lib/mediawiki.tokenizer.peg.js:91:38), <anonymous>:17558:18)
    at PegTokenizer.tokenizeAsync (/home/appl/parsoid/lib/mediawiki.tokenizer.peg.js:216:24)
    at PegTokenizer._processText (/home/appl/parsoid/lib/mediawiki.tokenizer.peg.js:190:8)
    at PegTokenizer.process (/home/appl/parsoid/lib/mediawiki.tokenizer.peg.js:126:7). Would you like to retry?

Will post solution when/if I find one. Rolled pegjs back to an older version, and this error is now gone. Parsoid now just sits and loads, but never lets me edit and eventually times out. I'd be willing to bet I messed up something in the pegTokenizer.pegjs.txt file.
Restored the pegTokenizer.pegjs.txt file to the one from Github and I am still getting the same behavior.
Updated to newest version of parsoid, and I am still having issues with the parser timing out.

You need to use the fork of PEG.js we've listed in our package.json Arlolra (talk) 16:29, 24 June 2015 (UTC)

Parsoid Errors - Solved

A very large number of posts here are people with the same problem: Connection issues with Parsoid and your wiki pages.

  1. Make sure you are using the 32-bit version of node!
  2. Make sure the service isn't firewalled out

Schalice (talk) 05:05, 18 May 2015 (UTC)

Interesting, why the 32-bit recommendation? Parsoid doesn't have any binary module dependencies. Arlolra (talk) 16:54, 24 June 2015 (UTC)
because I tried 64-bit and it didn't work..... Schalice (talk) 20:09, 26 July 2015 (UTC)

VisualEditor / Parsoid link broken after upgrade to mediawiki 1.25

UPDATE: Fixed! I changed localhost to 127.0.0.1 in: $wgVisualEditorParsoidURL = 'http://127.0.0.1:8000';

I just upgraded my mediawiki install to 1.25, and I downloaded the 1.25 version of VisualEditor using the mediawiki.org Extension Distributor (here).

If I go to edit a wiki page, it starts to load fine; it loads the Visual Editor toolbar (greyed out) and the progress bar goes to the end, but is no longer talking to my Parsoid service. I get a parsoid error:

Error loading data from server: 0: parsoidserver-http: HTTP 0. Would you like to retry?

This is not like other parsoid errors I have seen. I tried restarting parsoid and it didn't help. I can reach http://localhost:8000 where the parsoid runs and it works just fine there, including roundtrip tests.

If I go to create a new wiki page, the VisualEditor does load, and I can use it for tables and all that fancy new stuff. But it won't save or preview because that also requires Parsoid. So it is just that something has changed in the way it talks to the Parsoid server. The Parsoid server itself has not changed, though. It was working fine with mediawiki 1.24.

This is a Windows server with 32-bit node.js. The mediawiki uses LdapAuthentication. I believe the parsoid server is configured correctly, because it was working before with 1.24.

My LocalSettings.php settings:

require_once "$IP/extensions/VisualEditor/VisualEditor.php";
$wgDefaultUserOptions['visualeditor-enable'] = 1; // Enable by default for everybody
$wgHiddenPrefs[] = 'visualeditor-enable'; // Don't allow users to disable it
$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1; // OPTIONAL: experimental features
$wgVisualEditorParsoidURL = 'http://localhost:8000'; // URL to Parsoid service (must not end in slash)
$wgVisualEditorParsoidPrefix = 'localhost';
$wgSessionsInObjectCache = true;
$wgVisualEditorParsoidForwardCookies = true;

Any help would be greatly appreciated. Thanks.


I couldn't get 1.25 to work for the same reason, no solution, and just fell back to 1.24.... Schalice (talk) 21:07, 27 May 2015 (UTC)
What does http://localhost:8000/localhost give you? If that works, then the problem is likely with the VE configuration. Do Parsoid's logs show the requests from VE? It could be the way that localhost is resolving. In one case an IPv6 address (::1) and in the other an IPv4 (127.0.0.1). Try changing 'http://localhost' to 'http://127.0.0.1'. Arlolra (talk) 17:07, 24 June 2015 (UTC)
THANK YOU Arlolra! I changed localhost in this line: $wgVisualEditorParsoidURL = 'http://127.0.0.1:8000'; (but didn't change the Prefix). It works now!

Installation on OS X Yes Resolved

On the Parsoid/Setup page, there is a link to :

Parsoid/Setup#Manual installation on Linux or Mac OS X

but this paragraph seams to have disappeared : (

Is it still possible to find instruction for this case ?

Thx for any help : )

--Dieudo (talk) 13:53, 31 May 2015 (UTC)

Resolved by this edit. Arlolra (talk) 15:09, 24 June 2015 (UTC)

Error: Cannot find module '/etc/mediawiki/parsoid/bin/server.js'

With UBUNTU 14 LTS, on nodejs bin/server.js --Krauss (talk) 16:35, 29 October 2015 (UTC)

bin/server.js is in parsoid master and we haven't released a deb pkg with that as yet. So, need more details about how you installed Parsoid. Maybe show up on #mediawiki-parsoid on IRC and it will be quicker. (PS: Is there a reason you didn't use our current Talk page and edited the archived content?) SSastry (WMF) (talk) 16:37, 29 October 2015 (UTC)

Can see VisualEditor interface but can't use it

After installing all the required stuff for VisualEditor (including Parsoid), as well as forwarding cookies according to this: https://www.mediawiki.org/wiki/Extension:VisualEditor#Linking_with_Parsoid_in_private_wikis (because I'm on a private wiki), I can see the interface, write something, but went I send my message, it says: Internal Server Error... --2A01:E35:2F5E:A0E0:948F:579B:2435:72DB 00:44, 19 March 2016 (UTC)