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
[Bug]: Header/Footer placeholders stopped working in chrome-headless-shell in Docker #12196
Comments
This issue was not reproducible. Please check that your example runs locally and the following:
Once the above checks are satisfied, please edit your issue with the changes and we will |
I am able to reproduce in docker but not able to reproduce on a full Linux distro. |
Maybe we are missing some additional packages to run on Linux? That's my current additional installs which was working before v22
|
@josiasmontag Did you find any workaround? (apart from downgrading to v21) I can confirm it is working just fine under Linux while developing, but when building the Docker image the header/footer are missing. |
It has to be some missing packages (fonts maybe?), I tried a bunch and so far has not been able to identify it |
I don't think it's the font as the word "Page" is showing. Must be a package of some sort.
|
So in the browser the parameters for the footer/header are executed as a script https://source.chromium.org/chromium/chromium/src/+/main:components/printing/renderer/print_render_frame_helper.cc;l=680;drc=f0f5f3ceebb00da9363ccc7a1e2c0f17b6b383ba and that ends up on the page for the footer/header https://source.chromium.org/chromium/chromium/src/+/main:components/printing/resources/print_header_footer_template_page.html;l=83;drc=f6529c7990744370869e4ab2794caae6c46ba044 I do not see so far why the values could be empty so I currently assume that something happens with the rendering |
Perhaps there is some sort of script execution error. |
I don't think you can log from the footer/header frame (at least not without adding some extra code to get console messages) |
I have built a tip-of-trip headless shell and I am not able to reproduce an issue with it in Docker. Perhaps, something produced by the build is missing. |
@OrKoN Would you be able to send us your docker file so we can test on our Linux VM? |
The Dockerfile is here https://github.com/puppeteer/puppeteer/blob/main/docker/Dockerfile |
@OrKoN Based on that Dockerfile, I tried using Update: Removed unrelated comment about color issues when printing with non-shell headless Chrome (it yields the same output as when using the print dialog in headful Chrome) |
@Peque this issue description already provides this information. As for color, sounds unrelated: in general, the printing with headless Chrome (not shell) should match printing using the print dialog in headful Chrome. |
This is probably unrelated but another time that page numbers broke on Docker installs (despite working fine on normal Linux installs), the solution was to copy the I haven't tried this as I'm unsure as to where to copy the dir to for |
From another user:
Originally posted by @outbackStack in #5345 (comment) |
From myself on a new issue closed as a dupe of this one:
The footer adds, but displays "Page of" instead of "Page 3 of 12" E.G. Whereas without Similar to the OP I am running Debian (latest). I am using Docker (latest) to install and run Puppeteer (latest). Originally posted by @dannybeckett in #12361 (comment) |
I filed an upstream issue https://crbug.com/337047877 as it does look like something is missing from chrome-headless-shell |
I can confirm it is caused by locales (thanks for the hint). Copying locales from chromium seems to help but also setting |
yah! thanks everyone! I can get my page number back! LOL |
This was also fixed upstream to properly detect en_US.POSIX locale and https://crbug.com/338179885 filed to include locales into the headless shell distribution to support other locales. With this, I am closing the issue and the fix will be out with the next release. |
Minimal, reproducible example
Error string
no error
Bug behavior
Background
Since Puppeteer v22, the magic CSS classes stopped working on Linux and old headless (
shell
) mode:It works correctly:
shell
)Reproducer using Docker and the script above:
docker run -i --init --cap-add=SYS_ADMIN --rm -v .:/home/pptruser/output/ ghcr.io/puppeteer/puppeteer:latest node -e "$(cat test.js)"
Also see #10024 (last 2 comments)
Expectation
I expected to get the
pageNumber
andtotalPages
placeholder to be replaced.Reality
It does not get replaced on Linux with headless
shell
.Puppeteer configuration file (if used)
No response
Puppeteer version
22.6.2
Node version
20.11.1
Package manager
npm
Package manager version
10.2.4
Operating system
Linux
The text was updated successfully, but these errors were encountered: