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

[Bug]: use manifest V3 .When the file(manifest.json) carries ”content_scripts“,puppeteer.launch timeout #12335

Closed
1 of 2 tasks
Disliketalking opened this issue Apr 25, 2024 · 17 comments

Comments

@Disliketalking
Copy link

Disliketalking commented Apr 25, 2024

Minimal, reproducible example

const args = [
      `--whitelisted-extension-id=${extensionId}`,
      `--disable-extensions-except=${pathToExtension}`,
      `--load-extension=${pathToExtension}`,
      '--no-sandbox',
    ];
    this.browser = await puppeteer.launch({
      headless: false,
      defaultViewport: null,
      args: args,
      executablePath: '/opt/google/chrome/chrome',
      // executablePath: '/usr/local/google/chrome/chrome',
    });

// manifest.json
{
    "name": "Record",
    "description": "Record Extension",
    "version": "1.0",
    "icons": {
        "128": "icon.png"
    },
    "manifest_version": 3,
    "content_scripts": [
        {
          "matches": ["https://*/*"],
          "js": "capture.js"
        }
      ],
    "background": {
        "service_worker": "background.js"
    },
    "permissions": [
        "activeTab",
        "tabs",
        "tabCapture",
        "storage",
        "downloads"
    ]
}

Error string

Timed out after 30000 ms while waiting for the WS endpoint URL to appear in stdout!

Bug behavior

  • Flaky
  • PDF

Background

chrome version is
Google Chrome 124.0.6367.78

Expectation

.

Reality

puppeteer.launch timeout

Puppeteer configuration file (if used)

No response

Puppeteer version

22.7.0

Node version

20.12.2

Package manager

npm

Package manager version

10.5.0

Operating system

Linux

Copy link

github-actions bot commented Apr 25, 2024

This issue has an outdated Puppeteer version: 22.7.0. Please verify your issue on the latest 22.7.1 version. Then update the form accordingly.


Analyzer run

@Disliketalking Disliketalking changed the title [Bug]: use manifest V3 。When the file(manifest.json) carries ”content_scripts“,puppeteer.launch timeout [Bug]: use manifest V3 .When the file(manifest.json) carries ”content_scripts“,puppeteer.launch timeout Apr 25, 2024
@github-actions github-actions bot added invalid and removed invalid labels Apr 25, 2024
@OrKoN
Copy link
Collaborator

OrKoN commented Apr 25, 2024

I am not able to reproduce (not enough information), please provide a minimal example that includes all files that are required to run the script (feel free to publish a repository with the reproduction).

@inspectxyz
Copy link

Seeing the same thing

@Disliketalking
Copy link
Author

Collaborator

The directory structure is as follows:

puppeteer.js
extension
     |----- background.js    (just console.log)
                  capture.js      (just console.log)
                  icon.png
                  manifest.json

The specific content is as follows:

// puppeteer.js
const puppeteer = require('puppeteer');
const path = require('path');
const Xvfb = require('xvfb');

const pathToExtension = path.join(__dirname, 'extension');
async function launch() {
    const displayNum = Math.floor(Math.random() * 1000);
    let width = 1280;

    let height = 720;

    const whd = width + 'x' + height + 'x24';
    const xvfb = new Xvfb({
      silent: false,
      displayNum: displayNum,
      reuse: false,
      xvfb_args: ['-screen', '0', whd],
    });
    xvfb.start();
    const browser = await puppeteer.launch({
        headless: false,
        args: [
            `--disable-extensions-except=${pathToExtension}`,
            `--load-extension=${pathToExtension}`,
            '--no-sandbox',
        ],
        executablePath: '/opt/google/chrome/chrome',
    });
    console.log("hello, world");
    await browser.close();
    xvfb.stopSync();
}
launch();
console.log("puppeteer.js");

// manifest.json
{
    "name": "Record",
    "description": "Record Extension",
    "version": "1.0",
    "icons": {
        "128": "icon.png"
    },
    "manifest_version": 3,
    //"content_scripts": [
    //    {
    //      "matches": ["https://*/*"],
    //      "js": "./capture.js"
    //    }
    //  ],
    "background": {
        "service_worker": "background.js"
    },
    "permissions": [
        "activeTab",
        "tabs",
        "tabCapture",
        "storage",
        "downloads"
    ]
}

Uncomment “content_scripts”,will see

TimeoutError: Timed out after 30000 ms while waiting for the WS endpoint URL to appear in stdout!

@OrKoN
Copy link
Collaborator

OrKoN commented Apr 26, 2024

@Lightning00Blade could you please try to repro with the steps above?

@dylanClimaTech
Copy link

+1 seeing this as well

@cmcode003
Copy link

+1 I am seeing this as well brother.

@inspectxyz
Copy link

inspectxyz commented Apr 26, 2024

Greetings,

We at inspect.xyz believe it is caused by chrome as one of our tech leads was able to resolve this issue by switching to a different version.

Thank you kindly,
Inspect.xyz

  • The Layer 2 Built for X

@dylanClimaTech
Copy link

Wow very insightful, will be trying this immediately! appretiate your hard work and dedication

@inspectxyz
Copy link

Thank you.
Inspect.xyz

  • The Layer 2 Built for X

@dylanClimaTech
Copy link

HMMMMMM had some issues using your advice, and was unable to fix this issue. it still evades me how we will get this working.

Dylan

  • ClimaTech Innovations

@inspectxyz
Copy link

inspectxyz commented Apr 26, 2024

Greetings,

Our inspect.xyz tech lead was unable to resolve this issue In Production only locally by pointing to their local version.

const exePath = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe";
const puppeteerOption = {...options, executablePath: process.env.CHROMIUM_PATH}; // TECH LEAD VERSION @ INSPECT.XYZ

Thank you kindly,
Inspect.xyz

  • The Layer 2 Built for X

@dylanClimaTech
Copy link

you have lead me astray - but will use this to help guide me to a resolution, thank you

Dylan (they/them)

  • Climatech innovations

@hydah
Copy link

hydah commented Apr 28, 2024

+1 seeing this as well

@dylanClimaTech
Copy link

Willing to paypal $40 for anyone that can fix this or help us fix this

@inspectxyz
Copy link

@Lightning00Blade or @OrKoN I am also willing to send $100 usd to have this issue fixed

@OrKoN
Copy link
Collaborator

OrKoN commented May 2, 2024

Not able to reproduce:

  1. content scripts has to be an array

The following works:

{
  "name": "Record",
  "description": "Record Extension",
  "version": "1.0",
  "manifest_version": 3,
  "icons": {
      "128": "icon.png"
  },
  "content_scripts": [
    {
      "matches": ["https://*/*"],
      "js": ["capture.js"]
    }
  ],
  "background": {
      "service_worker": "background.js"
  },
  "permissions": [
      "tabs",
      "tabCapture",
      "storage",
      "downloads"
  ]
}
import puppeteer from "puppeteer";

const args = [
  `--disable-extensions-except=/Users/alexrudenko/src/pptr-test/extensions-repro`,
  `--load-extension=/Users/alexrudenko/src/pptr-test/extensions-repro`,
];

const browser = await puppeteer.launch({
  headless: false,
  defaultViewport: null,
  args: args,
});

P.S. background permission is not required

@OrKoN OrKoN closed this as not planned Won't fix, can't repro, duplicate, stale May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants