Skip to content

Commit

Permalink
[Reporting] update puppeteer to version 23.3.1 (elastic#192345)
Browse files Browse the repository at this point in the history
## Summary

Update for puppeteer, the following changeset updates puppeteer to
version `23.3.1`.

The chromium version required for this version of puppeteer is
`128.0.6613.137` from revision `1331488`, as such the chromium binary
included for windows and darwin platforms either match or were the
closest revision to the expectation. The linux headless binary was built
from commit `fe621c5aa2d6b987e964fb1b5066833da5fb613d` of the same
revision.

_**N.B.**_ Puppeteer 23.0.0 is earmarked as containing breaking changes
see
[here](https://github.com/puppeteer/puppeteer/blob/abda5dcc9912f4fa2c5a566403108db783f48538/packages/puppeteer-core/CHANGELOG.md#2300-2024-08-07),
this PR considers the outlined changes and makes relevant adjustments so
reporting continues working as is.

<!--
### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
-->


### How to verify linux headless build
- clone the following repo
https://github.com/tsullivan/kibana-dev-docker
- pull this particular PR
- follow the steps outlined in the repo, replacing any occurrence of
`kibana-<version>-SNAPSHOT-linux-aarch64.tar.gz` from the repo above's
step with the output of running build on this changeset.
- before running step 4, modify the `kibana.yml` file from the
`kibana-dev-docker` repo and include the following so we might be able
to verify the version of chromium running;
   ```yaml
     logging.loggers:
       - name: plugins.reporting
         level: debug
   ```
- complete the steps outlined in the README, you'll have a linux distro
of kibana running on port `5601`
- Attempt creating exports of PDF and PNG reports, in dashboard, canvas,
and visualizations, on report creation attempt we would see a log output
that prints out the chromium version exactly matching this;

<img width="1326" alt="Screenshot 2024-09-18 at 14 50 19"
src="https://github.com/user-attachments/assets/7206781a-e8f9-469c-ad65-fd13749766b2">

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 18, 2024
1 parent d84eda1 commit 91ca8ab
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 65 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,7 @@
"pretty-ms": "6.0.0",
"prop-types": "^15.8.1",
"proxy-from-env": "1.0.0",
"puppeteer": "22.13.1",
"puppeteer": "23.3.1",
"query-string": "^6.13.2",
"rbush": "^3.0.1",
"re-resizable": "^6.9.9",
Expand Down
34 changes: 17 additions & 17 deletions packages/kbn-screenshotting-server/src/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ export class ChromiumArchivePaths {
platform: 'darwin',
architecture: 'x64',
archiveFilename: 'chrome-mac.zip',
archiveChecksum: 'fa8004f3c8c5574c089c901e48429d1b01720bf3dd25e05ac56c41d0ab470c10',
binaryChecksum: '56f25cb6881e5c2b1aac0d8e87630517d1af8effdc9319d35f872add048df1ca',
archiveChecksum: '0a3d18efd00b3406f66139a673616b4b2b4b00323776678cb82295996f5a6733',
binaryChecksum: '8bcdaa973ee11110f6b70eaac2418fda3bb64446cf37f964fce331cdc8907a20',
binaryRelativePath: 'chrome-mac/Chromium.app/Contents/MacOS/Chromium',
revision: 1300317, // 1300313 is not available for Mac_x64
revision: 1331485, // 1331488 is not available for Mac_x64
location: 'common',
archivePath: 'Mac',
isPreInstalled: false,
Expand All @@ -58,44 +58,44 @@ export class ChromiumArchivePaths {
platform: 'darwin',
architecture: 'arm64',
archiveFilename: 'chrome-mac.zip',
archiveChecksum: 'bea49fd3ccd6aaccd7cdc4df38306f002a2934aaa2c044f3b5a3272b31ec77ca',
binaryChecksum: '4c55d9e47deb1179c377c9785afdcdb5f3d3f351bff62b414d43e32ff195bd55',
archiveChecksum: '426eddf16acb88b9446a91de53cc4364c7d487414248f33e30f68cf488cea0c0',
binaryChecksum: '827931739bfdd2b6790a81d5ade8886c159cd051581d79b84d1ede447293e9cf',
binaryRelativePath: 'chrome-mac/Chromium.app/Contents/MacOS/Chromium',
revision: 1300314, // 1300313 is not available for Mac_Arm
revision: 1331488,
location: 'common',
archivePath: 'Mac_Arm',
isPreInstalled: false,
},
{
platform: 'linux',
architecture: 'x64',
archiveFilename: 'chromium-5b5d829-locales-linux_x64.zip',
archiveChecksum: '799e8fd5f47ea70b8a3972d39b2617c9cbebc7fc433a89251dae312a7c77534b',
binaryChecksum: '216b8f7ff9b41e985397342c2df54e4f8e07a01a3b8a929f39b9a10931d26ff5',
archiveFilename: 'chromium-fe621c5-locales-linux_x64.zip',
archiveChecksum: '12ce2e0eac184072dfcbc7a267328e3eb7fbe10a682997f4111c0378f2397341',
binaryChecksum: '670481cfa8db209401106cd23051009d390c03608724d0822a12c8c0a92b4c25',
binaryRelativePath: 'headless_shell-linux_x64/headless_shell',
revision: 1300313,
revision: 1331488,
location: 'custom',
isPreInstalled: true,
},
{
platform: 'linux',
architecture: 'arm64',
archiveFilename: 'chromium-5b5d829-locales-linux_arm64.zip',
archiveChecksum: '961e20c45c61f8e948efdc4128bb17c23217bbcb28537f270ccf5bf0826981e7',
binaryChecksum: 'fc4027fb6b1c96bef9374d5d9f791097fae2ec2ddc4e0134167075bd52d1458f',
archiveFilename: 'chromium-fe621c5-locales-linux_arm64.zip',
archiveChecksum: 'f7333eaff5235046c8775f0c1a0b7395b7ebc2e054ea638710cf511c4b6f9daf',
binaryChecksum: '8a3a3371b3d04f4b0880b137a3611c223e0d8e65a218943cb7be1ec4a91f5e35',
binaryRelativePath: 'headless_shell-linux_arm64/headless_shell',
revision: 1300313,
revision: 1331488,
location: 'custom',
isPreInstalled: true,
},
{
platform: 'win32',
architecture: 'x64',
archiveFilename: 'chrome-win.zip',
archiveChecksum: '27a2ed1473cefc6f48ff5665faa1fbcc69ef5be47ee21777a60e87c8379fdd93',
binaryChecksum: 'd603401a5e6f8bd734b329876e4221a4d24a1999f14df6e32eeb5e6a72520d96',
archiveChecksum: 'fa62be702f55f37e455bab4291c59ceb40e81e1922d30cf9453a4ee176b909bc',
binaryChecksum: '1345e66583bad1a1f16885f381d1173de8bf931487da9ba155e1b58bf23b2c66',
binaryRelativePath: path.join('chrome-win', 'chrome.exe'),
revision: 1300320, // 1300313 is not available for win32
revision: 1331487, // 1331488 is not available for win32
location: 'common',
archivePath: 'Win',
isPreInstalled: true,
Expand Down
2 changes: 1 addition & 1 deletion x-pack/build_chromium/linux/args.gn
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ v8_symbol_level = 0
enable_ink = false
rtc_build_examples = false
angle_build_tests = false
enable_screen_ai_service = false
use_fake_screen_ai = true
enable_vr = false

# Please, consult @elastic/kibana-security before changing/removing this option.
Expand Down
25 changes: 14 additions & 11 deletions x-pack/plugins/screenshotting/server/browsers/chromium/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,17 @@ export class HeadlessChromiumDriver {
if (error) {
await this.injectScreenshottingErrorHeader(error, getPrintLayoutSelectors().screenshot);
}
return this.page.pdf({
format: 'a4',
preferCSSPageSize: true,
scale: 1,
landscape: false,
displayHeaderFooter: true,
headerTemplate: await getHeaderTemplate({ title }),
footerTemplate: await getFooterTemplate({ logo }),
});
return Buffer.from(
await this.page.pdf({
format: 'a4',
preferCSSPageSize: true,
scale: 1,
landscape: false,
displayHeaderFooter: true,
headerTemplate: await getHeaderTemplate({ title }),
footerTemplate: await getFooterTemplate({ logo }),
})
);
}

/*
Expand All @@ -272,6 +274,7 @@ export class HeadlessChromiumDriver {
}

const { boundingClientRect, scroll } = elementPosition;

const screenshot = await this.page.screenshot({
clip: {
x: boundingClientRect.left + scroll.x,
Expand All @@ -282,8 +285,8 @@ export class HeadlessChromiumDriver {
captureBeyondViewport: false, // workaround for an internal resize. See: https://github.com/puppeteer/puppeteer/issues/7043
});

if (Buffer.isBuffer(screenshot)) {
return screenshot;
if (screenshot.byteLength) {
return Buffer.from(screenshot);
}

if (typeof screenshot === 'string') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class HeadlessChromiumDriverFactory {
pipe: !this.config.browser.chromium.inspect,
userDataDir: this.userDataDir,
executablePath: this.binaryPath,
ignoreHTTPSErrors: true,
acceptInsecureCerts: true,
handleSIGHUP: false,
args: chromiumArgs,
defaultViewport: viewport,
Expand Down
76 changes: 42 additions & 34 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8365,16 +8365,16 @@
resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570"
integrity sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=

"@puppeteer/browsers@2.2.4":
version "2.2.4"
resolved "https://registry.yarnpkg.com/@puppeteer/browsers/-/browsers-2.2.4.tgz#4307245d881aa5a79743050be66568bad0f6ffbb"
integrity sha512-BdG2qiI1dn89OTUUsx2GZSpUzW+DRffR1wlMJyKxVHYrhnKoELSDxDd+2XImUkuWPEKk76H5FcM/gPFrEK1Tfw==
"@puppeteer/browsers@2.4.0":
version "2.4.0"
resolved "https://registry.yarnpkg.com/@puppeteer/browsers/-/browsers-2.4.0.tgz#a0dd0f4e381e53f509109ae83b891db5972750f5"
integrity sha512-x8J1csfIygOwf6D6qUAZ0ASk3z63zPb7wkNeHRerCMh82qWKUrOgkuP005AJC8lDL6/evtXETGEJVcwykKT4/g==
dependencies:
debug "^4.3.5"
debug "^4.3.6"
extract-zip "^2.0.1"
progress "^2.0.3"
proxy-agent "^6.4.0"
semver "^7.6.2"
semver "^7.6.3"
tar-fs "^3.0.6"
unbzip2-stream "^1.4.3"
yargs "^17.7.2"
Expand Down Expand Up @@ -14254,10 +14254,10 @@ chromedriver@^128.0.1:
proxy-from-env "^1.1.0"
tcp-port-used "^1.0.2"

chromium-bidi@0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/chromium-bidi/-/chromium-bidi-0.6.1.tgz#533612dd166b7b36a8ba8b90685ad2fa0c98d064"
integrity sha512-kSxJRj0VgtUKz6nmzc2JPfyfJGzwzt65u7PqhPHtgGQUZLF5oG+ST6l6e5ONfStUMAlhSutFCjaGKllXZa16jA==
chromium-bidi@0.6.5:
version "0.6.5"
resolved "https://registry.yarnpkg.com/chromium-bidi/-/chromium-bidi-0.6.5.tgz#31be98f9ee5c93fa99d240c680518c9293d8c6bb"
integrity sha512-RuLrmzYrxSb0s9SgpB+QN5jJucPduZQ/9SIe76MDxYJuecPW5mxMdacJ1f4EtgiV+R0p3sCkznTMvH0MPGFqjA==
dependencies:
mitt "3.0.1"
urlpattern-polyfill "10.0.0"
Expand Down Expand Up @@ -15818,12 +15818,12 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.9:
dependencies:
ms "2.0.0"

debug@4, debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4, debug@^4.3.5:
version "4.3.6"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.6.tgz#2ab2c38fbaffebf8aa95fdfe6d88438c7a13c52b"
integrity sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==
debug@4, debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4, debug@^4.3.5, debug@^4.3.6, debug@^4.3.7:
version "4.3.7"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52"
integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==
dependencies:
ms "2.1.2"
ms "^2.1.3"

debug@4.3.1:
version "4.3.1"
Expand Down Expand Up @@ -16284,10 +16284,10 @@ detective@^5.0.2:
defined "^1.0.0"
minimist "^1.1.1"

devtools-protocol@0.0.1299070:
version "0.0.1299070"
resolved "https://registry.yarnpkg.com/devtools-protocol/-/devtools-protocol-0.0.1299070.tgz#b3e4cf0b678a46f0f907ae6e07e03ad3a53c00df"
integrity sha512-+qtL3eX50qsJ7c+qVyagqi7AWMoQCBGNfoyJZMwm/NSXVqLYbuitrWEEIzxfUmTNy7//Xe8yhMmQ+elj3uAqSg==
devtools-protocol@0.0.1330662:
version "0.0.1330662"
resolved "https://registry.yarnpkg.com/devtools-protocol/-/devtools-protocol-0.0.1330662.tgz#400fe703c2820d6b2d9ebdd1785934310152373e"
integrity sha512-pzh6YQ8zZfz3iKlCvgzVCu22NdpZ8hNmwU6WnQjNVquh0A9iVosPtNLWDwaWVGyrntQlltPFztTMK5Cg6lfCuw==

dezalgo@^1.0.0, dezalgo@^1.0.4:
version "1.0.4"
Expand Down Expand Up @@ -26303,26 +26303,29 @@ punycode@^2.1.0, punycode@^2.1.1:
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==

puppeteer-core@22.13.1:
version "22.13.1"
resolved "https://registry.yarnpkg.com/puppeteer-core/-/puppeteer-core-22.13.1.tgz#3ba03e5ebd98bbbd86e465864cf00314e07309de"
integrity sha512-NmhnASYp51QPRCAf9n0OPxuPMmzkKd8+2sB9Q+BjwwCG25gz6iuNc3LQDWa+cH2tyivmJppLhNNFt6Q3HmoOpw==
puppeteer-core@23.3.1:
version "23.3.1"
resolved "https://registry.yarnpkg.com/puppeteer-core/-/puppeteer-core-23.3.1.tgz#b93d825e586f5f7dc268128a31a31c62bbe378ae"
integrity sha512-m5gTpITEqqpSgAvPUI/Ch9igh5sNJV+BVVbqQMzqirRDVHDCkLGHaydEQZx2NZvSXdwCFrIV///cpSlX/uD0Sg==
dependencies:
"@puppeteer/browsers" "2.2.4"
chromium-bidi "0.6.1"
debug "^4.3.5"
devtools-protocol "0.0.1299070"
"@puppeteer/browsers" "2.4.0"
chromium-bidi "0.6.5"
debug "^4.3.7"
devtools-protocol "0.0.1330662"
typed-query-selector "^2.12.0"
ws "^8.18.0"

puppeteer@22.13.1:
version "22.13.1"
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-22.13.1.tgz#f8e4217919b438f18adb754e9d8414fef58fb3de"
integrity sha512-PwXLDQK5u83Fm5A7TGMq+9BR7iHDJ8a3h21PSsh/E6VfhxiKYkU7+tvGZNSCap6k3pCNDd9oNteVBEctcBalmQ==
puppeteer@23.3.1:
version "23.3.1"
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-23.3.1.tgz#830ac4b2c264ae4a610b79be77aff23bb13efa2c"
integrity sha512-BxkuJyCv46ZKW8KEHiVMHgHEC89jKK9FffReWjbw1IfBUmNx+6JIZyqOtaJeSwyolTdVqqb5fiPiXflKeH3dKQ==
dependencies:
"@puppeteer/browsers" "2.2.4"
"@puppeteer/browsers" "2.4.0"
chromium-bidi "0.6.5"
cosmiconfig "^9.0.0"
devtools-protocol "0.0.1299070"
puppeteer-core "22.13.1"
devtools-protocol "0.0.1330662"
puppeteer-core "23.3.1"
typed-query-selector "^2.12.0"

pure-rand@^6.0.0:
version "6.0.2"
Expand Down Expand Up @@ -30908,6 +30911,11 @@ typed-array-length@^1.0.6:
is-typed-array "^1.1.13"
possible-typed-array-names "^1.0.0"

typed-query-selector@^2.12.0:
version "2.12.0"
resolved "https://registry.yarnpkg.com/typed-query-selector/-/typed-query-selector-2.12.0.tgz#92b65dbc0a42655fccf4aeb1a08b1dddce8af5f2"
integrity sha512-SbklCd1F0EiZOyPiW192rrHZzZ5sBijB6xM+cpmrwDqObvdtunOHHIk9fCGsoK5JVIYXoyEp4iEdE3upFH3PAg==

typedarray-to-buffer@^3.1.5:
version "3.1.5"
resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080"
Expand Down

0 comments on commit 91ca8ab

Please sign in to comment.