I cannot edit any article on Wikipedia because the editor will not load, but I can edit talk pages. How to fix this?
Talk:Parsoid
Appearance
Hi, this site is about MediaWiki software. Please visit Wikipedia for support questions about Wikipedia.
When using Special:Import, it fails with the error in the title. Any help tracking down why would be appreciated
MediaWiki | 1.39.2 |
PHP | 7.4.33 (litespeed) |
MariaDB | 10.3.36-MariaDB-cll-lve |
ICU | 63.1 |
Lua | 5.1.5 |
Pygments | 2.11.2 |
wikimedia/parsoid | 0.15.1 |
Backtrace:
from /home/eatingas/public_html/includes/parser/Parser.php(3960)
#0 /home/eatingas/public_html/includes/parser/CoreParserFunctions.php(1148): Parser->tagNeedsNowikiStrippedInTagPF(string)
#1 /home/eatingas/public_html/includes/parser/Parser.php(3443): CoreParserFunctions::tagObj(Parser, PPTemplateFrame_Hash, array)
#2 /home/eatingas/public_html/extensions/Scribunto/includes/engines/LuaCommon/LuaEngine.php(791): Parser->callParserFunction(PPTemplateFrame_Hash, string, array)
#3 /home/eatingas/public_html/extensions/Scribunto/includes/engines/LuaStandalone/LuaStandaloneInterpreter.php(399): Scribunto_LuaEngine->callParserFunction(string, string, array)
#4 /home/eatingas/public_html/extensions/Scribunto/includes/engines/LuaStandalone/LuaStandaloneInterpreter.php(370): MediaWiki\Extension\Scribunto\Engines\LuaStandalone\LuaStandaloneInterpreter->callback(string, array)
#5 /home/eatingas/public_html/extensions/Scribunto/includes/engines/LuaStandalone/LuaStandaloneInterpreter.php(446): MediaWiki\Extension\Scribunto\Engines\LuaStandalone\LuaStandaloneInterpreter->handleCall(array)
#6 /home/eatingas/public_html/extensions/Scribunto/includes/engines/LuaStandalone/LuaStandaloneInterpreter.php(277): MediaWiki\Extension\Scribunto\Engines\LuaStandalone\LuaStandaloneInterpreter->dispatch(array)
#7 /home/eatingas/public_html/extensions/Scribunto/includes/engines/LuaCommon/LuaEngine.php(302): MediaWiki\Extension\Scribunto\Engines\LuaStandalone\LuaStandaloneInterpreter->callFunction(MediaWiki\Extension\Scribunto\Engines\LuaStandalone\LuaStandaloneInterpreterFunction, MediaWiki\Extension\Scribunto\Engines\LuaStandalone\LuaStandaloneInterpreterFunction)
#8 /home/eatingas/public_html/extensions/Scribunto/includes/engines/LuaCommon/LuaModule.php(71): Scribunto_LuaEngine->executeFunctionChunk(MediaWiki\Extension\Scribunto\Engines\LuaStandalone\LuaStandaloneInterpreterFunction, PPTemplateFrame_Hash)
#9 /home/eatingas/public_html/extensions/Scribunto/includes/Hooks.php(158): Scribunto_LuaModule->invoke(string, PPTemplateFrame_Hash)
#10 /home/eatingas/public_html/includes/parser/Parser.php(3443): MediaWiki\Extension\Scribunto\Hooks::invokeHook(Parser, PPTemplateFrame_Hash, array)
#11 /home/eatingas/public_html/includes/parser/Parser.php(3126): Parser->callParserFunction(PPTemplateFrame_Hash, string, array)
#12 /home/eatingas/public_html/includes/parser/PPFrame_Hash.php(276): Parser->braceSubstitution(array, PPTemplateFrame_Hash)
#13 /home/eatingas/public_html/includes/parser/Parser.php(3317): PPFrame_Hash->expand(PPNode_Hash_Tree)
#14 /home/eatingas/public_html/includes/parser/PPFrame_Hash.php(276): Parser->braceSubstitution(array, PPFrame_Hash)
#15 /home/eatingas/public_html/includes/parser/Parser.php(2955): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
#16 /home/eatingas/public_html/includes/parser/Parser.php(1610): Parser->replaceVariables(string)
#17 /home/eatingas/public_html/includes/parser/Parser.php(724): Parser->internalParse(string)
#18 /home/eatingas/public_html/includes/content/WikitextContentHandler.php(301): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)
#19 /home/eatingas/public_html/includes/content/ContentHandler.php(1721): WikitextContentHandler->fillParserOutput(WikitextContent, MediaWiki\Content\Renderer\ContentParseParams, ParserOutput)
#20 /home/eatingas/public_html/includes/content/Renderer/ContentRenderer.php(47): ContentHandler->getParserOutput(WikitextContent, MediaWiki\Content\Renderer\ContentParseParams)
#21 /home/eatingas/public_html/includes/Revision/RenderedRevision.php(266): MediaWiki\Content\Renderer\ContentRenderer->getParserOutput(WikitextContent, Title, integer, ParserOptions, boolean)
#22 /home/eatingas/public_html/includes/Revision/RenderedRevision.php(237): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached(WikitextContent, boolean)
#23 /home/eatingas/public_html/includes/Revision/RevisionRenderer.php(221): MediaWiki\Revision\RenderedRevision->getSlotParserOutput(string, array)
#24 /home/eatingas/public_html/includes/Revision/RevisionRenderer.php(158): MediaWiki\Revision\RevisionRenderer->combineSlotOutput(MediaWiki\Revision\RenderedRevision, array)
#25 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}(MediaWiki\Revision\RenderedRevision, array)
#26 /home/eatingas/public_html/includes/Revision/RenderedRevision.php(199): call_user_func(Closure, MediaWiki\Revision\RenderedRevision, array)
#27 /home/eatingas/public_html/includes/Storage/DerivedPageDataUpdater.php(1438): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#28 /home/eatingas/public_html/includes/Storage/DerivedPageDataUpdater.php(1817): MediaWiki\Storage\DerivedPageDataUpdater->getCanonicalParserOutput()
#29 /home/eatingas/public_html/includes/Storage/DerivedPageDataUpdater.php(1715): MediaWiki\Storage\DerivedPageDataUpdater->doParserCacheUpdate()
#30 /home/eatingas/public_html/includes/Storage/DerivedPageDataUpdater.php(1568): MediaWiki\Storage\DerivedPageDataUpdater->triggerParserCacheUpdate()
#31 /home/eatingas/public_html/includes/import/ImportableOldRevisionImporter.php(241): MediaWiki\Storage\DerivedPageDataUpdater->doUpdates()
#32 /home/eatingas/public_html/includes/import/WikiRevision.php(682): ImportableOldRevisionImporter->import(WikiRevision)
#33 /home/eatingas/public_html/includes/import/WikiImporter.php(509): WikiRevision->importOldRevision()
#34 /home/eatingas/public_html/includes/import/WikiImporter.php(638): WikiImporter->importRevision(WikiRevision, WikiImporter)
#35 /home/eatingas/public_html/includes/import/WikiImporter.php(1139): WikiImporter->revisionCallback(WikiRevision)
#36 /home/eatingas/public_html/includes/import/WikiImporter.php(1005): WikiImporter->processRevision(array, array)
#37 /home/eatingas/public_html/includes/import/WikiImporter.php(937): WikiImporter->handleRevision(array)
#38 /home/eatingas/public_html/includes/import/WikiImporter.php(755): WikiImporter->handlePage()
#39 /home/eatingas/public_html/includes/specials/SpecialImport.php(239): WikiImporter->doImport()
#40 /home/eatingas/public_html/includes/specials/SpecialImport.php(112): SpecialImport->doImport()
#41 /home/eatingas/public_html/includes/specialpage/SpecialPage.php(701): SpecialImport->execute(NULL)
#42 /home/eatingas/public_html/includes/specialpage/SpecialPageFactory.php(1428): SpecialPage->run(NULL)
#43 /home/eatingas/public_html/includes/MediaWiki.php(316): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
#44 /home/eatingas/public_html/includes/MediaWiki.php(904): MediaWiki->performRequest()
#45 /home/eatingas/public_html/includes/MediaWiki.php(562): MediaWiki->main()
#46 /home/eatingas/public_html/index.php(50): MediaWiki->run()
#47 /home/eatingas/public_html/index.php(46): wfIndexMain()
#48 {main}
Server info:
MediaWiki 1.38.4
PHP 7.4.33 (fpm-fcgi)
MySQL 5.7.39-log
ICU 50.2
When I'm trying to use VisualEditor, all I get is this error: Error contacting the Parsoid/RESTBase server: (curl error: 7) Couldn't connect to server
I'm using almost default LocalSetting.php and have no Parsoid configuration.
I've noticed the guide Extension:VisualEditor#Troubleshooting, but I'm not understand what "mediawiki native hostname" and "the domain the wiki is running on" is.
Here is the log about the error (URL is edited):
[http] HTTP start: GET mywikiroot/rest.php/wiki.zyrail.org/v3/page/html/%E9%A6%96%E9%A1%B5/1?redirect=false&stash=true
[http] Error fetching URL "mywikiroot/rest.php/wiki.zyrail.org/v3/page/html/%E9%A6%96%E9%A1%B5/1?redirect=false&stash=true": (curl error: 7) Couldn't connect to server
However, the URL is accessable without any error message.
What can I do? Thanks for help.
Please post a tutorial for IIS users. Same problem.
Is there a way to tell VisualEditor/Parsoid to work correctly for a wiki with a self-signed SSL cert? Clicking "Edit" in VisualEditor produces the error "Error contacting the Parsoid/RESTBase server: (curl error: 60) Peer certificate cannot be authenticated with given CA certificates." This is on MediaWiki 1.37.1.
I've tried the "insecure http" workaround at https://phabricator.wikimedia.org/T272680 (setting $wgVirtualRestConfig['modules']['parsoid']['url'] = 'http://mywiki.com/w/rest.php'
), but the error message remained.
This is a test wiki on my own network, not a production wiki. I'm hoping for a server-side solution, not client-side, since multiple clients connect to this wiki.
Thank you very much.
If you set the url to http then there's no certificate to verify, so something didn't quite work out in your testing
Hello all.
I am having the exact same issue with my install of mediawiki. This is a 'private' wiki (only certain users will be able to edit), but the majority of pages will be publicly readable.
Hence the whole site must be working on HTTPS (SSL).
I know however that a large number of the editors will not be impressed if they have to learn mediawiki markup, so the visual editor is a must have.
My set up is as follows.
MediaWiki | 1.36.2 |
PHP | 7.4.25 (apache2handler) |
MariaDB | 10.5.12-MariaDB-0+deb11u1 |
ICU | 67.1 |
Article path | /index.php/$1 |
Script path | / |
index.php | /index.php |
api.php | /api.php |
rest.php | /rest.php |
Running on top of the Apache web server, with Debian 11.
I have used the https config as I found it from here : https://askubuntu.com/questions/788658/configuring-apache2-for-mediawiki
I have tried copying the SSL certificates to /etc/ssl/certs on the main part of the server, but I'm sure I have not done this correctly.
I have tried many solutions and have been able to recreate all the errors found in Extension:VisualEditor#Troubleshooting, so much so I can flip between them almost at will !
The solution in my mind would be for the parsoid to be able to verify the authenticity of the server (in this instance itself), I must be able to do this, but where should I place the public and private certificates ?
I am __very__ reluctant to run the wiki over http only. I notice that all the pages can be edited on the various wikimedia sites (including this one) with the visual editor, and they are working on https.
It leads me to question if I should install parsoid / restbase as if I was in a Dev environment.
finaly. I'm quite surprised that there isn't sample config for apache / nginx for working over SSL anywhere in the manual page .... once I get my config figured out, and cut down to the bare required minimum on my dev site I will be very happy to share my config to the manual:install page.
Thanks in advance for you aid in resolving this issue.
David
You don't need to run the wiki over http only. You only need to allow http requests to localhost.
I understood that, but running parsoid over http causes the error that I posted above. I'm not getting the local communication to work.
Also when running parsoid over local non SSL communication the address bar says http in it (unlike on this site, and other mediawiki sites) that continue to say https.
I'm sure there is an error in my apache config for the site, specific to parsoid, or in the LocalSettings.php file. Having tried all the various options that are set out in the various threads here, and across the net (OK mabye not all, but a lots of them! ;) ). I continue to end up with the error above, or one of the others on the visual editor : troubleshooting page.
You said in your earlier response to Maiden taiwan that something didn't work out in their testing. do you have any further suggestions for troubleshooting ? I'm not sure what other log files I need to debug the situation fully.
I should say here that I really like mediawiki, its lovely to use, I'm just concerned for my colleagues if they have to edit the source for pages (I know it won't be popular)
Thanks
D
I guess the first step is establishing that you connect to Parsoid over http at localhost.
What happens when you visit http://localhost/rest.php/localhost/v3/page/html/Main%20Page
Hello Arlolra,
appologies for the slow reply, my dev work is only a part of my main job, and I've been rather 'busy' !
So I can actually use a browser from the local host (headless server). But I can ssh into the server and 'curl' the page you have asked about.
$ curl http://localhost/rest.php/localhost/v3/page/html/Main%20Page <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL was not found on this server.</p> <hr> <address>Apache/2.4.38 (Debian) Server at localhost Port 80</address> </body></html>
the same but this time using https ...
curl https://localhost/rest.php/localhost/v3/page/html/Main%20Page curl: (60) SSL certificate problem: self signed certificate More details here: https://curl.haxx.se/docs/sslcerts.html curl failed to verify the legitimacy of the server and therefore could not establish a secure connection to it. To learn more about this situation and how to fix it, please visit the web page mentioned above.
which is consistent with the problems that I have seen other users have. IT also is why I wonder if I can get the server to 'self verify' somehow (like I do when I ssh into the server, but done locally). I know that the browser will normally store the SSL certificate, so as to 'verify' the server. but how to enable the same for the php commands within parsoid over localhost.
Again, I can confirm that when I run the site without https everything works just fine.
Should I try with a 'dev' version of parsoid (as outlined in Parsoid#Installation). In fact on that page (Parsoid#Linking a developer checkout of Parsoid) it states that :
<blockquote>
Parsoid code is bundled in two different ways: first, Parsoid is included from MediaWiki as a composer library, wikimedia/parsoid </blockquote>
Is this only in the git version ? as I don't find this path on the main mediawiki files that I downloaded. The only folder is the
/extensios/VisualEditor
and this doesn't have the structure as described in the parsoid development pages, which makes it hard to know what I should be modifying.
Appologies this became a longer response that I had anticipated !
David
If you're getting a 404 from Apache for curl http://localhost/rest.php/localhost/v3/page/html/Main%20Page
, you need to configure Apache serve your MediaWiki instance for connections to port 80
@Arlolra,
I appreciate your suggestions .... but ...
That would be a problem as all the guides say that web sites should now be served over HTTPS (ie SSL and port 403) and not be using port 80 (which makes lots of sense to me).
When I run the site without SSL (so on port 80 / http) everything is fine, but see above, I want SSL.
The site will have registered users, and I can't have them log in over port 80 sending passwords to my server "in the clear".
@Ciencia Al Poder, that looks interesting, I'll test to see if it works.
Its also given me another idea, can I use a config file for CURL that will cause it to always use the 'insecure' flag, or point to the required certificate to authenticate with ? ... its a facetious question ... Im off to have a look now ...
So there is a default config file for curl :
see : https://everything.curl.dev/cmdline/configfile
this leads to the question for curl as used by mediawiki, is there a local mediwiki config file for php / curl.
My reasoning for this is if the server uses curl in other automated jobs / web apps etc, pointing to this "default config" file may tread on the toes of how CURL works in those other instances.
Can we (cough I) create a config for curl in the LocalSettings.php , or somewhere else in the mediawiki file structure, that would be easily to modified as required.
suggested example :
$wgCurlSSLcert = "/path/to/SSL/cert"
My suggestion was to accept connections at port 80 on localhost, not from traffic coming from outside your machine
So, something like <VirtualHost localhost:80> and <VirtualHost mywiki.com:443>
Another option is to use a certificate from https://letsencrypt.org/ instead of self-signing
Arlorla,
Ah sorry, I missunderstood.
That makes sense ... I'll need to look into how to configure apache for that.
I'm guessing something like
<VirtualHost localhost:80>
ServerName wiki.example.com ServerAdmin admin@wiki.example.com
${APACHE_LOG_DIR}/wiki.example.com.error.log CustomLog ${APACHE_LOG_DIR}/wiki.example.com.access.log combined
</VirtualHost>
But my current config has <virtualHost *:80>
pushing everything to SSL with Redirect permanent "/" "https://wiki.example.com/"
Do you have any guides on how I can do this, I'm sure its fairly common, but not something I've had to do before.
Once again, thanks in advance, and I fully intend to create a page to document my config once it is working, which I will happily share.
Appologies to anyone following this thread.
I've not found time to work on this ... will report back once I have.
tried the <VirtualHost localhost:80> solution, and get:
{"message":"Error: exception of type Wikimedia\\ParamValidator\\ValidationException: Validation of `domain` failed: invalid-domain {\"expected\":\"...
I've just upgraded my MediaWiki to 1.38.2 and Visual Editor broke down. I tried a lot of different attempts without success, I've opened various question on StackOverflow but I am lost.
This is the error:
exception of type TypeError: Argument 2 passed to Wikimedia\\Parsoid\\Wt2Html\\TT\\ListHandler::pushList() must be an instance of stdClass, instance of Wikimedia\\Parsoid\\NodeData\\DataParsoid given
This is the error on the wiki: https://www.tematichedigenere.com/rest.php/www.tematichedigenere.com/v3/page/html/Cosa%20c'%C3%A8%20da%20fare%3F/27246
And this is the error trying to click on the Edit button. https://www.tematichedigenere.com/wiki/Guerra_Ucraina_Russia?veaction=edit
What's the easiest way to make the wiki get back working?
Solved by reinstalling the whole folder
So, can I resolve this then?
The same question was asked here https://www.mediawiki.org/w/index.php?title=Topic:X0lky767z5s17jja&topic_showPostId=x0lyl6st7pxezvv5#flow-post-x0lyl6st7pxezvv5
What regex does Parsoid use to catch and parse URLs? I asked at en:WP:VPT and was redirected here.
Autourls and external links are parsed in this PEG grammar block. So, Parsoid doesn't just use a regex for it.
Parsoid doesn't use regexes for that, https://github.com/wikimedia/parsoid/blob/master/src/Wt2Html/Grammar.pegphp#L932-L983
It tries to match what the legacy parser does in Parser::makeFreeExternalLink
The part that seems to be confusing is this removing of the trailing punctuation bit, https://github.com/wikimedia/mediawiki/blob/master/includes/parser/Parser.php#L1897-L1902
Thank you both for answering. I guess I'll just have to learn PHP to figure out the rest.
I am trying to separate restbase and other nodejs apps into separate VMs/containers. I am testing in mediawiki 1.38 and 1.37.
If I configure parsoid host in this form: parsoidHost (restbase config.yaml):
/parsoid: x-modules: - path: sys/parsoid.js options: parsoidHost: "{{'http://{domain}/rest.php'}}"
I get the following error in the log which indicates domain has not been replaced with the correct domain:
"HTTPError","message":"Invalid URI \"http:///%7Bdomain%7D/rest.php/testwiki.wiki.internal/v3/page/pagebundle/Main_Page/20\"","status":504,
The correct url for parsoid should be:
http://testwiki.wiki.internal/rest.php/testwiki.wiki.internal/v3/page/html/Main%20Page/20
This format gives a similar error:
parsoidHost: "{{'http://{$.request.params.domain}/rest.php'}}"
full error |
---|
{"name":"restbase","hostname":"restbase","pid":7192,"level":50,"message":"Invalid URI \"http:///$%7B$.request.params.domain%7D/rest.php/testwiki-fat.wiki.internal/v3/transform/pagebundle/to/wikitext/Main_Page/20\"","res":{"name":"HTTPError","message":"Invalid URI \"http:///$%7B$.request.params.domain%7D/rest.php/testwiki-fat.wiki.internal/v3/transform/pagebundle/to/wikitext/Main_Page/20\"","status":504,"headers":{"content-t ype":"application/problem+json","access-control-allow-origin":"*","access-control-allow-methods":"GET,HEAD","access-control-allow-headers":"accept, content-type, content-length, cache-control, accept-language, api-user-agent, if-match, if-modified-since, if-none-match, dnt, accept-encoding","access-control-expose-headers":"etag","x-content-type-options":"nosniff","x-frame-options":"SAMEORIGIN","referrer-policy":"origin-when -cross-origin","x-xss-protection":"1; mode=block","content-security-policy":"default-src 'none'; frame-ancestors 'none'","x-content-security-policy":"default-src 'none'; frame-ancestors 'none'","x-webkit-csp":"default-src 'none'; frame-ancestors 'none'","cache-control":"private, max-age=0, s-maxage=0, must-revalidate","x-request-id":"65e84430-ca39-11ec-80d5-5303b9bf502a","server":"restbase"},"body":{"type":"internal_http_er ror","detail":"Invalid URI \"http:///$%7B$.request.params.domain%7D/rest.php/testwiki-fat.wiki.internal/v3/transform/pagebundle/to/wikitext/Main_Page/20\"","internalStack":"Error: Invalid URI \"http:///$%7B$.request.params.domain%7D/rest.php/testwiki-fat.wiki.internal/v3/transform/pagebundle/to/wikitext/Main_Page/20\"\n at Request.init (/var/lib/restbase/node_modules/request/request.js:273:31)\n at new Request (/var/l ib/restbase/node_modules/request/request.js:127:8)\n at Function.request (/var/lib/restbase/node_modules/request/index.js:53:10)\n at Request._tryUntilFail (/var/lib/restbase/node_modules/requestretry/index.js:124:23)\n at Factory (/var/lib/restbase/node_modules/requestretry/index.js:178:7)\n at Request.run (/var/lib/restbase/node_modules/preq/index.js:160:16)\n at preq (/var/lib/restbase/node_modules/preq/in dex.js:267:46)\n at Object.module.exports [as filter] (/var/lib/restbase/node_modules/hyperswitch/lib/filters/http.js:76:12)\n at handlerWrapper (/var/lib/restbase/node_modules/hyperswitch/lib/hyperswitch.js:420:27)\n at /var/lib/restbase/node_modules/hyperswitch/lib/hyperswitch.js:426:28\n at HyperSwitch._filteredRequest (/var/lib/restbase/node_modules/hyperswitch/lib/hyperswitch.js:171:19)\n at HyperSwitch. <computed> [as post] (/var/lib/restbase/node_modules/hyperswitch/lib/hyperswitch.js:460:21)\n at ParsoidService.callParsoidTransform (/var/lib/restbase/sys/parsoid.js:690:40)\n at /var/lib/restbase/sys/parsoid.js:643:25\n at tryCatcher (/var/lib/restbase/node_modules/bluebird/js/release/util.js:16:23)\n at Promise._settlePromiseFromHandler (/var/lib/restbase/node_modules/bluebird/js/release/promise.js:547:31)"," internalURI":"http://${$.request.params.domain}/rest.php/testwiki-fat.wiki.internal/v3/transform/pagebundle/to/wikitext/Main_Page/20","internalQuery":"{}","internalErr":"Invalid URI \"http:///$%7B$.request.params.domain%7D/rest.php/testwiki-fat.wiki.internal/v3/transform/pagebundle/to/wikitext/Main_Page/20\"","internalMethod":"post"},"requestName":"get_from_backend"},"stack":"HTTPError: Invalid URI \"http:///$%7B$.request.p arams.domain%7D/rest.php/testwiki-fat.wiki.internal/v3/transform/pagebundle/to/wikitext/Main_Page/20\"\n at /var/lib/restbase/node_modules/preq/index.js:246:19\n at tryCatcher (/var/lib/restbase/node_modules/bluebird/js/release/util.js:16:23)\n at Promise._settlePromiseFromHandler (/var/lib/restbase/node_modules/bluebird/js/release/promise.js:547:31)\n at Promise._settlePromise (/var/lib/restbase/node_modules/bl uebird/js/release/promise.js:604:18)\n at Promise._settlePromiseCtx (/var/lib/restbase/node_modules/bluebird/js/release/promise.js:641:10)\n at _drainQueueStep (/var/lib/restbase/node_modules/bluebird/js/release/async.js:97:12)\n at _drainQueue (/var/lib/restbase/node_modules/bluebird/js/release/async.js:86:9)\n at Async._drainQueues (/var/lib/restbase/node_modules/bluebird/js/release/async.js:102:5)\n at Imm ediate.Async.drainQueues [as _onImmediate] (/var/lib/restbase/node_modules/bluebird/js/release/async.js:15:14)\n at processImmediate (node:internal/timers:466:21)","latency":21,"root_req":{"method":"post","uri":"/testwiki-fat.wiki.internal/v1/transform/html/to/wikitext/Main_Page/20","headers":{"content-length":"5758","content-type":"multipart/form-data; boundary=------------------------54315dbeb2b1f7be","if-match":"\"20/ 956ec650-ca1d-11ec-b753-6728b9e18a10\"","user-agent":"VisualEditor-MediaWiki/1.38.0-rc.0","api-user-agent":"VisualEditor-MediaWiki/1.38.0-rc.0","x-client-ip":"::ffff:192.168.128.20","x-forwarded-for":"::ffff:192.168.128.20","x-request-id":"65e84430-ca39-11ec-80d5-5303b9bf502a","x-request-class":"external"}},"request_id":"65e84430-ca39-11ec-80d5-5303b9bf502a","levelPath":"error/request","msg":"Invalid URI \"http:///$%7B$.req uest.params.domain%7D/rest.php/testwiki-fat.wiki.internal/v3/transform/pagebundle/to/wikitext/Main_Page/20\"","time":"2022-05-02T17:00:41.352Z","v":0} |
This syntax does work however for the api endpoint and restbase base uri (and is recommended in the docs:
apiUriTemplate: "{{'http://{domain}/api.php'}}" baseUriTemplate: "{{'http://restbase.wiki.internal:7231/{domain}/v1'}}"
Using curl or web browser this returns the main page as expected:
http://restbase.wiki.internal/testwiki.wiki.internal/v1/page/html/Main_Page
As does the same request directly to parsoid:
http://testwiki.wiki.internal/rest.php/testwiki.wiki.internal/v3/page/html/Main%20Page/20
If I change config.yaml for restbase to use a DNS entry to point all wiki servers to a single wiki for parsoid I get errors like 'Validation of `domain` failed' |
---|
{"message":"Error: exception of type Wikimedia\\ParamValidator\\ValidationException: Validation of `domain` failed: invalid-domain {\"expected\":\"testwiki-a.wiki.internal\",\"actual\":\"testwiki-b.wiki.internal\"}","exception":{"id":"699104fa54c628eaf170cbb0","type":"Wikimedia\\ParamValidator\\ValidationException","file":"/var/lib/mediawiki/vendor/wikimedia/parsoid/extension/src/Rest/Handler/ParsoidHandler.php","line":162,"message":"Validation of `domain` failed: invalid-domain {\"expected\":\"testwiki-a.wiki.internal\",\"actual\":\"testwiki-b.wiki.internal\"}","code":0,"url":"/rest.php/testwiki-b.wiki.internal/v3/page/html/Main%20Page/20","caught_by":"other","backtrace":[{"file":"/var/lib/mediawiki/vendor/wikimedia/parsoid/extension/src/Rest/Handler/ParsoidHandler.php","line":260,"function":"assertDomainIsCorrect","class":"MWParsoid\\Rest\\Handler\\ParsoidHandler","type":"->"},{"file":"/var/lib/mediawiki/vendor/wikimedia/parsoid/extension/src/Rest/Handler/PageHandler.php","line":75,"function":"getRequestAttributes","class":"MWParsoid\\Rest\\Handler\\ParsoidHandler","type":"->"},{"file":"/var/lib/mediawiki/includes/Rest/Router.php","line":414,"function":"execute","class":"MWParsoid\\Rest\\Handler\\PageHandler","type":"->"},{"file":"/var/lib/mediawiki/includes/Rest/Router.php","line":338,"function":"executeHandler","class":"MediaWiki\\Rest\\Router","type":"->"},{"file":"/var/lib/mediawiki/includes/Rest/EntryPoint.php","line":167,"function":"execute","class":"MediaWiki\\Rest\\Router","type":"->"},{"file":"/var/lib/mediawiki/includes/Rest/EntryPoint.php","line":132,"function":"execute","class":"MediaWiki\\Rest\\EntryPoint","type":"->"},{"file":"/var/lib/mediawiki/rest.php","line":31,"function":"main","class":"MediaWiki\\Rest\\EntryPoint","type":"::"}]},"httpCode":500,"httpReason":"Internal Server Error"} |
Clearly it is not allowed for one wiki to parse text for another. Is there a flag to change this behavior perhaps?
So either I need to figure out how to get restbase to dynamically create the correct URL or how to configure a parsoid php server to respond for other wiki sites.
I have no problem getting restbase and parsoid working when everything is in the same container/VM.
Here is my full config.yaml |
---|
bash-5.1# cat restbase/config.yaml # # Simple RESTBase config for Mediawiki Container # https://www.mediawiki.org/wiki/RESTBase/Installation # # - cassandra DB # - parsoid at http://localhost/rest.php # - wiki at http://testwiki.wiki.internal/api.php # # - proxied via nginx, available via # - http://hostname/api/rest_v1/ # services: - name: restbase module: hyperswitch conf: port: 7231 salt: 988881adc9fc3655077dc2d4d757d480b5ea0e11 default_page_size: 125 user_agent: RESTBase ui_name: RESTBase ui_url: https://www.mediawiki.org/wiki/RESTBase ui_title: RESTBase docs spec: x-request-filters: - path: lib/security_response_header_filter.js - path: lib/normalize_headers_filter.js x-sub-request-filters: - type: default name: http options: allow: - pattern: /^https?:\/\// paths: /{domain}/{api:v1}: x-modules: - spec: info: version: 1.0.0 title: Wikimedia REST API description: Welcome to your RESTBase API. x-route-filters: - path: ./lib/normalize_title_filter.js options: redirect_cache_control: 's-maxage=0, max-age=86400' paths: /page: x-modules: - path: v1/content.yaml options: response_cache_control: 's-maxage=0, max-age=86400' - path: v1/content_segments.yaml options: response_cache_control: 's-maxage=0, max-age=86400' - path: v1/common_schemas.yaml - path: v1/summary.js - path: v1/related.js - path: v1/random.yaml - path: v1/pdf.js options: uri: http://restbase.wiki.internal:3030 secret: secret /transform: x-modules: - path: v1/transform.yaml /media: x-modules: - path: v1/mathoid.yaml options: host: http://restbase.wiki.internal:10042 /data: x-modules: - path: v1/citoid.js options: host: http://restbase.wiki.internal:1970 - path: v1/lists.js - path: v1/recommend.yaml - path: v1/javascript.yaml - path: v1/css.yaml /{domain}/{api:sys}: x-modules: - path: projects/proxy.yaml options: backend_host_template: '{{"/{domain}/sys/legacy"}}' - spec: paths: /table: x-modules: - path: sys/table.js options: conf: version: 1 backend: cassandra hosts: - cassandradb pool_idle_timeout: 20000 retry_delay: 250 retry_limit: 10 show_sql: false keyspace: system defaultConsistency: localOne localDc: datacenter1 datacenters: - datacenter1 storage_groups: - name: local domains: /./ /legacy/key_value: x-modules: - path: sys/key_value.js /legacy/page_revisions: x-modules: - path: sys/page_revisions.js /post_data: x-modules: - path: sys/post_data.js /action: x-modules: - path: sys/action.js options: apiUriTemplate: "{{'http://{domain}/api.php'}}" baseUriTemplate: "{{'http://restbase.wiki.internal:7231/{domain}/v1'}}" /page_save: x-modules: - path: sys/page_save.js /events: x-modules: - path: sys/events.js /parsoid: x-modules: - path: sys/parsoid.js options: parsoidHost: "{{'http://{domain}/rest.php'}}" grace_ttl: 1000000 /mathoid: x-modules: - path: sys/mathoid.js options: host: "{{'http://restbase.wiki.internal:10042'}}" # Finally, a standard service-runner config. info: name: restbase logging: name: restbase level: warn streams: - type: stdout num_workers: 0 bash-5.1# |
I found this page but it is for parsoid js, if there was an equivalent for parsoid php it would be very helpful:
https://www.mediawiki.org/wiki/Parsoid/Setup/RESTBase/Arbitrary_domains
After upgrading to MediaWiki 1.37.1, I can no longer use the visual editor. The loading box pops up and then gives me the following error:
Error contacting the Parsoid/RESTBase server: (curl error: 7) Couldn't connect to server
I am not even sure how to diagnose this. I spent about 4 hours on the Google trying to find solutions. None seemed to work or were even applicable. Any help would be appreciated?
I am running:
Ubuntu Server 20.04.3 as a VM
Apache 2.4.41
PHP 7.4.3
MariaDB 10.5.13 (not local)
Can you paste your Parsoid configuration from your LocalSettings.php
The first step is to isolate Parsoid and see if that works on its own
I am not sure my LocalSetting.php file has the configuration you are talking about. I did a text search for "parsoid" and nothing came up.
Do you have a $wgVirtualRestConfig
See https://www.mediawiki.org/wiki/Extension:VisualEditor#Linking_with_Parsoid
I do not have this in my LocalSettings.php file. I basically have a near Out of the Box LocalSettings.php file except some additional $wgFileExtensions appended to the end. All of the was working fine in 1.37.0. I will try adding this later.
Is this something I need to do because my LocalSettings.php is from my initial install at 1.36.2 or 1.36.3? The upgrade to 1.37.0 went fine.
It's possible you don't need that variable, there is a zero config setup, I believer, and adding that might make things worse.
Did you look at the troubleshooting guide, https://www.mediawiki.org/wiki/Extension:VisualEditor#Troubleshooting
The error code you're seeing mentioned there.
It does up once for a Docker install. I am not using Docker. Just a native install.
An error is being reported by curl. My suggestion would be to log those errors and see what url it's trying to access.
Apologies, but how do I do that? I did some googling, but I was not successful in finding the logs for that error.
Presumably runMultiCurl is being called and it looks like a warning will be logged, https://github.com/wikimedia/mediawiki/blob/91e4fc00ca15aa485bde39d6f7fd99329077d98d/includes/libs/http/MultiHttpClient.php#L299-L300
I imagine you need to set a $wgDebugLogFile in your LocalSettings.php https://www.mediawiki.org/wiki/Manual:How_to_debug#Logging
Okay. Here is what I think are the two pertinent log lines, obfuscated for security:
[http] HTTP start: GET https://mywiki.my.domain/rest.php/mywiki.my.domain/v3/page/html/Main_Page/3?redirect=false&stash=true
[http] Error fetching URL "https://mywiki.my.domain/rest.php/mywiki.my.domain/v3/page/html/Main_Page/3?redirect=false&stash=true": (curl error: 7) Couldn't connect to server
I do not know enough about how it is supposed to work to know what might be wrong
What happens when you visit that url directly, say in a browser
I get the following:
{"error":"rest-read-denied","httpCode":403,"httpReason":"Forbidden"}
That's a different error. You connected but didn't forward a cookie so don't have permission to access the api. But it shows that you can connect to the endpoint.
The curl error says that MediaWiki can't connect, which means that it is probably having a hard time resolving the right address for your domain. That is indeed similar to the docker issue linked to before at https://www.mediawiki.org/wiki/Extension:VisualEditor#Troubleshooting
Oh okay. So, I think you are correct in that it might be similar. I did not realize it until you mentioned it, the hostname of my server is the same as the "mywiki" part of mywiki.my.domain. Let me change the hostname and retest. I will follow-up with the results.
Okay. That did the trick. Interesting that this was not an issue before I upgraded. How can I help to get that docker issue text updated to reflect my circumstances as well? I bet this would help some people.
Also, thank you so much for helping me! I really appreciate it considering I am a bit of n00b.
mediawiki.org is a wiki, please just edit the page as you see fit
Versions
- Mediawiki: 1.34.4
- Node.js: 8.11.11
- Parsoid: 0.11.0
- OS: CentOS 7.9.2009
Issue
I am currently using Parsoid to convert wikitext to html. However, when I have an inter-wiki link that includes a pipe such as [[Main Page|test 123]]
, Parsoid converts it to href="http://127.0.0.1:8080/wiki1/Main_Pagetest_123" title="Main Pagetest 123"
(omitting some of the other html output for the link)
If anyone has any understand why this is happening or how to work around it, I'd really appreciate it!
Odd. Is it actually a vertical bar or some other unicode character?
Does it happen on the command line as well? echo "test 123" | node bin/parse.js
Oh my goodness, this is 100% user error. It does work from the command line. The reason it doesn't work from inside my program is because I was stripping pipe characters from the text being converted 🤦♀️
False alarm. Thank you for your help and quick response time that allowed me to spot my own idiocy!