Topic on Project:Support desk

Parsoid VisualEditor not working

25
Zsiegel2 (talkcontribs)

Hello all,

When I try to make any edit to a page using VisualEditor or save a new page through VisualEditor the load bar gets to about 75% and then says:

Error loading data from server: apierror-visualeditor-docserver-http-error: (curl error: 7) Couldn't connect to server. Would you like to retry?

I'm not sure what details would be helpful, but I am running this on a Debian server on Google Cloud. At first I thought it may have been blocking the port 8142 but I believe I fixed that issue. (Is there some way to check?)

For reference, here is my parsoid config file: (sorry for the awful formatting, not sure what happened)

# This is a sample configuration file
#
# Also see:
# - `npm start -- -h` for more information about passing config files via
#   the commandline.
# - lib/config/ParsoidConfig.js for all the properties that you can configure
#   here. Not all properties are documented here.
worker_heartbeat_timeout: 300000

 logging:
     level: info
  metrics:
     type: log
     services:
     - module: ../src/lib/index.js
     entrypoint: apiServiceWorker
     conf:
# For backwards compatibility, and to continue to support non-static
# configs for the time being, optionally provide a path to a
# localsettings.js file.  See localsettings.example.js
#localsettings: ./localsettings.js
# Set your own user-agent string
# Otherwise, defaults to:
#   'Parsoid/<current-version-defined-in-package.json>'
#userAgent: 'My-User-Agent-String'
# Configure Parsoid to point to your MediaWiki instances.
mwApis:        -
# This is the only required parameter,
# the URL of you MediaWiki API endpoint.
uri: 'http://localhost/w/api.php'
# The "domain" is used for communication with Visual Editor
# and RESTBase.  It defaults to the hostname portion of
# the `uri` property below, but you can manually set it
# to an arbitrary string.
domain: 'localhost'  # optional
# To specify a proxy (or proxy headers) specific to this prefix
# (which overrides defaultAPIProxyURI). Alternatively, set `proxy`
# to `null` to override and force no proxying when a default proxy
# has been set.
#proxy:
#    uri: 'http://my.proxy:1234/'
#    headers: # optional
#        'X-Forwarded-Proto': 'https'
# We pre-define wikipedias as 'enwiki', 'dewiki' etc. Similarly
# for other projects: 'enwiktionary', 'enwikiquote', 'enwikibooks',
# 'enwikivoyage' etc.
# The default for this is false. Uncomment the line below if you want
# to load WMF's config for wikipedias, etc.

Here is the end of my LocalSettings:

wfLoadExtension('VisualEditor');
$wgDefaultUserOptions['visualeditor-enable'] = 1;
$wgVirtualRestConfig['modules']['parsoid'] = array(
 'url' => 'http://localhost:8142'
);
108.14.57.42 (talkcontribs)

Update: I tried doing curl localhost:8124 and it says connection refused. Any idea why?

MarkAHershberger (talkcontribs)

Are you sure parsoid is running? Can you see it when you run <code>ps aux | grep node</code>?

(I've tried formatting your code--VE needs some work for pasting code fragments. Please modify it if you can to make sure it matches what you have.)

Zsiegel2 (talkcontribs)

Thanks for the formatting - it looks right. I believe so, here's what I get:

parsoid  25089  0.0  0.1   4288   768 ?        S    Jan03   0:00 /bin/sh -c /usr/bin/nodejs /usr/lib/parsoid/src/bin/server.js -c /etc/mediawiki/parsoid/config.yaml >> /var/log/parsoid/parsoid.log 2>&1

parsoid  25091  0.0  6.5 989336 39708 ?        Sl   Jan03   0:02 /usr/bin/nodejs /usr/lib/parsoid/src/bin/server.js -c /etc/mediawiki/parsoid/config.yaml

zachary+ 30152  0.0  0.1  12784  1024 pts/0    S+   02:50   0:00 grep node



Zsiegel2 (talkcontribs)

Update: I've gone to my parsoid error log and here's what I get:

Killed

{"name":"parsoid","hostname":"circuitdebater","pid":30815,"level":30,"levelPath":"info/service-runner","msg"

:"master(30815) initializing 1 workers","time":"2019-01-04T03:27:52.929Z","v":0}

{"name":"parsoid","hostname":"circuitdebater","pid":30825,"level":60,"moduleName":"../src/lib/index.js","lev

elPath":"fatal/service-runner/worker","msg":"Unexpected token {","time":"2019-01-04T03:27:54.139Z","v":0}

{"name":"parsoid","hostname":"circuitdebater","pid":30815,"level":40,"message":"first worker died during sta

rtup, continue startup","worker_pid":30825,"exit_code":1,"startup_attempt":1,"levelPath":"warn/service-runne

r/master","msg":"first worker died during startup, continue startup","time":"2019-01-04T03:27:55.147Z","v":0

}


It's worth noting that circuitdebater is not my hostname. I'm just using an ip address, so I'm not sure how that got there.

Ciencia Al Poder (talkcontribs)

There's a "Unexpected token {" message there. Probably a syntax error somewhere, probably on the config.yaml

Zsiegel2 (talkcontribs)

I looked through the config file and I cannot find anything. Does anything look abnormal to you in the parsoid config file I posted?

MarkAHershberger (talkcontribs)

Do you have a localsettings.js that might have an error in it? Can you re-deploy with npm?

Zsiegel2 (talkcontribs)

I do not have a localsettings.js file to my knowledge. (unless it's in a different directory as the config.yaml file). How would I re-deploy it with npm?

MarkAHershberger (talkcontribs)

By "re-deploy with npm" I just mean "reinstall from scratch".

How did you install parsoid?

Zsiegel2 (talkcontribs)

Ah, thanks. I followed the instructions on Parsoid/Setup by running

sudo apt install dirmngr

sudo apt-key advanced --keyserver keys.gnupg.net --recv-keys 90E9F83F22250DD7

echo "deb https://releases.wikimedia.org/debian jessie-mediawiki main" | sudo tee /etc/apt/sources.list.d/parsoid.list

sudo apt install apt-transport-https

sudo apt update && sudo apt install parsoid


I'm new to linux - I attempted to reinstall it by apt-removing dirmngr, apt-transport-https, and parsoid. Didn't seem to help. Is there another way to do that?


Also, is there a way to check what version of Parsoid I am running? Maybe it's not compatible with the version of mediawiki that I am running? I am running the latest version of media wiki.


Zsiegel2 (talkcontribs)

Update:


I installed the latest version of nodeJS and I now get a different error:


Error loading data from server: apierror-visualeditor-docserver-http: HTTP 404. Would you like to retry?

Zsiegel2 (talkcontribs)

I checked my parsoid log file and am getting an invalid domain error.


{"name":"../src/lib/index.js","hostname":"circuitdebater","pid":5215,"level":60,"levelPath":"fatal/request","msg":\ "Invalid domain: 35.196.221.232","time":"2019-01-05T17:57:33.778Z","v":0}

MarkAHershberger (talkcontribs)

At least it looks like MW is communicating now, right?

Could you try the following:

$wgVirtualRestConfig['modules']['parsoid'] = [
 'url' => 'http://localhost:8142',
 'domain' => 'localhost'
];

From Linking with Parsoid

Zsiegel2 (talkcontribs)

It worked!! Thank you so much! I wonder why it assumed a different domain, who knows.

Bixbixbix (talkcontribs)

Hi,

sorry to bring this up again. I used to have the exact same problem and could actually solve it with help of this thread. I now receive no errors, however, VisualEditor just does not load when clicking on any edit button. URL changes to [..]&veaction=edit but the page does not change compared to the default read-page. clicking on the "edit source" does load up that default source-editor.

No logfile I had a look at does show any errors or warnings.

Any quick ideas what to do in order to make the editor load up?

Tank you!


AhmadF.Cheema (talkcontribs)

Did you update the submodules by running the git submodule update --init command?

Bixbixbix (talkcontribs)

Yes, I did that. Folder lib/ve/ is populated as well.

MarkAHershberger (talkcontribs)

What does your javascript console say? (Here are instructions on how to open it if you don't know how already.)

@Bixbixbix: if you can point us to your wiki (if it is public) we may be able to see what is wrong.

Bixbixbix (talkcontribs)

It is privat and locally hosted, so no pointout - sorry.


As soon as I load the extension (and only then), an error clutters the console. I tried disable all other extensions, the only problematic one is VisualEditor. Here is what I get:

[b259507e98d2547a6dec70c5] /wiki/load.php?debug=false&lang=de&modules=startup&only=scripts&skin=vector   ConfigException from line 53 of /var/www/html/wiki/includes/config/GlobalVarConfig.php: GlobalVarConfig::get: undefined option: 'EnableBlockNoticeStats'
Backtrace:
#0 /var/www/html/wiki/extensions/VisualEditor/includes/VisualEditorHooks.php(935): GlobalVarConfig->get(string)
#1 /var/www/html/wiki/includes/Hooks.php(174): VisualEditorHooks::onResourceLoaderGetConfigVars(array)
#2 /var/www/html/wiki/includes/Hooks.php(202): Hooks::callHook(string, array, array, NULL)
#3 /var/www/html/wiki/includes/resourceloader/ResourceLoaderStartUpModule.php(129): Hooks::run(string, array)
#4 /var/www/html/wiki/includes/resourceloader/ResourceLoaderStartUpModule.php(432): ResourceLoaderStartUpModule->getConfigSettings(ResourceLoaderContext)
#5 /var/www/html/wiki/includes/resourceloader/ResourceLoaderModule.php(708): ResourceLoaderStartUpModule->getScript(ResourceLoaderContext)
#6 /var/www/html/wiki/includes/resourceloader/ResourceLoaderModule.php(675): ResourceLoaderModule->buildContent(ResourceLoaderContext)
#7 /var/www/html/wiki/includes/resourceloader/ResourceLoaderModule.php(812): ResourceLoaderModule->getModuleContent(ResourceLoaderContext)
#8 /var/www/html/wiki/includes/resourceloader/ResourceLoader.php(660): ResourceLoaderModule->getVersionHash(ResourceLoaderContext)
#9 [internal function]: ResourceLoader->{closure}(string)
#10 /var/www/html/wiki/includes/resourceloader/ResourceLoader.php(672): array_map(Closure, array)
#11 /var/www/html/wiki/includes/resourceloader/ResourceLoader.php(753): ResourceLoader->getCombinedVersion(ResourceLoaderContext, array)
#12 /var/www/html/wiki/load.php(51): ResourceLoader->respond(ResourceLoaderContext)
#13 {main}
[b259507e98d2547a6dec70c5] /wiki/load.php?debug=false&lang=de&modules=startup&only=scripts&skin=vector   ConfigException from line 53 of /var/www/html/wiki/includes/config/GlobalVarConfig.php: GlobalVarConfig::get: undefined option: 'EnableBlockNoticeStats'
Backtrace:
#0 /var/www/html/wiki/extensions/VisualEditor/includes/VisualEditorHooks.php(935): GlobalVarConfig->get(string)
#1 /var/www/html/wiki/includes/Hooks.php(174): VisualEditorHooks::onResourceLoaderGetConfigVars(array)
#2 /var/www/html/wiki/includes/Hooks.php(202): Hooks::callHook(string, array, array, NULL)
#3 /var/www/html/wiki/includes/resourceloader/ResourceLoaderStartUpModule.php(129): Hooks::run(string, array)
#4 /var/www/html/wiki/includes/resourceloader/ResourceLoaderStartUpModule.php(432): ResourceLoaderStartUpModule->getConfigSettings(ResourceLoaderContext)
#5 /var/www/html/wiki/includes/resourceloader/ResourceLoaderModule.php(708): ResourceLoaderStartUpModule->getScript(ResourceLoaderContext)
#6 /var/www/html/wiki/includes/resourceloader/ResourceLoaderModule.php(675): ResourceLoaderModule->buildContent(ResourceLoaderContext)
#7 /var/www/html/wiki/includes/resourceloader/ResourceLoader.php(1072): ResourceLoaderModule->getModuleContent(ResourceLoaderContext)
#8 /var/www/html/wiki/includes/resourceloader/ResourceLoader.php(776): ResourceLoader->makeModuleResponse(ResourceLoaderContext, array, array)
#9 /var/www/html/wiki/load.php(51): ResourceLoader->respond(ResourceLoaderContext)
#10 {main}
Problematic modules: {"startup":"error"}


No changes made to GlobalVarConfig.php from my side.

Ciencia Al Poder (talkcontribs)
Bixbixbix (talkcontribs)

I just got it to work.

I could swear, I double-checked the versions, seem's like this was the case. After completely removing MobileFrontend and VisualEditor, downloading the files again and re-uploading them, VisualEditor loaded up and is working. Either I totally misclicked on the wrong version when downloading or something went wrong in uploading. I don't even know exactly which extension caused the problem, however, it's fine for now.

Thank you very much!

Lwangaman (talkcontribs)

May I ask what version of node needs to be used for parsoid to work? I've tried different versions using nvm (10.0, 12.16.2, 12.4.0) and then "npm rebuild" and "npm install" but I'm getting errors in the parsoid.log such as:

const { PROTOCOL } = require('./constants');       ^ SyntaxError: Unexpected token {

   exports.runInThisContext (vm.js:53:16)

    at Module._compile (module.js:374:25)     at Object.Module._extensions..js (module.js:417:10)     at Module.load (module.js:344:32)     at Function.Module._load (module.js:301:12)     at Module.require (module.js:354:17)     at require (internal/module.js:12:17)     at Object.<anonymous> (/usr/lib/parsoid/node_modules/hot-shots/index.js:1:80)     at Module._compile (module.js:410:26)     at Object.Module._extensions..js (module.js:417:10)     at Module.load (module.js:344:32)     at Function.Module._load (module.js:301:12)     at Module.require (module.js:354:17)     at require (internal/module.js:12:17)     at Object.<anonymous> (/usr/lib/parsoid/node_modules/service-runner/lib/statsd.js:3:16)     at Module._compile (module.js:410:26)

I've read that these errors can occur if there is an incompatible version of node. Which version does parsoid need? I read on the parsoid installation page that node 10.0 should work, but this is the error I'm getting after "nvm use 10.0" and "npm rebuild" and "npm install".

Ciencia Al Poder (talkcontribs)

According to Parsoid/Releases, Parsoid 0.10.0 (released Dec 5, 2018) requires nodejs version 6 or later, but will probably not work with version 12.

There's no information about Parsoid 0.11.0 (released Jan 14, 2020)

Lwangaman (talkcontribs)

I'm running a system with Ubuntu 16.04 and Plesk Obsydian (which installs it's own version of nodejs). I added the ubuntu/debian repository as indicated in the parsoid documentation (even though it's not a xenial repository) and apt installed parsoid. Seeing that after configuration and with my wiki uri it wasn't working as expected, I checked the logs and saw these errors, so I figured I would use nvm to make sure there was a compatible version of node running. Seeing the package.json indicated a target of nodejs v6.9.2, I just now did an nvm install 6.9.2 and then npm rebuild and npm install, and restarted the parsoid service. I got this error in the parsoid.log:

/usr/lib/parsoid/node_modules/hot-shots/lib/statsd.js:8 let unixDgram; ^^^ SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

   at exports.runInThisContext (vm.js:53:16)
   at Module._compile (module.js:374:25)
   at Object.Module._extensions..js (module.js:417:10)
   at Module.load (module.js:344:32)
   at Function.Module._load (module.js:301:12)
   at Module.require (module.js:354:17)
   at require (internal/module.js:12:17)
   at Object.<anonymous> (/usr/lib/parsoid/node_modules/hot-shots/index.js:1:80)
   at Module._compile (module.js:410:26)
   at Object.Module._extensions..js (module.js:417:10)
   at Module.load (module.js:344:32)
   at Function.Module._load (module.js:301:12)
   at Module.require (module.js:354:17)
   at require (internal/module.js:12:17)
   at Object.<anonymous> (/usr/lib/parsoid/node_modules/service-runner/lib/statsd.js:3:16)
   at Module._compile (module.js:410:26)

So I tried nvm install 8.0 and then npm rebuild and npm install, and again restarted the parsoid service. Now I see this error message:

/usr/lib/parsoid/node_modules/service-runner/lib/logger.js:17

   constructor(downstream, options = {}) {
                                   ^

SyntaxError: Unexpected token =

   at exports.runInThisContext (vm.js:53:16)
   at Module._compile (module.js:374:25)
   at Object.Module._extensions..js (module.js:417:10)
   at Module.load (module.js:344:32)
   at Function.Module._load (module.js:301:12)
   at Module.require (module.js:354:17)
   at require (internal/module.js:12:17)
   at Object.<anonymous> (/usr/lib/parsoid/node_modules/service-runner/lib/base_service.js:10:16)
   at Module._compile (module.js:410:26)
   at Object.Module._extensions..js (module.js:417:10)
   at Module.load (module.js:344:32)
   at Function.Module._load (module.js:301:12)
   at Module.require (module.js:354:17)
   at require (internal/module.js:12:17)
   at Object.<anonymous> (/usr/lib/parsoid/node_modules/service-runner/lib/master.js:7:21)
   at Module._compile (module.js:410:26)

Is it possible that parsoid version 0.11.0 simply isn't stable yet? Anyone else succeed in installing parsoid v0.11.0? BTW I'm seeing a few difficulties even on here when trying to go back and forth with the visual editor, the visual editor usually crashes and I lose content :o

Reply to "Parsoid VisualEditor not working"