Skip to content
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

Unable to use proxy with /function api in v2 #4003

Open
Umzario opened this issue Apr 15, 2024 · 0 comments
Open

Unable to use proxy with /function api in v2 #4003

Umzario opened this issue Apr 15, 2024 · 0 comments

Comments

@Umzario
Copy link

Umzario commented Apr 15, 2024

Describe the bug
Hello, this issue is similar to the one described here. I can access a site without using proxy, however, when i set the proxy server and also add authentication to the code, it fails. Below is the logs. I see the logs say proxy authentication failed, but the auth is correct

browserless.io:limiter (Running: 0, Pending: 0) Adding to queue, max time allowed is 30,000ms +2m
browserless.io:limiter (Running: 1, Pending: 0) Starting new job +1ms
browserless.io:browser-manager Generating user-data-dir at /tmp/browserless-data-dirs/browserless-data-dir-ddc5fef9-417b-4da0-986e-1be92d8708bb +2m
browserless.io:browsers:cdp:chromium Starting new browser instance +0ms
browserless.io:browsers:cdp:chromium Got open port 38065 +2ms
browserless.io:browsers:cdp:chromium {
browserless.io:browsers:cdp:chromium headless: true,
browserless.io:browsers:cdp:chromium stealth: true,
browserless.io:browsers:cdp:chromium defaultViewport: { height: 1080, width: 1920 },
browserless.io:browsers:cdp:chromium args: [
browserless.io:browsers:cdp:chromium '--remote-debugging-port=38065',
browserless.io:browsers:cdp:chromium '--no-sandbox',
browserless.io:browsers:cdp:chromium '--proxy-server=...',
browserless.io:browsers:cdp:chromium '--user-data-dir=/tmp/browserless-data-dirs/browserless-data-dir-ddc5fef9-417b-4da0-986e-1be92d8708bb'
browserless.io:browsers:cdp:chromium ],
browserless.io:browsers:cdp:chromium executablePath: '/usr/local/bin/playwright-browsers/chromium-1097/chrome-linux/chrome'
browserless.io:browsers:cdp:chromium } Launching CDP Chrome Handler +0ms
browserless.io:browsers:cdp:chromium Browser is running on ws://127.0.0.1:38065/devtools/browser/58694880-462c-46d2-acaa-b01ebeeb9633 +113ms
browserless.io:browsers:cdp:chromium Setting up file:// protocol request rejection +26ms
browserless.io:browsers:cdp:chromium Error setting up embedded API: Execution context was destroyed, most likely because of a navigation. +14ms
browserless.io:http:function-post /function.js: Page Request: "http://0.0.0.0:3000/function/index.html" +2m
browserless.io:http:function-post /function.js: Page Response: "http://0.0.0.0:3000/function/index.html" +1ms
browserless.io:http:function-post /function.js: Page Request: "http://0.0.0.0:3000/function/client.js" +11ms
browserless.io:http:function-post /function.js: Page Response: "http://0.0.0.0:3000/function/client.js" +47ms
browserless.io:http:function-post /function.js: Page Request: "http://0.0.0.0:3000/function/browserless-function-57a92042-049a-4f41-b42f-8c7bc656238e.js" +17ms
browserless.io:http:function-post /function.js: Page Response: "http://0.0.0.0:3000/function/browserless-function-57a92042-049a-4f41-b42f-8c7bc656238e.js" +1ms
browserless.io:http:function-post log: /function.js: imported successfully. +0ms
browserless.io:http:function-post log: /function.js: executing puppeteer code. +1ms
browserless.io:http:function-post log: /function.js: Got endpoint: "ws://0.0.0.0:3000/devtools/browser/58694880-462c-46d2-acaa-b01ebeeb9633" +1ms
browserless.io:http:function-post error: WebSocket connection to 'ws://0.0.0.0:3000/devtools/browser/58694880-462c-46d2-acaa-b01ebeeb9633' failed: Proxy authentication failed +555ms
browserless.io:http:function-post Error running code: Event: Event +1ms
browserless.io:error Event +3m
browserless.io:browser-manager 0 Client(s) are currently connected +798ms
browserless.io:browser-manager Closing browser session +0ms
browserless.io:browser-manager Deleting "/tmp/browserless-data-dirs/browserless-data-dir-ddc5fef9-417b-4da0-986e-1be92d8708bb" user-data-dir and session from memory +0ms
browserless.io:browsers:cdp:chromium Closing browser process and all listeners +642ms
browserless.io:limiter (Running: 0, Pending: 0) All jobs complete. +805ms
browserless.io:limiter Recording failed stat, cleaning up: "BadRequest: Event" +0ms
Issue calling error hook: "TypeError [ERR_INVALID_URL]: Invalid URL". Did you set a working ERROR_ALERT_URL env variable?
browserless.io:browser-manager Deleting data directory "/tmp/browserless-data-dirs/browserless-data-dir-ddc5fef9-417b-4da0-986e-1be92d8708bb" +7ms

In terms of authenticating proxy, I followed the guide here(I followed method 1). Maybe there's something i'm missing?

Here's a sample of the function code used:

export default async function ({ page }) {await page.authenticate({username: "...", password: "..."});await page.goto("https://www.example.com");const content = await page.content();let data = {};data["content"] = content;return data;}

To Reproduce
Steps to reproduce the behavior:
Try to access a website using a proxy on the /function api (v2)

Expected behavior
A clear and concise description of what you expected to happen.

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant