-
Notifications
You must be signed in to change notification settings - Fork 42
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
Screenshotter fails after a JavaScript exception #1502
Comments
This could be linked to #1056. |
The first argument in the stack trace ( |
I'm experiencing the same exact issue. Had to revert to 0.53.0 for screenshots to work on error. |
Hi @yevk !
Do you mean that you see no such issues in k6 v0.53? 🤔 UPD: also, do you maybe have a minimal script to reproduce the issue? |
That's right, 0.54 produced the same error but 0.53 did not. I'm taking screenshots only when an error occurs. I don't have a minimal script at the moment, I only have a full script which I can't share. |
That's interesting! 🤔 Would be feasible for you to validate if the fix that we're trying to bring work locally? |
Sure. Just let me know how to install it. |
Thanks, that will be helpful! 🙇 Okay, for that, you have to have on your machine the xk6, the custom k6 builder And build the custom version of the k6 (including the update from #1559) which should workaround the issue (at least not produce panic, but warning)
That should produce a custom k6 (with the name
If that's not feasible, that's okay, I'll still think of the way how I can reproduce it locally Note: I've updated xk6 build command to reflect the current latest commit |
For the record. We merged #1559 which should prevent panic and hopefully, in the worst-case produce a warning log, asking to provide reproducible details to this issue (that's why I haven't closed it yet). My concern is that since it works in k6 v0.53, and it does not in k6 v0.53, that sounds like a big red flag that it's not related to Chrome (I'm assuming that that installation didn't change between versions). Also, I don't see any update of the between the versions browser versions pinned in that releases, which could signals that issue was introduced somewhere other place. diff --git a/go.mod b/go.mod
index 80c89c14..63c336f5 100644
--- a/go.mod
+++ b/go.mod
@@ -1,44 +1,45 @@
module github.com/grafana/xk6-browser
-go 1.20
+go 1.21
require (
github.com/chromedp/cdproto v0.0.0-20221023212508-67ada9507fb2
github.com/gorilla/websocket v1.5.1
- github.com/grafana/sobek v0.0.0-20240613124309-cb36746e8fee
+ github.com/grafana/sobek v0.0.0-20240829081756-447e8c611945
github.com/mailru/easyjson v0.7.7
github.com/mccutchen/go-httpbin v1.1.2-0.20190116014521-c5cb2f4802fa
github.com/mstoykov/k6-taskqueue-lib v0.1.0
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.9.0
- go.k6.io/k6 v0.52.0
- go.opentelemetry.io/otel v1.24.0
- go.opentelemetry.io/otel/trace v1.24.0
- golang.org/x/net v0.26.0
- golang.org/x/sync v0.7.0
+ go.k6.io/k6 v0.53.1-0.20240925100229-86ab6e3ceee8
+ go.opentelemetry.io/otel v1.29.0
+ go.opentelemetry.io/otel/trace v1.29.0
+ golang.org/x/net v0.28.0
+ golang.org/x/sync v0.8.0
gopkg.in/guregu/null.v3 v3.3.0
) Still, good to have #1559 since we stopped panic and migrate from deprecated field, but looking for a reproducible example |
Hi @yevk ! Since we merged the changes, and also updated the version of the browser in k6, we could try if the fix helps without using xk6. For that, you could install the version of the k6 (golang is still required) from master:
If you still have capacity, could you please validate if the fix works or if it at least doesn't cause panic. Thanks! |
Hey @olegbespalov, sorry for the delay and thanks for the update! I'll try it this weekend and get back to you. |
I was able to reproduce the panic with 0.54 and 0.55 (unpatched) a few times. I'll keep using the patched version and update you if it panics again. Thanks! |
What?
The screenshotter fails when called in a
catch
block (after an exception).Exception:
Test Run ID: 3439289
Why?
Users should take screenshots even after an exception to see the issues in their web pages or scripts.
How?
Looking at the code:
screenshotPage
callsscreenshotter.screenshot
with a non-nil viewport*Rect
.Width: viewport.Width / visualViewport.Scale
.Since
viewport
should not be nil,visualViewport
might be.However, the signature in the panic log says that
viewport
isnil
:According to the code, the
screenshotter.go:398
seems not to pass anil
Rect
, and always passes a non-nil one (here and here) unless there's an error.Tasks
Tasks
Related PR(s)/Issue(s)
No response
The text was updated successfully, but these errors were encountered: