mermaid-server
mermaid-server copied to clipboard
Output doesn't write to --out path in Docker
Tracking this here in case it's relevant / actionable...
Description
When running the docker container (make docker-run
), and making a request, it looks like the "in" file (.mmd
) gets written, but the "out" file (.svg
) doesn't get written, and the container returns a 500
.
Notes
I made a slight modification to the Makefile
in order to build the docker image on my M1 Mac.
docker-image:
docker buildx build --platform linux/amd64 -t ${DOCKER_IMAGE} .
Docker logs
2022/08/04 14:01:53 [500] could not generate diagram: cachingGenerater.generate failed: failed when executing mermaid: exit status 1: Generating single mermaid chart
:
ProtocolError: Protocol error (Target.createTarget): Target closed.
at /usr/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:103:24
at new Promise (<anonymous>)
at Connection.send (/usr/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:99:16)
at Browser._createPageInContext (/usr/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Browser.js:258:91)
at BrowserContext.newPage (/usr/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Browser.js:622:75)
at Browser.newPage (/usr/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Browser.js:252:75)
at /usr/app/node_modules/@mermaid-js/mermaid-cli/index.bundle.js:174:32
at Generator.next (<anonymous>)
at asyncGeneratorStep (/usr/app/node_modules/@mermaid-js/mermaid-cli/index.bundle.js:18:103)
at _next (/usr/app/node_modules/@mermaid-js/mermaid-cli/index.bundle.js:20:194)
This https://github.com/puppeteer/puppeteer/issues/1947 issue seems to be related
Thanks for raising this - does this only happen for a small percentage of requests or is it all of them? Does it seem more prevalent under certain conditions? I'm having trouble replicating it locally
For me, it seems to be 100% of requests, when running in Docker
curl --location --request POST 'http://localhost:8080/generate' \
--header 'Content-Type: text/plain' \
--data-raw 'graph LR
A-->B
B-->C
C-->D
C-->F'
(Copied from Postman)
If I run the project with go
, it just works
go run cmd/app/main.go --mermaid=./mermaidcli/node_modules/.bin/mmdc --in=./tmp --out=./tmp
Ah OK thanks for that, it will help me figure out what's going on.
Going off of the linked issue I expected it's a misconfiguration of puppeteer in the docker image.