Skip to content

require is not defined - then JS error - on linkedin.com #457

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

Open
gianpaj opened this issue Mar 7, 2025 · 1 comment
Open

require is not defined - then JS error - on linkedin.com #457

gianpaj opened this issue Mar 7, 2025 · 1 comment
Assignees
Labels
bug Something isn't working CDP Chrome Debug Protocol puppeteer

Comments

@gianpaj
Copy link

gianpaj commented Mar 7, 2025

Awesome project!

❯ ./lightpanda serve --host 127.0.0.1 --port 9222
info(server): accepting new conn...
info(server): client connected
info(browser): GET https://linkedin.com/ 200
info(browser): fetch https://static.licdn.com/aero-v1/sc/h/9gvyiifl4yl9bn197d0b77u8e: http.Status.ok
info(browser): eval script https://static.licdn.com/aero-v1/sc/h/9gvyiifl4yl9bn197d0b77u8e: ReferenceError: require is not defined
info(browser): fetch https://static.licdn.com/aero-v1/sc/h/5c81icanok4a9if4xo1qkuq7c: http.Status.ok
https://static.licdn.com/aero-v1/sc/h/5c81icanok4a9if4xo1qkuq7c:25493: Uncaught TypeError: e.getBoundingClientRect is not a function
https://static.licdn.com/aero-v1/sc/h/5c81icanok4a9if4xo1qkuq7c:330108: Uncaught TypeError: Cannot read properties of undefined (reading 'disableJsbeaconPagekeySuffix')
error(server): JS error
error(server): JS error
info(server): accepting new conn...
error(server): JS error
...

Then error(server): JS error keeps printing forever

I got this with this version on macOS

./lightpanda version
7b775d2

index.js

'use strict'

import puppeteer from 'puppeteer-core';

// use browserWSEndpoint to pass the Lightpanda's CDP server address.
const browser = await puppeteer.connect({
  browserWSEndpoint: "ws://127.0.0.1:9222",
});

// The rest of your script remains the same.
const context = await browser.createBrowserContext();
const page = await context.newPage();

// Dump all the links from the page.
await page.goto('https://linkedin.com/');

await page.close();
await context.close();
await browser.disconnect();
@krichprollsch
Copy link
Member

krichprollsch commented Mar 7, 2025

Hello @gianpaj,
Thanks for your message.
The problem of forever loop comes from cancel implementation missing in the kqueue loop event (lightpanda-io/tigerbeetle-io#10). It happens only w/ macosx, It should work on linux w/ io_uring.

@krichprollsch krichprollsch self-assigned this Mar 7, 2025
@krichprollsch krichprollsch added bug Something isn't working CDP Chrome Debug Protocol puppeteer labels Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CDP Chrome Debug Protocol puppeteer
Projects
None yet
Development

No branches or pull requests

2 participants