Comments (14)
v3.3.0 provides CHROME_NO_SANDBOX
env to opt out Chrome sandbox explicitly.
from marp-cli.
I'm not very familiar with ECS, but do you think it will work if swapped is-docker to is-inside-container?
from marp-cli.
I'm not very familiar with ECS, but do you think it will work if swapped is-docker to is-inside-container?
It might solve the problem, but unfortunately is-inside-container
is a pure ESM package, so I don't think it is available in marp-cli
which is exposed as CommonJS...
If you would like, I can create a PR to publish the ES Module along with CommonJS as well.
from marp-cli.
is-inside-container
is a pure ESM package, so I don't think it is available inmarp-cli
which is exposed as CommonJS...
Marp CLI has already used a lot of pure ESM packages, including is-docker
v3. There should be no barriers to replacement. :)
from marp-cli.
Marp CLI has already used a lot of pure ESM packages, including is-docker v3. There should be no barriers to replacement. :)
I think it is because is-docker
is bundled and not required
when building by rollup.
In fact, in the post-build code, the is-docker
code is bundled.
I think the reason it is bundled is because is-docker
only depends on node's standard modules.
However, is-inside-container
is not bundled because it depends on is-docker
. In fact, if you make the following modifications and run yarn build:standalone
, you will see that there is require("is-inside-container")
.
// src/utils/docker.ts
// import _isDocker from 'is-docker';
import isInsideContainer from 'is-inside-container';
export const isDocker = () => isOfficialImage() || isInsideContainer();
export const isOfficialImage = () => !!process.env.MARP_USER;
Thus, running node marp-cli.js
will result in the following error.
$ node marp-cli.js
...
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/study/workspace/marp-cli/node_modules/is-inside-container/index.js from /home/study/workspace/marp-cli/lib/marp-cli-d775c9f3.js not supported.
Instead change the require of index.js in /home/study/workspace/marp-cli/lib/marp-cli-d775c9f3.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/home/study/workspace/marp-cli/lib/marp-cli-d775c9f3.js:1:383)
at Object.<anonymous> (/home/study/workspace/marp-cli/lib/marp-cli.js:1:75)
at Object.<anonymous> (/home/study/workspace/marp-cli/marp-cli.js:5:1) {
code: 'ERR_REQUIRE_ESM'
}
Therefore, if we want to use is-inside-container
, we will need to make your code ES Module after the build.
from marp-cli.
Therefore, if we want to use
is-inside-container
, we will need to make your code ES Module after the build.
We don't have to need to ship CLI as ESM. Check out #544. rollup will bundle is-inside-container
correctlly :)
from marp-cli.
Released new version v3.2.1, that is using is-inside-container
instead of is-docker
to detect virtualized containers.
Could you try it? If ECS used Podman to host the container, it may mitigate the issue brought by Chromium and its sandbox.
from marp-cli.
Perhaps there was an error in perception on my part.
Thank you very much. I will check it out.
from marp-cli.
We don't have to need to ship CLI as ESM. Check out #544. rollup will bundle is-inside-container correctlly :)
I guess I didn't understand about the rollup
behavior, if I set is-inside-container
in devDependencies, it is indeed bundled, so no problem. My sincere apologies.
Could you try it? If ECS used Podman to host the container, it may mitigate the issue brought by Chromium and its sandbox.
I updated the version and Deployed to ECS to check, but got an error. However, the error message changed to the following.
Failed converting Markdown.(Protocol error (Target.setAutoAttach): Target closed)
from marp-cli.
Try updating your Dockerfile to run Chrome as non root user, as does in official images such as Marp CLI and Puppeteer.
https://stackoverflow.com/questions/75495565/puppeteer-docker-target-setautoattach-target-is-closed
It's also helpful for debug to set DEBUG
env as puppeteer:*
.
from marp-cli.
Thank you.
I will try, it may take some time due to circumstances.
from marp-cli.
I thought the error had changed, but the debug log shows that the error has not changed.
Here are the details of the error logs.
puppeteer:error [
TargetCloseError: Protocol error (Target.setDiscoverTargets): Target closed
at CallbackRegistry.clear(/home/marp/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:138:36)
at Connection.#onClose(/home/marp/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:282:25)
at Socket.<anonymous> (/home/marp/app/node_modules/puppeteer-core/lib/cjs/puppeteer/node/PipeTransport.js:24:34)
at Socket.emit (node:events:525:35)
at Pipe.<anonymous> (node:net:301:12)
]
puppeteer:protocol:SEND► [ '{"method":"Browser.close","id":3}' ]
{"time":"2023-08-..........","error":{"message":"Failed converting Markdown. (Protocol error (Target.setAutoAttach): Target closed)","stack":"CLIError: Failed converting Markdown. (Protocol error (Target.setAutoAttach): Target closed)\n ...","status":null}}
puppeteer:browsers:launcher Browser process 56 onExit
from marp-cli.
is-inside-container
is intended to identify common container services used to run the built image, but it might not work within some AWS infrastructures, that are opaque such as App Runner or Fargate.
AWS ECS, that is mentioned at the subject, basically just hosts the built container image, so it is unlikely that ECS is the root cause. What AWS service are you using to run the image?
If the workaround the MARP_USER
environment variable was helpful, is helpful providing more explicit setting, such as the PUPPETEER_NO_SANDBOX
environment variable?
from marp-cli.
AWS ECS, that is mentioned at the subject, basically just hosts the built container image, so it is unlikely that ECS is the root cause. What AWS service are you using to run the image?
I use Fargate
in that sense.
If the workaround the MARP_USER environment variable was helpful, is helpful providing more explicit setting, such as the PUPPETEER_NO_SANDBOX environment variable?
Yes, I believe so.
from marp-cli.
Related Issues (20)
- The latest Docker image fails PDF rendering (`Protocol error (Page.printToPDF): printing failed`)
- Add support for `lang` directive HOT 3
- Generation of PDF failed with too much latex formulas HOT 2
- Marp crashes with NodeJS LTS 18.18.0 HOT 3
- The coloring of CLI output is not accessible HOT 1
- Transparent background does not work when outputting in png format HOT 2
- Unable to launch marp if a subdirectory or file is not readable HOT 1
- marp stuck a long time without any output HOT 6
- Greek characters in path HOT 3
- Marp and inotifywait HOT 2
- Keyboard shortcuts for moving quickly inside the presentation HOT 2
- Experiment: File conversions using Firefox through WebDriver BiDi
- Server Mode Auto-refresh Does Not Work in Docker HOT 3
- Different styling in HTML and PDF HOT 2
- Investigate about Node.js single executable applications
- Add HTML head meta icon customization HOT 1
- Cache issue with ?pdf HOT 3
- [Bespoke transitions] Compatibility with Safari
- marp.exe rendering and watch mode do not work in msys on Windows 10 (i.e. git-bash) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from marp-cli.