-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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]: Websocket's don't work with subPath #2051
Comments
@Doofus100500, thank you for creating this issue. We will troubleshoot it as soon as we can. Info for maintainersTriage this issue by using labels.
If information is missing, add a helpful comment and then
If the issue is a question, add the
If the issue is valid but there is no time to troubleshoot it, consider adding the
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable
After troubleshooting the issue, please add the Thank you! |
You need to upgrade to use the latest. |
Update all components and connection string changed, but i'm getting new errors:
Selenium node:
|
Is there a way to reproduce that using Selenium code? |
|
Hi @Doofus100500, as the comment I put here SeleniumHQ/selenium#12791 (comment). Extra config needed, and in the chart, I handled via PR #2053 It means in ENV variable, --grid-url use |
Hi @VietND96, With CDP, the situation is as follows: the node provides this address (wss://grid.test.com/staging/session/295ceecc4f985e5293fb43e0ccbb48ad/se/cdp) to the Playwright client, so the client attempts to connect to this address from my machine, but it fails to establish a connection. |
Does it fail when you use Selenium? |
Not sure how to reproduce it using Selenium, but I think the outcome will be the same because the address provided in the end is not accessible. |
Let me try a reproduce this CDP connection. But it doesn't work with |
Yes, it doesn't work with SE_NODE_GRID_URL=http://grid.test.com/staging because my nginx drop http connections(because HTTP connections are insecure):
|
But that's an issue with that nginx config. Regarding reproducing with Selenium, you can use any of the examples shown in the docs. I am asking for a way to reproduce with Selenium because this |
I changed the settings in nginx, now when SE_NODE_GRID_URL=http://grid.test.com/staging, the behavior is the same as in this comment: #2051 (comment) |
Just in case, I'll write down how to reproduce my issue with Playwright: npm init playwright@latest By the way, WebSocket connections still don't work for me with VNC
|
@Doofus100500, I have set up a Selenium Grid (4.16.1) and a Playwright (1.40.1) test to reproduce your case. SELENIUM_REMOTE_URL=http://aws.ndviet.org/selenium SELENIUM_REMOTE_CAPABILITIES='{"browserName": "chrome"}' DEBUG=pw:api,pw:protocol,pw:browser* npx playwright test
Running 1 test using 1 worker
pw:api => selectors.setTestIdAttribute started +0ms
pw:api => browserType.launch started +7ms
pw:browser <selenium> using additional capabilities "{"browserName": "chrome"}" +0ms
pw:browser <selenium> connecting to http://aws.ndviet.org/selenium/ +0ms
pw:api <= selectors.setTestIdAttribute succeeded +13ms
pw:browser <selenium> connected to sessionId=7d86b5d1fb9cb5ccf2c54ef8404190bd +10s
pw:browser <selenium> using selenium v4 +1ms
pw:browser <selenium> retrieved endpoint ws://selenium-router.default:4444/selenium/session/7d86b5d1fb9cb5ccf2c54ef8404190bd/se/cdp for sessionId=7d86b5d1fb9cb5ccf2c54ef8404190bd +0ms
pw:browser <ws connecting> ws://selenium-router.default:4444/selenium/session/7d86b5d1fb9cb5ccf2c54ef8404190bd/se/cdp +2ms
pw:browser <ws error> ws://selenium-router.default:4444/selenium/session/7d86b5d1fb9cb5ccf2c54ef8404190bd/se/cdp error getaddrinfo ENOTFOUND selenium-router.default +6ms
pw:browser <ws connect error> ws://selenium-router.default:4444/selenium/session/7d86b5d1fb9cb5ccf2c54ef8404190bd/se/cdp getaddrinfo ENOTFOUND selenium-router.default +0ms
pw:browser <ws disconnected> ws://selenium-router.default:4444/selenium/session/7d86b5d1fb9cb5ccf2c54ef8404190bd/se/cdp code=1006 reason= +0ms
pw:browser <selenium> disconnecting from sessionId=7d86b5d1fb9cb5ccf2c54ef8404190bd +0ms
pw:browser <selenium> disconnected from sessionId=7d86b5d1fb9cb5ccf2c54ef8404190bd +678ms
pw:api <= browserType.launch failed +11s
F
1) tests/recorder.login.test.ts:2:5 ?? test ??????????????????????????????????????????????????????????????????????????????????????????????????????????????
Error: browserType.launch: WebSocket error: getaddrinfo ENOTFOUND selenium-router.default
Call log:
- <selenium> using additional capabilities "{"browserName": "chrome"}"
- <selenium> connecting to http://aws.ndviet.org/selenium/
- <selenium> connected to sessionId=7d86b5d1fb9cb5ccf2c54ef8404190bd
- <selenium> using selenium v4
- <selenium> retrieved endpoint ws://selenium-router.default:4444/selenium/session/7d86b5d1fb9cb5ccf2c54ef8404190bd/se/cdp for sessionId=7d86b5d1fb9cb5ccf2c54ef8404190bd
- <ws connecting> ws://selenium-router.default:4444/selenium/session/7d86b5d1fb9cb5ccf2c54ef8404190bd/se/cdp
- <ws error> ws://selenium-router.default:4444/selenium/session/7d86b5d1fb9cb5ccf2c54ef8404190bd/se/cdp error getaddrinfo ENOTFOUND selenium-router.default
- <ws connect error> ws://selenium-router.default:4444/selenium/session/7d86b5d1fb9cb5ccf2c54ef8404190bd/se/cdp getaddrinfo ENOTFOUND selenium-router.default
- <ws disconnected> ws://selenium-router.default:4444/selenium/session/7d86b5d1fb9cb5ccf2c54ef8404190bd/se/cdp code=1006 reason=
- <selenium> disconnecting from sessionId=7d86b5d1fb9cb5ccf2c54ef8404190bd
- <selenium> disconnected from sessionId=7d86b5d1fb9cb5ccf2c54ef8404190bd This is one issue with Chart value. By default, the value is rendered for Updated: By default ingress:
hostname: aws.ndviet.org
SELENIUM_REMOTE_URL=http://aws.ndviet.org/selenium SELENIUM_REMOTE_CAPABILITIES='{"browserName": "chrome"}' DEBUG=pw:api,pw:protocol,pw:browser* npx playwright test
pw:api => selectors.setTestIdAttribute started +0ms
pw:api => browserType.launch started +7ms
pw:browser <selenium> using additional capabilities "{"browserName": "chrome"}" +0ms
pw:browser <selenium> connecting to http://aws.ndviet.org/selenium/ +0ms
pw:api <= selectors.setTestIdAttribute succeeded +13ms
pw:browser <selenium> connected to sessionId=b4f39647a36388c94530937cca67aa93 +11s
pw:browser <selenium> using selenium v4 +0ms
pw:browser <selenium> retrieved endpoint ws://aws.ndviet.org/selenium/session/b4f39647a36388c94530937cca67aa93/se/cdp for sessionId=b4f39647a36388c94530937cca67aa93 +0ms
pw:browser <ws connecting> ws://aws.ndviet.org/selenium/session/b4f39647a36388c94530937cca67aa93/se/cdp +2ms
pw:browser <ws connected> ws://aws.ndviet.org/selenium/session/b4f39647a36388c94530937cca67aa93/se/cdp +730ms
pw:protocol SEND ?? {"id":1,"method":"Browser.getVersion"} +0ms
pw:protocol ?? RECV {"id":1,"result":{"protocolVersion":"1.3","product":"Chrome/120.0.6099.71","revision":"@9729082fe6174c0a371fc66501f5efc5d69d3d2b","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","jsVersion":"12.0.267.8"}} +285ms
pw:protocol SEND ?? {"id":2,"method":"Target.setAutoAttach","params":{"autoAttach":true,"waitForDebuggerOnStart":true,"flatten":true}} +2ms
So, I belive that something in the ingress config leads to the error. I don't have much experience in ingress, I just have simple configs as below annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/app-root: /selenium
nginx.ingress.kubernetes.io/auth-keepalive-timeout: "3600"
nginx.ingress.kubernetes.io/client-body-buffer-size: 512M
nginx.ingress.kubernetes.io/proxy-buffer-size: 512M
nginx.ingress.kubernetes.io/proxy-buffering: "on"
nginx.ingress.kubernetes.io/proxy-buffers-number: "4"
nginx.ingress.kubernetes.io/proxy-connect-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-next-upstream-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-request-buffering: "on"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
nginx.ingress.kubernetes.io/rewrite-target: /$2
nginx.ingress.kubernetes.io/use-regex: "true"
spec:
rules:
- host: aws.ndviet.org
http:
paths:
- backend:
service:
name: 'selenium-router'
port:
number: 4444
path: /selenium(/|$)(.*)
pathType: ImplementationSpecific Regarding NoVNC, it could be a delay that troubleshoot via #2045 that had a workaround in #2058 will be released new image tag soon |
@Doofus100500, are you able to proceed with your test on top of latest chart version |
@VietND96, Hi, I've updated the chart version, also disconnected from nginx and now only use Ingress (https://github.com/kubernetes/ingress-nginx/tree/main). As a result, the error looks like this:
more likely because of cycle redirect: http->https->http And when I'm changing SE_NODE_GRID_URL to https in configmap for node:
|
@Doofus100500, not sure any missing from my end but I could not reproduce the issue. |
@VietND96 From what I've managed to understand, it turns out that there is a redirect to HTTPS in my Ingress, and I cannot remove it. That's why I am encountering "308 Permanent Redirect" errors. But the most interesting part is that as soon as I deploy Selenium without a subPath, everything works over HTTPS:
Have you tried using HTTPS? |
@Doofus100500, if have time, can you please use |
This is awesome! After I changed http to https in SE_NODE_GRID_URL in the ConfigMap, everything started working: both noVNC and the Playwright test through wss. I'm looking forward to these changes in the main release. Huge thanks to you, @VietND96!!!! |
@Doofus100500, thank you for your feedback! I will mark this ticket as completed. The main release |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What happened?
I'm running tests through Playwright, and everything works until I specify a subPath and ingress.path different from "/". In my case, it's /staging. The node returns an incorrect path:
This is the same as without subPath. I even tried passing SE_NODE_GRID_URL in the environment:
But the result doesn't change; it feels like the path is being truncated somewhere.
Command used to start Selenium Grid with Docker (or Kubernetes)
Relevant log output
Operating System
k8s
Docker Selenium version (tag or chart version)
0.26.0
The text was updated successfully, but these errors were encountered: