Jump to: navigation, search

About this board

Parsoid on Raspbian : VisualEditor HTTP 500 Error

Summary by Alkydes

Install php-curl before parsoid run.

Alkydes (talkcontribs)


I'm setting up a mediawiki on my Raspberry Pi 3, it's run the Raspbian that are based on Debian stretch.

I finished up parsoid installation, but VisualEditor doesn't work.

Mediawiki version : 1.30

php version : 7.0.27-0+deb9u1 (cli) (built: Jan  5 2018 13:51:52)

curl version : 7.52.1 (arm-unknown-linux-gnueabihf)

nvm version : 0.33.8

node version : v8.10.0

npm version : 5.6.0

I don't know why VisualEdit doesn't work.

When I cilck Edit, there's no response from parsoid. Parsoid is up and running but I can't confirm it's linked with VisualEditor.

What am I doing wrong? Any suggestion?


Alkydes (talkcontribs)

curl was the answer.

$ sudo apt-get install php-curl

How to install Parsoid on Raspbian (RPi2)?

Summary last edited by Bsplu 22:15, 26 October 2017 4 months ago
  1. update node to v4.x or higher.
  2. use Parsoid/Developer setup
  3. if u get http 200, u could try install php5-curl and restart all services (talkcontribs)


I'm setting up a mediawiki on my Raspberry Pi 2, it's run the Raspbian which are based on Debian jessie. I'm stuck at the Add Wikimedia repository step, it returns this error:

Traceback (most recent call last):
  File "/usr/bin/apt-add-repository", line 167, in <module>
    sp = SoftwareProperties(options=options)
  File "/usr/lib/python3/dist-packages/softwareproperties/", line 105, in __init__
  File "/usr/lib/python3/dist-packages/softwareproperties/", line 595, in reload_sourceslist
  File "/usr/lib/python3/dist-packages/aptsources/", line 89, in get_sources
    (, self.codename))
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Raspbian/jessie

I tried changing the lsb_release to Debian and successfully add the repository but it returns this error on sudo apt-get update:

W: Failed to fetch Unable to find expected entry 'main/binary-armhf/Packages' in Release file (Wrong sources.list entry or malformed file)

I guess my only option now is too manually install Parsoid, but I'm not sure how can I config it so that it looks like I installed it via repository. Can you help me with detail config like which directory should I install parsoid?

Thanks (talkcontribs)

it cant be done since it it doesnt have binary for arm

SSastry (WMF) (talkcontribs)

I assume you are trying to install Parsoid for running VisualEditor? It doesn't matter where you install Parsoid. But, Parsoid/Developer Setup might help you there. It tells you have to start Parsoid on the commandline as well as how to set up the config files (on Ubuntu/Debian) for starting the parsoid service automatically.

Bsplu (talkcontribs)

Parsoid could not be installed directly in Raspbian. By SSastry (WMF)suggestion, we could run it with develop version.

Here is Parsoid/Developer setup.

However, the new problem for Raspbian is Develop version need node v4.x or higher. For my raspberry, v0.10.29 is the latest version(Amazing /(ㄒoㄒ)/~~).

So the first thing is to update nodejs.

Follow the steps from Beginner’s Guide to Installing Node.js on a Raspberry Pi.

It should be noticed not every raspberry works.

The second thing is install npm.

sudo apt-get install npm

After doing these, Parsoid/Developer setup will work for Raspbian.

Although Parsoid works, restbase cannot work on my raspberry. Error is " Cannot read property 'constructor' of undefined"

Alkydes (talkcontribs)

How did you install parsoid for raspbian? It's impossible.

Issue With starting on boot with CentOS 6

Summary by Arlolra

Not enough free memory.

Stationeers.Wiki (talkcontribs)

hi, i have parsoid all working and installed with CentOS, everything works fine, except i can't figure out how to re-launch the service on boot, i have tried mp2 however it seems to keep stoping and restarting the service and despite it says its running on mp2 process list it doesn't connect.

at the moment I'm launching it in an other screen in shell and letting it run, but this isn't probably the best way to achieve this.

Arlolra (talkcontribs)

If it's starting and stopping in a loop, it probably means it's crashing. What do you see in the logs? Maybe the port it's trying to bind to is already in use?

Stationeers.Wiki (talkcontribs)

when i run "node --max-old-space-size=128 bin/server.js -n 1"

it works fine, but without --max-old-space-size=128 it crashes

Arlolra (talkcontribs)

Is that true in your screen also? How much ram is available on your server?

Stationeers.Wiki (talkcontribs)

2GB , but for the last 5 hours with the command "node --max-old-space-size=128 bin/server.js -n 1" it works perfect

Arlolra (talkcontribs)

2GB free? That command starts two processes (master/worker), each with a 2GB memory limit (I believe) but they shouldn't be using that at startup.

Stationeers.Wiki (talkcontribs)

this is the output without using --max-old-space-size=128

{"name":"parsoid","hostname":"","pid":13231,"level":60,"err":{"message":"Cannot read property 'pid' of undefined","name":"TypeError","stack":"TypeError: Cannot read property 'pid' of undefined\n    at Worker.startupWorkerExit (/root/parsoid/node_modules/service-runner/lib/master.js:184:57)\n    at Worker.emit (events.js:180:13)\n    at ChildProcess.worker.process.once (internal/cluster/master.js:190:12)\n    at Object.onceWrapper (events.js:272:13)\n    at ChildProcess.emit (events.js:180:13)\n    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)","levelPath":"fatal/service-runner/unhandled"},"msg":"Cannot read property 'pid' of undefined","time":"2018-03-15T00:31:05.078Z","v":0}

Arlolra (talkcontribs)
Stationeers.Wiki (talkcontribs)


will this require a software update?

Arlolra (talkcontribs)

Yes, but that won't fix your problem, only help in diagnosing. But if you're getting success by limiting how big the heap can grow, I'm guessing there just isn't even enough free memory to start the worker.

Stationeers.Wiki (talkcontribs)

ah right, ok, thank you! will close this topic now!

Parsoid with AuthRemoteuser (private wiki)

Summary by Arlolra

User disappeared

2A02:A03F:48B8:BA00:FCD4:94B6:A36D:4719 (talkcontribs)

We have Kerberos enabled for apache which provides for every page the user. However as parsoid was not providing these credentials when connecting to http://localhost/wiki/api.php , the create/edit would fail.

We thought solving it by excluding the specific url http://localhost/wiki/api.php from authentication. However we now have the strange problem that when browsing to a page, the user is clearly logged in in the upper right corner, however when he clicks on edit, the visual editor complains about the user being 'anonymous' and consequently in the history only the ip address is logged instead of the username.

I have no clear understanding how parsoid provides the username to the api.php endpoint. What could be the issue here?

Arlolra (talkcontribs)
Mishter Jingles (talkcontribs)

Thanks for your answer.

I tried both links.

If I enable authentication in apache for http://localhost/wiki/api.php, then parsoid always gives :

"401 Unauthorized This server could not verify that you\nare authorized to access the document\nrequested.  Either you supplied the wrong\ncredentials (e.g., bad password), or your\nbrowser doesn't understand how to supply\nthe credentials required"

If I disable authentication in apache, parsoid "works" but the user is still 'anonymous'

Arlolra (talkcontribs)

After enabling authentication, you'd need to forward cookies. Did you try that?

Mszicsu (talkcontribs)

Support for sites with self-signed SSL certificates: T66003

Summary by Arlolra

Current release already does, that task is about making it more fine grained.

Kghbln (talkcontribs)

It will be nice to get this released to the public with a new version of parsoid if that is what I think it is. :)

Arlolra (talkcontribs)

Parsoid already supported sites with self-signed certs. This was just to make it configurable per wiki, rather than for all mwApis.

Kghbln (talkcontribs)

Thanks for your insight! This however is still an improvement I believe.

Arlolra (talkcontribs)

Why not just install through npm?

Summary by Arlolra

Might not be available, plus you don't get an init script / default logging setup.

Njk (talkcontribs)

Is there a reason why the documented way of setting up Parsoid is through a custom package manager rather than just doing an `npm install`?

Arlolra (talkcontribs)

Not every hosting provider allows you to npm install. The debian package comes with an init script and sets up logging and bundled dependencies.

help with Command line testing of the Parsoid node

Summary by Revansx

discovered that my CLI troubleshooting techniques were using a second web-server that was not configured properly. It needed php enabled for the localhost calls. This issue is probably only helpful to folks in an enterprise server environment with an apache policy agent and overbearing enforcement of http to https on all incoming requests.

Revansx (talkcontribs)

Please help, I am trying to troubleshoot my Parsoid node from the command line.
  From the CLI of my Centos7 host:
  1) when I type netstat -plntu
I am able to confirm that Parsoid is running on port 8000

tcp6      0      0 :::8000                :::*                   LISTEN      27853/node

2) when I type: curl
the response is the expected html page code of the api.php page
3) when I type curl
it responds with the appropriate Parsoid version info:


  4) but when I run: curl -L
it fails with:

error: Failed to parse the JSON response for Config Request path: /localhost/v3/page/html/Main_Page/
lib/index.js: Failed to parse the JSON response for Config Request
   at ConfigRequest.ApiRequest._handleBody (/opt/parsoid/lib/mw/ApiRequest.js:470:12)
   at ConfigRequest.ApiRequest._requestCB (/opt/parsoid/lib/mw/ApiRequest.js:421:8)
   at Request.self.callback (/opt/parsoid/node_modules/request/request.js:186:22)
   at emitTwo (events.js:106:13)
   at Request.emit (events.js:191:7)
   at Request.<anonymous> (/opt/parsoid/node_modules/request/request.js:1163:10)
   at emitOne (events.js:96:13)
   at Request.emit (events.js:188:7)
   at IncomingMessage.<anonymous> (/opt/parsoid/node_modules/request/request.js:1085:12)
   at IncomingMessage.g (events.js:292:16)
   at emitNone (events.js:91:20)
   at IncomingMessage.emit (events.js:185:7)
   at endReadableNT (_stream_readable.js:974:12)
   at _combinedTickCallback (internal/process/next_tick.js:80:11)
   at process._tickCallback (internal/process/next_tick.js:104:9)

my config.yaml is configured as:

uri: ''
domain: 'localhost'  

and my localsettings.php is configured as:

if ( $REMOTE_ADDR == '' ) {  $wgGroupPermissions['*']['read'] = true; $wgGroupPermissions['*']['edit'] = true; }
wfLoadExtension( 'VisualEditor' );
$wgDefaultUserOptions['visualeditor-enable'] = 1;
$wgDefaultUserOptions['visualeditor-editor'] = "visualeditor";
$wgHiddenPrefs[] = 'visualeditor-enable';
$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;
$wgVirtualRestConfig['modules']['parsoid'] = array(
'url' => 'http://localhost:8000',
'domain' => 'localhost',
'prefix' => 'localhost'
$wgVisualEditorAvailableNamespaces = [
    NS_MAIN  => true,
    NS_TALK  => true,
    NS_USER  => true,
    "_merge_strategy" => "array_plus"
$wgSessionsInObjectCache = true;
$wgVirtualRestConfig['modules']['parsoid']['forwardCookies'] = true;

here is npm version:

/opt/parsoid/ #npm version
{ parsoid: '0.8.0+git',
  npm: '3.10.10',
  ares: '1.10.1-DEV',
  http_parser: '2.7.1',
  icu: '50.1.2',
  modules: '48',
  node: '6.12.3',
  openssl: '1.0.2k-fips',
  uv: '1.10.2',
  v8: '',
  zlib: '1.2.7' }


  1. What could cause the "Failed to parse the JSON response for Config Request path" error?
  2. What other information could be relevant to the command line testing of the Parsoid
  3. What other tests can I run?
  4. Where are the Parsoid errors being logged?
Revansx (talkcontribs)
Arlolra (talkcontribs)

1) The request is being responded to with something other than JSON.

The config request is similar to,

Does that work? Does it return parseable JSON? Are there any warnings or additional characters leaking in from your LocalSettings.php?

2) Above, the path you tested in 2. was mywiki but your config.yaml says pbswiki

3) Try disabling all your extensions so that it's just Parsoid talking to the MediaWiki api and if that works, slowly re-enabled them.

4) Depends how you installed / are running the service. The default is just stderr though.

Revansx (talkcontribs)

1a. yes. "" works, but

1b. No. the response is not JSON, it appears to be the html of the API page..

... any idea why that happens?

2. *derp* .. ignore that please.. pbswiki is indeed the actual install name.. I'm tying to avoid sharing the actual site name when I share error messages and configuration settings.. i'm not always as thorough as I wish I was..

3. will do.

4. hmm.. i haven't done anything specific for a log file.. it is whatever the defaults are.. there isn't anything in config.yaml that sets a log file name and path. should there be?

Revansx (talkcontribs)

so... somewhat unrelated, I attempted to get the raw wiki text of an artcile from cURL using:


and it resulted with just the "index.php" html which I thought was strange because (regardless of parsoid) curl should be able to do that easily (right?)... and so I looked-up how to send POST data with a CURL commands and tried this:

curl --data "title=Test&action=raw"

to which the response was:

<head><title>405 Not Allowed</title></head>
<body bgcolor="white">
<center><h1>405 Not Allowed</h1></center>

...could this "405 Not Allowed" be happening to the JSON request? or is this nothing.

Revansx (talkcontribs)

In order to assist in debugging, I ran

[/opt/parsoid] #npm install log

per: "". Now I need to learn how to get it make log entries and how/where to read them.

Arlolra (talkcontribs)

From 1b above, it seems like your MediaWiki instance isn't installed correctly. Maybe whatever your webserver sitting in front of it is (Apache?) isn't passing the querystring parameters?

Whatever the case, you need to resolve that first before trying to get Parsoid to work. That config request should return JSON.

Revansx (talkcontribs)

ok.. that gives me something new to figure out.. Do you by chance know how to perform a "wikitext to html" conversion with "nodejs" at the command line?

Arlolra (talkcontribs)

With Parsoid, yes, it's echo "my '''wikitext'''" | node bin/parse --wt2html --offline

Revansx (talkcontribs)

That worked!!! :-)

[/opt/parsoid] #echo "my '''wikitext'''" | node bin/parse --wt2html --offline


<!DOCTYPE html>
<html prefix="dc: mw:"><head prefix="mwr:"><meta charset="utf-8"/><meta property="mw:pageNamespace" content="0"/><meta property="isMainPage" content="true"/><meta property="mw:html:version" content="1.6.0"/><link rel="dc:isVersionOf" href="//"/><title></title><base href="//"/><link rel="stylesheet" href="//"/><!--[if lt IE 9]><script src="//"></script><script>html5.addElements('figure-inline');</script><![endif]--></head><body data-parsoid='{"dsr":[0,18,0,0]}' lang="en" class="mw-content-ltr sitedir-ltr ltr mw-body-content parsoid-body mediawiki mw-parser-output" dir="ltr"><p data-parsoid='{"dsr":[0,17,0,0]}'>my <b data-parsoid='{"dsr":[3,17,3,3]}'>wikitext</b></p>

.. Thank you!!
and so then I tried:

[/opt/parsoid] #echo "<html><head><title>Test</title></head><body><table><tr><td>A</td><td>B</td></tr></table></body></html>" | node bin/parse --html2wt --offline

which produced



Revansx (talkcontribs)

ok.. now I'm convinced the original problem is an issue with my servers configuration.. stay tuned!

Arlolra (talkcontribs)

But note, the --offline prevents fetching any info from the MediaWiki API so you'll want to get the above fixed to use it in the context of your wiki.

Revansx (talkcontribs)

gotcha! .. it's still a great test.. I'm hoping that I can capture here all of the command line tests that one can run to systematically troubleshoot a nodejs, parsoid, VE issue and quickly show where the problem lies. If I understand right, you are saying I can remove the "--offline" switch and replace it with wiki specific info and do the same thing, right?

Arlolra (talkcontribs)

I'm saying templates and images, etc. won't resolve in offline mode. The parser is more useful when it has a mediawiki api to fetch info from.

Revansx (talkcontribs)

ok, so.. i used your example to create this api url for wikipedia:

and it produced this result:

{"batchcomplete":"","query":{"general":{"mainpage":"Main Page","base":"","sitename":"Wikipedia","logo":"//","generator":"MediaWiki 1.31.0-wmf.22","phpversion":"5.6.99-hhvm","phpsapi":"srv","hhvmversion":"3.18.6-dev","dbtype":"mysql","dbversion":"10.0.34-MariaDB","imagewhitelistenabled":"","langconversion":"","titleconversion":"","linkprefixcharset":"","linkprefix":"","linktrail":"/^([a-z]+)(.*)$/sD","legaltitlechars":" %!\"$&'()*,\\-.\\/0-9:;=?@A-Z\\\\^_`a-z~\\x80-\\xFF+","invalidusernamechars":"@:","fixarabicunicode":"","fixmalayalamunicode":"","git-hash":"fd29ac30b061c6e0c6590eed98f700a4e829a424","git-branch":"wmf/1.31.0-wmf.22","case":"first-letter","lang":"en","fallback":[],"fallback8bitEncoding":"windows-1252","writeapi":"","maxarticlesize":2097152,"timezone":"UTC","timeoffset":0,"articlepath":"/wiki/$1","scriptpath":"/w","script":"/w/index.php","variantarticlepath":false,"server":"//","servername":"","wikiid":"enwiki","time":"2018-02-26T02:08:54Z","misermode":"","uploadsenabled":"","maxuploadsize":4294967296,"minuploadchunksize":1024,"galleryoptions":{"imagesPerRow":0,"imageWidth":120,"imageHeight":120,"captionLength":"","showBytes":"","mode":"traditional","showDimensions":""},"thumblimits":[120,150,180,200,220,250,300,400],"imagelimits":[{"width":320,"height":240},{"width":640,"height":480},{"width":800,"height":600},{"width":1024,"height":768},{"width":1280,"height":1024}],"favicon":"//","centralidlookupprovider":"CentralAuth","allcentralidlookupproviders":["CentralAuth","local"],"interwikimagic":"","magiclinks":{"ISBN":"","PMID":"","RFC":""},"categorycollation":"uca-default-u-kn","wmf-config":{"wmfMasterDatacenter":"eqiad"},"citeresponsivereferences":"","linter":{"high":["deletable-table-tag","html5-misnesting","misc-tidy-replacement-issues","multiline-html-table-in-list","multiple-unclosed-formatting-tags","pwrap-bug-workaround","self-closed-tag","tidy-font-bug","tidy-whitespace-bug","unclosed-quotes-in-heading"],"medium":["bogus-image-options","fostered","misnested-tag","multi-colon-escape"],"low":["missing-end-tag","obsolete-tag","stripped-tag"]},"mobileserver":"","pageviewservice-supported-metrics":{"pageviews":{"pageviews":""},"siteviews":{"pageviews":"","uniques":""},"mostviewed":{"pageviews":""}},"readinglists-config":{"maxListsPerUser":100,"maxEntriesPerList":1000,"deletedRetentionDays":30}}}}

would you expect this to be similar to the result of the cURL command on my command?

Revansx (talkcontribs)

It just dawned on me that I need to enable php on nginx :-) .. as strange as this sounds.. I run 2 web servers:

  1. I run nginx for loop-back/localhost api calls
  2. and I run apache for all external client user access.

I do this because my server has a Security policy that says that all incoming calls to the server must have a session that is validated by a remote authentication server. This means that any server-side activity (like parsoid) using apache port 80 or 443 gets caught-up in the redirect in an attempt to force the user to achieve a validated session. I have no control over this. So, I am attempting to solve the problem by running 2 web-servers. External visitors with validated sessions use SSL apache on port 443 and localhost calls use nginx on port 8080. If that sounds crazy, then all I can say, is, I'm all ears if you know a better way to get parsoid running on a private enterprise wiki with a security policy that enforces remotely secured sessions. please let me know! :-)

Arlolra (talkcontribs)
Revansx (talkcontribs)

Yes. I solved the problem. My enterprise server environment is tricky to say the least. I have a Policy Agent running that intercepts all traffic and forwards it to a remote identity provider which enforces the session header and then routes the user back to the site for auto-login consuming the session attributes via the Remote_Auth extension.. this has been a very tricky obstacle for me in developing good command line troubleshooting techniques. I slugged through getting the parsoid service working as a sole site, but now I'm trying to install multiple sites and alter my config.yaml to host multiple wikis.. that's when everything broke on me and I wanted to troubleshoot the parsoid service from the CLI irrespective of the wiki site(s). That's why I set-up the nginx server.. so that I could have a web-server that I could talk to from the CLI that didn't have the hassles of the Policy Agent to contend with.

Revansx (talkcontribs)

the command

[/opt/parsoid]# curl -L

now produces the expected response:

<!DOCTYPE html>
<html prefix="dc: mw:" about=""><head prefix="mwr:"><meta charset="utf-8"/><meta property="mw:pageNamespace" content="0"/><meta property="mw:pageId" content="7458"/><link rel="dc:replaces" resource="mwr:revision/20496"/><meta property="dc:modified" content="2018-02-22T19:40:20.000Z"/><meta property="mw:revisionSHA1" content="1e0bc0a9623dd93bb05ca2e0d4b3862b6859e406"/><meta property="mw:html:version" content="1.6.0"/><link rel="dc:isVersionOf" href=""/><title>Test</title><base href=""/><link rel="stylesheet" href="//;only=styles&amp;skin=vector"/><!--[if lt IE 9]><script src="//"></script><script>html5.addElements('figure-inline');</script><![endif]--></head><body data-parsoid='{"dsr":[0,10,0,0]}' lang="en" class="mw-content-ltr sitedir-ltr ltr mw-body-content parsoid-body mediawiki mw-parser-output" dir="ltr"><section data-mw-section-id="0" data-parsoid="{}"><p data-parsoid='{"dsr":[0,10,0,0]}'>test 1 2 3</p></section></body></html>
  • my nodejs now works at the command line (per the above command)
  • both my VisualEditors now work in both wikis hosted on the same server with a single parsoid node.

... thanks!

mediawiki into virtual machine problem with visualeditor

Summary by Arlolra

Make sure you can access the MediaWiki API from the Parsoid machine. (talkcontribs)

I have installed mediawiki in a VM (ubuntu server 16.04) following setup given in mediawiki website. Files config.yaml and LocalSettings.php have the same 'domain' tag and the urls are reaching the correct site. As I connect from the host system I make some port forward on the VM network

host (browser) port guest (VM) port 2222 22 8081 80 8142 8142

I browe through the site ok, but when I try to edit a page with visualeditor, I get this error

Error loading data from server: apierror-visualeditor-docserver-http: HTTP 500

And in parsoid.log I get this:

{"name":"../src/lib/index.js","hostname":"pc","pid":3697,"level":40,"logType":"warn/api","wiki":"wiki$0","title":"Main_Page","oldId":null,"reqId":null,"userAgent":"VisualEditor-MediaWiki/1.30.0","msg":"Failed API request, {\"error\":{},\"retries-remaining\":1}","longMsg":"Failed API request,\n{\"error\":{},\"retries-remaining\":1}","levelPath":"warn/api","time":"2018-02-06T00:14:34.873Z","v":0}

{"name":"../src/lib/index.js","hostname":"pc","pid":3697,"level":40,"logType":"warn/api","wiki":"wiki$0","title":"Main_Page","oldId":null,"reqId":null,"userAgent":"VisualEditor-MediaWiki/1.30.0","msg":"Failed API request, {\"error\":{},\"retries-remaining\":0}","longMsg":"Failed API request,\n{\"error\":{},\"retries-remaining\":0}","levelPath":"warn/api","time":"2018-02-06T00:14:34.876Z","v":0}

{"name":"parsoid","hostname":"pc","pid":3697,"level":60,"err":{"message":"Config Request failure for \"uri\": Error: Invalid URI \"uri\"","name":"../src/lib/index.js","stack":"../src/lib/index.js: Config Request failure for \"uri\": Error: Invalid URI \"uri\"\n    at ConfigRequest.ApiRequest._requestCB (/usr/lib/parsoid/src/lib/mw/ApiRequest.js:415:15)\n    at self.callback (/usr/lib/parsoid/node_modules/request/request.js:186:22)\n    at emitOne (events.js:96:13)\n    at Request.emit (events.js:188:7)\n    at Request.init (/usr/lib/parsoid/node_modules/request/request.js:274:17)\n    at new Request (/usr/lib/parsoid/node_modules/request/request.js:128:8)\n    at request (/usr/lib/parsoid/node_modules/request/index.js:53:10)\n    at ConfigRequest.ApiRequest.request (/usr/lib/parsoid/src/lib/mw/ApiRequest.js:336:9)\n    at ConfigRequest.ApiRequest._requestCB (/usr/lib/parsoid/src/lib/mw/ApiRequest.js:412:9)\n    at self.callback (/usr/lib/parsoid/node_modules/request/request.js:186:22)\n    at emitOne (events.js:96:13)\n    at Request.emit (events.js:188:7)\n    at Request.init (/usr/lib/parsoid/node_modules/request/request.js:274:17)\n    at new Request (/usr/lib/parsoid/node_modules/request/request.js:128:8)\n    at request (/usr/lib/parsoid/node_modules/request/index.js:53:10)\n    at ConfigRequest.ApiRequest.request (/usr/lib/parsoid/src/lib/mw/ApiRequest.js:336:9)","levelPath":"fatal/request"},"msg":"Config Request failure for \"uri\": Error: Invalid URI \"uri\"","time":"2018-02-06T00:14:34.881Z","v":0}

Any help please!?


Arlolra (talkcontribs)

Error: Invalid URI \"uri\"" suggests something might be wrong with you config.yaml

Can you post what you have for mwApis? (talkcontribs)

In fact, if I change uri value to be something different , even with no sense, the error is the same.

In mwApis (config.yaml) I have this:


       - # This is the only required parameter,

         # the URL of you MediaWiki API endpoint.

         uri: ''

         # The "domain" ...

         domain: 'localhost'  # optional

And in wgVirtualRestConfig (LocalSettings,php):

$wgVirtualRestConfig['modules']['parsoid'] = array(

       'url' => '',

       'domain' => 'localhost',

       'prefix' => 'localhost'


Arlolra (talkcontribs)

Do you maybe have localsettings.js lying around as well? Parsoid might be picking that up. Or, maybe the config.yaml you're editing isn't the right one (since changing it should have some effect)? (talkcontribs)

I'm sorry the message is the same in the web page, but not in parsoid.log. I find another config file but seeing its contents, I think I has nothing to do.

sudo find / -name config.yaml




sudo find / -name localsettings.js

gives me nothing.

I've made another test:

sudo systemctl stop parsoid.service

sudo rm /var/log/parsoid/parsoid.log

sudo nano /etc/mediawiki/parsoid/config.yaml

(I set the urls as in my first post)

sudo systemctl start parsoid.service

I load main page in wiki site, and try to edit it, the same error appears y de web page. Now I get this error (which I had also seen before).

{"name":"../src/lib/index.js","hostname":"pc","pid":1753,"level":40,"logType":"warn/api/econnrefused","wiki":"wiki$0","title":"Main_Page","oldId":null,"reqId":null,"userAgent":"VisualEditor-MediaWiki/1.30.0","msg":"Failed API request, {\"error\":{\"code\":\"ECONNREFUSED\",\"errno\":\"ECONNREFUSED\",\"syscall\":\"connect\",\"address\":\"\",\"port\":8081},\"retries-remaining\":1}","longMsg":"Failed API request,\n{\"error\":{\"code\":\"ECONNREFUSED\",\"errno\":\"ECONNREFUSED\",\"syscall\":\"connect\",\"address\":\"\",\"port\":8081},\"retries-remaining\":1}","levelPath":"warn/api/econnrefused","time":"2018-02-06T17:54:20.001Z","v":0}

{"name":"../src/lib/index.js","hostname":"pc","pid":1753,"level":40,"logType":"warn/api/econnrefused","wiki":"wiki$0","title":"Main_Page","oldId":null,"reqId":null,"userAgent":"VisualEditor-MediaWiki/1.30.0","msg":"Failed API request, {\"error\":{\"code\":\"ECONNREFUSED\",\"errno\":\"ECONNREFUSED\",\"syscall\":\"connect\",\"address\":\"\",\"port\":8081},\"retries-remaining\":0}","longMsg":"Failed API request,\n{\"error\":{\"code\":\"ECONNREFUSED\",\"errno\":\"ECONNREFUSED\",\"syscall\":\"connect\",\"address\":\"\",\"port\":8081},\"retries-remaining\":0}","levelPath":"warn/api/econnrefused","time":"2018-02-06T17:54:20.016Z","v":0}

{"name":"parsoid","hostname":"pc","pid":1753,"level":60,"err":{"message":"Config Request failure for \"\": Error: connect ECONNREFUSED","name":"../src/lib/index.js","stack":"../src/lib/index.js: Config Request failure for \"\": Error: connect ECONNREFUSED\n    at ConfigRequest.ApiRequest._requestCB (/usr/lib/parsoid/src/lib/mw/ApiRequest.js:415:15)\n    at self.callback (/usr/lib/parsoid/node_modules/request/request.js:186:22)\n    at emitOne (events.js:96:13)\n    at Request.emit (events.js:188:7)\n    at Request.onRequestError (/usr/lib/parsoid/node_modules/request/request.js:878:8)\n    at emitOne (events.js:101:20)\n    at ClientRequest.emit (events.js:188:7)\n    at Socket.socketErrorListener (_http_client.js:310:9)\n    at emitOne (events.js:96:13)\n    at Socket.emit (events.js:188:7)\n    at emitErrorNT (net.js:1281:8)\n    at _combinedTickCallback (internal/process/next_tick.js:80:11)\n    at process._tickCallback (internal/process/next_tick.js:104:9)","levelPath":"fatal/request"},"msg":"Config Request failure for \"\": Error: connect ECONNREFUSED","time":"2018-02-06T17:54:20.021Z","v":0}

Arlolra (talkcontribs)

Parsoid is having trouble connecting to your MediaWiki API at

Are you sure that url works? What happens when you curl it from the same machine Parsoid is running on? (talkcontribs)

That was the point, I was only testing that url on the host machine.

I 've changed Apache to listen on 8081 and the port forward of that VM (guest) to be listening on that port and now it works!

Thanks a lot for your support!!

This post was hidden by (history)

Parsoid getting requests from client IP, not localhost or server's IP

Summary by Arlolra

Provide the correct uri for the MediaWiki API.

Goymaster (talkcontribs)

Hi, I followed the diagnostic step from Topic:Tr5deyk8qlkyd7st.

Except when Parsoid gives me the "Invalid domain" error, it shows me a different one in the log, depending on whoever the client is.

How can I circumvent that?

Arlolra (talkcontribs)

The invalid domain error usually means that there isn't a MediaWiki API setup in Parsoid's config for the specified path. Can you provide some examples of the url you're requesting and the errors?

Goymaster (talkcontribs)

I just added a VirtualHost *:8000 to handle all wildcards that match \api.php(.*)

It seems to be working fine so far.

how to run parsoid over https

Summary by Arlolra

stunnel seems misconfigured. (talkcontribs)

it is working fine for http but when i am running the same its throws the below error:

curl error:35 parsoid

Arlolra (talkcontribs)

What are you using to terminate the TLS connection, and forward to Parsoid? (talkcontribs)
Arlolra (talkcontribs)

That error code refers to an SSL_CONNECT_ERROR. Something is wrong w/ your stunnel setup. I suggest you consult the stunnel documentation and try to confirm that you can get it working in a minimal setup, without Parsoid. Once that's confirmed to be working, re-attempt to point it at Parsoid.

Kghbln (talkcontribs)

What is meant with "What are you using to terminate the TLS connection, and forward to Parsoid?"

What I did is follow the suggestion on Parsoid over HTTPS and I get the same curl error. If I access port 8142 like e.g. I get "SSL_ERROR_RX_RECORD_TOO_LONG" so I guess it is no wonder it is not working.

My stunnel4 config is like this:

cert = /etc/letsencrypt/live/
key = /etc/letsencrypt/live/

accept  = 8143
connect = 8142

"service stunnel4 status" is running:

● stunnel4.service - LSB: Start or stop stunnel 4.x (SSL tunnel for network daemons)
   Loaded: loaded (/etc/init.d/stunnel4)
   Active: active (running) since ...

So according to the current documentation it should work. Reality however tells me otherwise.

Kghbln (talkcontribs)
Kghbln (talkcontribs)

I spent another two hours figuring out a way but failed. The solution presented on the linked thread did not help either. If I added 8000 for the same domain I would like to use VE I get a proxy error form the server (500). If I configure an alternative domain for parsoid I get a curl 51 since the certs do not match.

Any help on how to set up parsoid via https will be appreciated.

Kghbln (talkcontribs)

Hmm, perhaps the setup is working as expected. The wiki is https only and the VisualEditor is working. What is not happening is setting the url parameter of $wgVirtualRestConfig to https. But that's probably why we have stunnel to enforce this is the background.