-
Notifications
You must be signed in to change notification settings - Fork 155
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
Puppeteer: Upgrade to v22 #556
Conversation
@@ -23,7 +23,7 @@ export class ReusableBrowser extends Browser { | |||
try { | |||
page = await this.withTimingMetrics<puppeteer.Page>(async () => { | |||
this.validateImageOptions(options); | |||
context = await this.browser.createIncognitoBrowserContext(); | |||
context = await this.browser.createBrowserContext(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function was renamed on version 22
This new Puppeteer version also enables the new-headless mode by default that doesn't work for Kubernetes users. If we want to merge this quickly, we should use Also, I noticed an issue with the stat panel in the test screenshots, I'm looking into this. |
@@ -16,9 +16,6 @@ async function main() { | |||
const env = Object.assign({}, process.env); | |||
const command = argv._[0]; | |||
|
|||
// See https://github.com/grafana/grafana-image-renderer/issues/460 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer needed. We are using the shell
value instead of the new headless mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! This is also set in the tests: https://github.com/grafana/grafana-image-renderer/blob/master/src/service/http-server.integration.test.ts#L101
src/browser/browser.ts
Outdated
@@ -137,7 +137,7 @@ export class Browser { | |||
launcherOptions.executablePath = this.config.chromeBin; | |||
} | |||
|
|||
launcherOptions.headless = !this.config.headed; | |||
launcherOptions.headless = !this.config.headed ? "shell" : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shell is for the old headed mode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! This looks good and works fine 👍
There is a bug in the tests, it's why the screenshot with the error wasn't caught. I'll work on a separate PR to fix this.
Note: There is also this change which updates a setting in PDF. We may want to make this configurable as this can increase the file size but this would also be in another PR.
@@ -16,9 +16,6 @@ async function main() { | |||
const env = Object.assign({}, process.env); | |||
const command = argv._[0]; | |||
|
|||
// See https://github.com/grafana/grafana-image-renderer/issues/460 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! This is also set in the tests: https://github.com/grafana/grafana-image-renderer/blob/master/src/service/http-server.integration.test.ts#L101
We are doing this to keep using a maintained version and remove some old, unmaintained dependencies.
Fix #460