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

Output doesn't write to --out path in Docker #88

Open
thiskevinwang opened this issue Aug 4, 2022 · 3 comments
Open

Output doesn't write to --out path in Docker #88

thiskevinwang opened this issue Aug 4, 2022 · 3 comments

Comments

@thiskevinwang
Copy link

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 puppeteer/puppeteer#1947 issue seems to be related

@TomWright
Copy link
Owner

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

@thiskevinwang
Copy link
Author

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

@TomWright
Copy link
Owner

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.

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