SemanticMediaWiki / Mermaid

Provides a parser function to generate diagrams and flowcharts with the help of the mermaid script language
https://www.mediawiki.org/wiki/Extension:Mermaid
Other
36 stars 23 forks source link

Error from line 30 of /srv/mediawiki/w/extensions/Mermaid/src/ServiceWiring.php: Class 'Mermaid\Config' not found #60

Closed RhinosF1 closed 3 years ago

RhinosF1 commented 3 years ago

Setup and configuration

Issue

Produces a stack trace and outputs:

{{#mermaid:sequenceDiagram
participant Alice
participant Bob
  Alice->John: Hello John, how are you?
  loop Healthcheck
       John->John: Fight against hypochondria
  end
  Note right of John: Rational thoughts <br/>prevail...
    John-->Alice: Great!
    John->Bob: How about you?
    Bob-->John: Jolly good!
}}

Gives

2020-10-14 07:14:26 mw4 socdemwikiwiki: [044d1c37a175962eb645be42] /w/index.php?title=User:Godless_Raven/sandbox&action=submit Error from line 30 of /srv/mediawiki/w/extensions/Mermaid/src/ServiceWiring.php: Class 'Mermaid\Config' not found

Steps to reproduce the observation (recommendation is to use the sandbox):

kghbln commented 3 years ago

Thanks for reporting. I created this on sandbox and the logs remain silent. Also the graph is shown.

antibarbie commented 3 years ago

I fell on the same trap today... so just adding my 2 cents to this issue....

Same code produces same problem with

So : Probably the solution is just that we didn't do the yarn install before using the extension ? The documentation is a bit unclear on this point (either composer --update or git clone ...)


[b3a35bc42ebad45948e29636] /wiki/index.php?title=Utilisateur:Julien&action=submit Error from line 30 of /var/www/mediawiki-1.35.1/extensions/Mermaid/src/ServiceWiring.php: Class 'Mermaid\Config' not found

Backtrace:

0 /var/www/mediawiki-1.35.1/vendor/wikimedia/services/src/ServiceContainer.php(447): Wikimedia\Services\ServiceContainer->{closure}()

1 /var/www/mediawiki-1.35.1/vendor/wikimedia/services/src/ServiceContainer.php(416): Wikimedia\Services\ServiceContainer->createService()

2 /var/www/mediawiki-1.35.1/extensions/Mermaid/src/MermaidParserFunction.php(54): Wikimedia\Services\ServiceContainer->getService()

3 /var/www/mediawiki-1.35.1/includes/parser/Parser.php(3340): Mermaid\MermaidParserFunction::onParserFunction()

kghbln commented 3 years ago

@antibarbie Thank you for your comment. I guess "I Could NOT reproduce it when installing the 3.0.0 with composer --update." was a decisive information. Indeed this extension is only meant to be installed with Composer. I updated the documentation accordingly to make this clear and move out the MermaidJS update information to a separate developers only file.

@RhinosF1 I suspect that you cloned in this extension rather than using Composer. Is this assumption correct?

RhinosF1 commented 3 years ago

Git submodule but composer should be setup to run composer install. This is the second time composer has done weird though that I've been asked about. You can see our MediaWiki install under miraheze/MediaWiki and composer stuff in the puppet repo under extensionsetup.pp

RhinosF1 commented 3 years ago

I can still reproduce this on https://socdemwiki.miraheze.org/w/index.php?title=User:RhinosF1/sandbox&action=submit after whatever updates have happened in the last 3 months including that server being reinstalled.

kghbln commented 3 years ago

Thank you for your feedback. It appears that @paladox was able to figure out what is going on and provided a pull request. Much appreciated.