Page MenuHomePhabricator

Print helpful 'your API is not reachable' message instead of TypeError: Cannot set property '0' of null at Object.WikiConfig
Closed, DeclinedPublic

Description

Author: stephdechine

Description:
I have just installed Parsoid for my private MediaWiki. However when I try to use VisualEditor, I got parsoidserver-http-bad-status: 500. Then I had checked localhost:8000, and that page displays correctly, but http://localhost:8000/en/Main_Page does not work as expected, and some error messages are thrown out.

TypeError: Cannot set property '0' of null

at Object.WikiConfig (/var/www/localhost/htdocs/wiki/extensions/Parsoid/js/lib/mediawiki.WikiConfig.js:52:29)
at Function.MWParserEnvironment.getParserEnv (/var/www/localhost/htdocs/wiki/extensions/Parsoid/js/lib/mediawiki.parser.environment.js:268:16)
at getParserServiceEnv (/var/www/localhost/htdocs/wiki/extensions/Parsoid/js/api/ParserService.js:365:22)
at app.post.oldid (/var/www/localhost/htdocs/wiki/extensions/Parsoid/js/api/ParserService.js:629:2)
at callbacks (/var/www/localhost/htdocs/wiki/extensions/Parsoid/js/node_modules/express/lib/router/index.js:272:11)
at param (/var/www/localhost/htdocs/wiki/extensions/Parsoid/js/node_modules/express/lib/router/index.js:246:11)
at pass (/var/www/localhost/htdocs/wiki/extensions/Parsoid/js/node_modules/express/lib/router/index.js:253:5)
at Router._dispatch (/var/www/localhost/htdocs/wiki/extensions/Parsoid/js/node_modules/express/lib/router/index.js:280:5)
at Object.Router.middleware [as handle] (/var/www/localhost/htdocs/wiki/extensions/Parsoid/js/node_modules/express/lib/router/index.js:45:10)
at next (/var/www/localhost/htdocs/wiki/extensions/Parsoid/js/node_modules/express/node_modules/connect/lib/http.js:204:15)

My OS is Gentoo Linux with everything up-to-date.

I fetched the Parsoid extension by using git.

I have once tried to install nodejs by compiling the source code, but failed due to "Syntax error" when running ./configure . Then I had checked my OS repo, and found out that there is only net-libs/nodejs with no npm. I installed that.

net-libs/nodejs Installed versions: 0.10.8^t(19:04:51 07/10/13)
(masked by default, I unmasked that.)

And the remaining installation process are with no error.

I copied the api/localsettings.js.example to api/localsettings.js and changed the localhost to the IP address. Debug options is uncommented. Others remain the same.

That is all I have done to the whole Parsoid.


Version: unspecified
Severity: normal
OS: Linux
Platform: PC

Details

Reference
bz51151

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:42 AM
bzimport set Reference to bz51151.

Your wiki API is not reachable from the Parsoid machine. Configure it correctly in localsettings.js and verify that it is indeed reachable using wget, curl, w3m or any other tool of your choice.

Example commandline:

curl <yourApiURL>

We should probably print this information when the config request fails. Repurposing this bug for that.

I also see that you are using Node 0.10.8. Note that currently Parsoid only supports node 0.8 (http://www.mediawiki.org/wiki/Parsoid#Use_node.js_0.8.2C_not_0.10)

stephdechine wrote:

(In reply to comment #2)

I also see that you are using Node 0.10.8. Note that currently Parsoid only
supports node 0.8
(http://www.mediawiki.org/wiki/Parsoid#Use_node.js_0.8.2C_not_0.10)

Thank you for pointing out that. After I downgrade node.js to 0.8.23 everything works correctly. My fault. That works for me.