Jump to content

Topic on Project:Support desk

New URL → Issues with VisualEditor on a shared host - "apierror-visualeditor-docserver-http: HTTP 404"

6
Tonynando (talkcontribs)

Hi there!


Initially, I wonder whether I should write this doubt in "VisualEditor/Installation on a shared host" discussion page or if in "Manual:Moving a wiki" discussion page, so I decided to post it here.

I'm having trouble in recreating the Parsoid app, to make the VisualEditor extension in my shared host works, and I really need your help to solve the issues.

Let me share more details: I have to change completely the domain of my wiki. In other words, if the url was www.a.com, now the url is www.b.com. Once the VisualEditor used to work regularly before this web address replacement, and as the parsoid setup needs to specify exactly the URL of api.php, I needed to recreate it on Heroku.

But, unfortunately, I tried to redid it several times, but no one works. In all cases I got this error: "apierror-visualeditor-docserver-http: HTTP 404"

Below, I'll redo in all the steps described in VisualEditor/Installation on a shared host (in real time, as I'm describing it here):


Part 1: Heroku.com

* Sign up with Heroku.com  (ok)

* Create a new app (ok, in US region)

* Go to your app settings (ok)

* Scroll to the Buildpack section (ok)

* Add a new buildpack (ok)

* Select Node.js (ok and changes saved: "Your new buildpack configuration will be used when this app is next deployed.")


Part 2: Your local computer

* Install the Heroku Command Line Interface and log in (ok)

* Clone Parsoid with git clone https://gerrit.wikimedia.org/r/mediawiki/services/parsoid (ok)

* Enter the Parsoid directory you just created, for example with cd parsoid (ok)

* Edit the hidden file .gitignore and remove the lines config.yaml and composer.lock (ok)

* Create your config file by copying config.example.yaml and renaming it to config.yaml (ok)

* Edit the config.yaml file you just created by changing the example URI for the URL of your API, for example uri: 'http://www.mywiki.com/w/api.php' (ok - I tried with "http://" and without it too)

* If your wiki uses https, then uncomment the line strictSSL: false (my wiki has https, but it's not default - if you type "https" manually, it works, but if you consider only the regular rule, the website works only with http, so I didn't uncommented it)

* If the domain: 'localhost' line is uncommented, comment it (helps to avoid the "Invalid domain" error) (ok)

* Save the changes (ok)

* Add the Heroku remote to your git repo with heroku git:remote -a APPNAME (ok, and the message was "set git remote heroku to https://git.heroku.com/xxxxx.git" - xxxxx as the real appname.)

* Stage the edited config files for committing with git add . (ok, with no system reply)

* Commit your changes with git commit -am "Initial commit" (ok, and the message was "2 files changed, 111 insertions (+), 2 deletions (-) /// create mode 100644 config.yaml")

* Push and deploy your changes with git push heroku master (ok - below, all system messages)

Enumerating objects: 71991, done.

Counting objects: 100x (71991/71991), done.

Delta compression using up to 4 threads

Compressing objects: 100x (12548/12548), done.

Writing objects: 100x (71991/71991), 28.58 MiB : 121.00 KiB/s, done.

Total 71991 (delta 59004), reused 71813 (delta 58887), pack-reused 0

remote: Compressing source files... done.

remote: Building source:

remote:

remote:  -----> Node.js app detected

remote:

remote:  -----> Creating runtime environment

remote:

remote: NPM_CONFIG_LOGLEUEL=error

remote: NODE_ENV=production

remote: NODE_MODULES_CACHE=true

remote: NODE_VERBOSE=false

remote:

remote:  -----> Installing binaries

remote: engines.node (package.json): unspecified

remote: engines.npm (package.json): unspecified (use default)

remote:

remote: Resolving node version 12.x...

remote: Downloading and installing node 12.16.3...

remote: Using default npm version: 6.14.4

remote:

remote:  -----> Installing dependencies

remote: Installing node modules

remote:

remote: > unix-dgram@2.0.4 install /tmp/build_0609a9aSccfc940SS7b4f848139 b128/node_modules/unix-dgram

remote: > node-gyp rebuild

remote:

remote: make: Entering directory '/tmp/build_0609a9a5ccfc940557b418481398 128/node_modules/unix-dgram/build'

remote: CXX(target> Release/obj.target/unix_dgram/src/unix_dgram.o

remote: SOLINH_MODULatarget) Release/obj.target/unix_dgram.node

remote: COPY Release/unix_dgram.node

remote: make: Leaving directory '/tmp/build_0609a9a5ccfc940557b418481398b 28/node_modules/unix-dgram/build'

remote:

remote: > heapdum00.3.15 install /tmp/build_0609a9aSccfc940SS7b4f8481398 128/node_modules/heapdump

remote: > node-gyp rebuild

remote:

remote: make: Entering directory '/tmp/build_0609a9a5ccfc940557b418481398 128/node_modules/heapdump/build'

remote: CXX(target) Release/obj.target/addon/src/heapdump.o

remote: SOLINK_MODULE(target) Release/obj.target/addon.node

remote: COPY Release/addon.node

remote: make: Leaving directory '/tmp/build_0609a9a5ccfc940557b418481398b 28/node_modules/heapdump/build'

remote:

remote: > gc-statsG1.4.0 install /tmp/build_0609a9a5ccfc940557b4f8481398b 28/node_modules/gc-stats

remote: > node-pre-gyp install --fallback-to-build

remote:

remote: [gc-stats1] Success: "/tmp/build_0609a9a5ccfc940557b4f8481398b128/ ode_modules/gc-stats/build/gcstats/v1.4.0/Release/node-v72-linux-x64/gcstats.no e" is installed via remote

remote:

remote: > dtrace-provider80.8.8 install /tmp/build_0609a9aSccfc940SS7b4f8 81398b128/node_modules/dtrace-provider

remote: > node-gyp rebuild :: node suppress-error.js

remote:

remote: make: Entering directory '/tmp/build_0609a9a5ccfc940557b418481398 128/node_modules/dtrace-provider/build'

remote: TOUCH Release/obj.target/DTraceProviderStub.stamp

remote: make: Leaving directory '/tmp/build_0609a9a5ccfc940557b418481398b 28/node_modules/dtrace-provider/build'

remote:

remote: > core-jsG2.6.11 post install /tmp/build_0609a9a5ccfc940557b4f8481 98b128/node_modules/core-js

remote: > node -e "try(require('1'./postinstall')>catch(e){}"

remote:

remote: added 418 packages in 21.712s

remote:

remote:  -----> Build

remote:

remote:  -----> Caching build

remote: — node_modules

remote:

remote:  -----> Pruning devDependencies

remote: removed 193 packages, updated 3 packages and audited 294 packages in 4.82s

remote:

remote: 3 packages are looking for funding

remote: run 'npm fund' for details

remote:

remote: found 3 low severity vulnerabilities

remote: run 'npm audit fix' to fix them, or 'npm audit' for details

remote:

remote:  -----> Build succeeded!

remote:  -----> Discovering process types

remote: Procfile declares types —> (none)

remote: Default types for buildpack —> web

remote:

remote:  -----> Compressing...

remote: Done: 84.7M

remote:  -----> Launching...

remote: Released v3

remote: https://xxxxx.herokuapp.com/ deployed to Heroku

remote:

remote: Verifying deploy... done.

To https://git.heroku.com/xxxxx.git

* [new branch] master —> master

* Visit https://APPNAME.herokuapp.com to verify that your Parsoid service works (it works! I got the message "Welcome to the Parsoid web service. See the API documentation on mediawiki.org.")


Part 3: Your wiki

* Download VisualEditor (don't forget to run git submodule update --init as explained in the link) (I have already VisualEditor installed, once I had modified the URL only, I didn't reinstall it)

* Add to your LocalSettings.php (I tried with the code below and the older code that I used earlier, but both without success):

wfLoadExtension( 'VisualEditor' );

$wgVisualEditorEnableWikitext = true;

$wgDefaultUserOptions['visualeditor-newwikitext'] = 1;

$wgDefaultUserOptions['visualeditor-enable'] = 1;

$wgDefaultUserOptions['visualeditor-editor'] = 'visualeditor';

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

'forwardCookies' => true,

'url' => 'https://xxxxx.herokuapp.com/'

];

(older code):

wfLoadExtension( 'VisualEditor' );

//Enable VisualEditor by default for everybody

$wgDefaultUserOptions['visualeditor-enable'] = 1;

// Optional: Set VisualEditor as the default for anonymous users

// otherwise they will have to switch to VE

// $wgDefaultUserOptions['visualeditor-editor'] = "visualeditor";

// Don't allow users to disable it

$wgHiddenPrefs[] = 'visualeditor-enable';

// OPTIONAL: Enable VisualEditor's experimental code features

#$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;

// Parsoid configuration

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

// URL to the Parsoid instance

// Use port 8142 if you use the Debian package

// url must not end in a slash, otherwise it might give a 404 error

'url' => 'xxxxx.herokuapp.com',

// Parsoid "domain", see below (optional)

'domain' => 'localhost',

// Parsoid "prefix", see below (optional)

'prefix' => 'your prefix here', //no site fala pra por "localhost" também

//If you run a private wiki then you have to set the following variable to true:

'forwardCookies' => true

);

* Done! Visit your wiki, edit any page and save the changes to test it out! (unfortunately, it didnt works :( Again, I'm receiving the error "apierror-visualeditor-docserver-http: HTTP 404." )


Does anyone know what could be happening?

It's important to say that I use MW 1.33.0.


Thank you in advance for your help.

Bawolff (talkcontribs)

not sure if this it it, but you have listed in the LocalSettings.php part

'url' => 'xxxxx.herokuapp.com',

It should probably be

'url' => 'https://xxxxx.herokuapp.com',

Replacing xxxxx with your subdomain of course.

Tonynando (talkcontribs)

Hi @Bawolff!


Thanks for your reply!


I tried in both ways, with https and without it, and in the two setups that I described in my comment. "xxxxx" is just an example, I'm putting the right appname in Heroku.


Do you have any other idea? I recreated the Heroku app so many times that I'm out of moves.


Best regards!

Bawolff (talkcontribs)

can you post the config.yaml file you are using?

Tonynando (talkcontribs)

Hi @Bawolff


Please see below. I bolded the lines that I effectively changed, as the step-by-step detailed on VisualEditor/Installation on a shared host. The URL listed is just a sample, the original config.yaml contains the right address.


# This is a sample configuration file

#

# Copy this file to config.yaml and edit that file to fit your needs.

#

# 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.

# The number of http workers (as opposed to `cpu_workers` below)

#num_workers: 1

worker_heartbeat_timeout: 300000

logging:

   level: info

#metrics:

#    type: log

services:

  - module: lib/index.js

   entrypoint: apiServiceWorker

   conf:

       # For backwards compatibility, and to continue to support non-static

       # configs for the time being, optionally provide a path to a

       # localsettings.js file.  See localsettings.example.js

       #localsettings: ./localsettings.js

       # Set your own user-agent string

       # Otherwise, defaults to:

       #   'Parsoid/<current-version-defined-in-package.json>'

       #userAgent: 'My-User-Agent-String'

       # Configure Parsoid to point to your MediaWiki instances.

       mwApis:

       - # This is the only required parameter,

         # the URL of you MediaWiki API endpoint.

         uri: 'http://www.mywiki.com/api.php'

         # The "domain" is used for communication with Visual Editor

         # and RESTBase.  It defaults to the hostname portion of

         # the `uri` property above, but you can manually set it

         # to an arbitrary string. It must match the "domain" set

         # in $wgVirtualRestConfig.

         # 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'

         # See below, defaults to true.

         #strictSSL: false

       # Enable using compute workers to parse requests.

       #useWorker: true

       # The number of workers in the pool spawned by each http worker to

       # call out for parsing.  Defaults to:

       #   ceil(number of cpus / `num_workers`) + 1

       #cpu_workers: 1

       # 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.

       #loadWMF: true

       # A default proxy to connect to the API endpoints.

       # Default: undefined (no proxying).

       # Overridden by per-wiki proxy config in setMwApi.

       #defaultAPIProxyURI: 'http://proxy.example.org:8080'

       # Enable debug mode (prints extra debugging messages)

       #debug: true

       # Use the PHP preprocessor to expand templates via the MW API (default true)

       #usePHPPreProcessor: false

       # Use selective serialization (default false)

       #useSelser: true

       # Allow cross-domain requests to the API (default '*')

       # Sets Access-Control-Allow-Origin header

       # disable:

       #allowCORS: false

       # restrict:

       #allowCORS: 'some.domain.org'

       # Allow override of port/interface:

       #serverPort: 8000

       #serverInterface: '127.0.0.1'

       # Enable linting of some wikitext errors to the log

       #linting: true

       #linter:

       #  sendAPI: false # Send lint errors to MW API instead of to the log

       #  apiSampling: 10 # Sampling rate (1 / 10)

       # Require SSL certificates to be valid (default true)

       # Set to false when using self-signed SSL certificates

       # Note that this can also be applied per wiki in the mwApis above

       #strictSSL: false

       # Use a different server for CSS style modules.

       # Leaving it undefined (the default) will use the same URI as the MW API,

       # changing api.php for load.php.

       #modulesLoadURI: 'http://example.org/load.php'


Thanks for your help, @Bawolff!

Tonynando (talkcontribs)

Hi guys! I think I solved the issue. I was able to fix my SSL/HTTPS problem, so I appoint in config.yaml to https://www.mywiki.com, and now it seems that everything is ok. Thanks for your help, @Bawolff!

Reply to "New URL → Issues with VisualEditor on a shared host - "apierror-visualeditor-docserver-http: HTTP 404""