Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to transform mermaid.js at jsonify #1321

Closed
multun opened this issue Nov 25, 2022 · 3 comments
Closed

failed to transform mermaid.js at jsonify #1321

multun opened this issue Nov 25, 2022 · 3 comments

Comments

@multun
Copy link
Contributor

multun commented Nov 25, 2022

Hello there! While testing a patch, I found out that the website I'm working on (which only uses docsy) does not build anymore on the development branch. I use the latest docker-hugo with ext-alpine and a submodule workflow.

I ran a bisect and found out this error only happens since 90843e3 (from #990, by @stephanlachnit)

Symptoms

This warning (always)

.Path when the page is backed by a file is deprecated and will be removed in a future release. We plan to use Path for a canonical source path and you probably want to check the source is a file. To get the current behaviour, you can use a construct similar to the one below:

  {{ $path := "" }}
  {{ with .File }}
	{{ $path = .Path }}
  {{ else }}
	{{ $path = .Path }}
  {{ end }}

This error (when there's a rebuild server running)

Rebuild failed: EXECUTE-AS-TEMPLATE: failed to transform "js/mermaid.js" (text/javascript) at <jsonify>: error calling jsonify: json: error calling MarshalJSON for type page.Page: unsupported type: func() page.Pages

And when building from scratch, I get an horribly long strack overflow trace which recursively loops on page.MarshalPageToJSON / MarshalJSON

Reproducer

# get the site source
git clone --recurse-submodules git@github.com:DGEXSolutions/osrd-website.git
cd osrd-website
# checkout the failing revision
(cd themes/docsy; git reset --hard 90843e360b921ea8417995e0261a355f2f3aed7a)
# npm install dependencies
docker run --rm -it -v $(pwd):/src -w /src/themes/docsy --entrypoint npm klakegg/hugo:ext-alpine install
# build the thing
docker run --rm -it -v $(pwd):/src -p 1313:1313 klakegg/hugo:ext-alpine server
@deining
Copy link
Collaborator

deining commented Nov 26, 2022

Most likely, this is due to a know bug addressed in (and hopefully fixed by) #1316.

Workaround:

Remove these two lines from your config.toml.

[params.mermaid]
enable = true

https://github.com/DGEXSolutions/osrd-website/blob/9e04989c0ebddd5d42bbbb7083db1362e3e5dc90/config.toml#L153-L154

And make sure you use a hugo version >= 0.93.0 (your netlify.toml specifies outdated hugo version 0.88.1).

Does this cure your problem?

@multun
Copy link
Contributor Author

multun commented Nov 26, 2022

Yup, you're indeed correct, thanks!

@multun multun closed this as completed Nov 26, 2022
@multun
Copy link
Contributor Author

multun commented Dec 2, 2022

(to clarify, we're not using netlify, it's an artifact from the past, I closed the issue because the proposed workaround and fix both work)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants