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

ObjectID generation failed #302

Closed
agranados0121 opened this issue Jul 6, 2022 · 4 comments
Closed

ObjectID generation failed #302

agranados0121 opened this issue Jul 6, 2022 · 4 comments

Comments

@agranados0121
Copy link

Based on previously resolved issues this has been already addressed but I keep running into the same errors. When running the actual task on a URL, the service generates the same error of ObjectID generation failed. One thing to note is that nothing was installed with homebrew

Actual behaviour

Starting NEW to run one-off task @ 2022-07-06T19:08:23.901Z
[62c5bed69206931dbe508377] > Running Pa11y on URL https://youtube.com
[62c5bed69206931dbe508377] > Launching Headless Chrome
model:task:runById failed, with id: 62c5bed69206931dbe508377
Pa11y timed out (30000ms)
Failed to finish task 62c5bed69206931dbe508377
ObjectID generation failed. Argument passed in must be a single String of 12 bytes or a string of 24 hex characters

Steps to reproduce

NODE_ENV=development node index.js

Environment

Running in a Ubuntu VM:

node -v
v14.19.3

mongod -version
db version v4.4.15
Build Info: {
"version": "4.4.15",
"gitVersion": "bc17cf2c788c5dda2801a090ea79da5ff7d5fac9",
"openSSLVersion": "OpenSSL 1.1.0g 2 Nov 2017",
"modules": [],
"allocator": "tcmalloc",
"environment": {
"distmod": "ubuntu2004",
"distarch": "x86_64",
"target_arch": "x86_64"
}
}

@josebolos
Copy link
Member

Hi @agranados0121,

The ObjectID generation message here is probably just a symptom of puppeteer failing to run Chrome successfully, as shown by the following lines in your output:

model:task:runById failed, with id: 62c5bed69206931dbe508377
Pa11y timed out (30000ms)
Failed to finish task 62c5bed69206931dbe508377

I would try to verify first that Chrome can run inside your VM. Seeing as you're running Linux you probably may want to ensure that the right dependencies are installed. If using a recent version of ubuntu you'll probably need to install libgtk-3-0, libgconf-2-4, and potentially libxss1. This is mention in the requirements section of the README, but the version of the libraries required may be different to the ones mentioned there: https://github.com/pa11y/pa11y-dashboard#requirements

If you're trying to run pa11y in a virtualised environment you may also need to pass certain flags to Chrome so it runs successfully inside the container, namely the --no-sandbox and/or --disable-setuid-sandbox. An example config with those flags could look something like:

{
	"port": 8080,
	"noindex": true,
	"readonly": false,

	"webservice": {
		"database": "mongodb://localhost",
		"host": "0.0.0.0",
		"port": 3000,
		"chromeLaunchConfig": {
			"args": [
				"--no-sandbox",
				"--disable-setuid-sandbox"
			]
		}
	}
}

Addressing these two things should be enough to get Chrome running.

@agranados0121
Copy link
Author

Hey @josebolos,

The flags were what I was missing to get everything working. So I really appreciate the help :)

@jerrac
Copy link

jerrac commented Feb 12, 2025

@josebolos Any chance you could add this to the Troubleshooting section of the readme? I just spend a while trying to find my way around the issue because I ran across pa11y/pa11y-webservice#164 before I found this issue. The flags were the correct fix.

@Hahlh
Copy link

Hahlh commented Feb 27, 2025

@josebolos Thank you, that also worked for me trying to use the sample development config on Arch Linux.

Might it be a good idea to include these flags in this one already?

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

4 participants