Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

If Puppeteer fails with /tmp/chromium: cannot execute binary file in AWS Lambda, first compare the function’s configured architecture with the architecture of the Chromium executable you deployed. A 2022 Sparticuz Chromium report describes this exact failure on an arm64 function; changing that function to x86_64 resolved the reported setup. That is a package-specific historical result, not proof that every current Chromium build requires x86_64.

What the error means

Linux emits “cannot execute binary file” when it cannot start a file as a program in the current environment. For Chromium in Lambda, the most important question is whether the native executable was built for the same instruction-set architecture as the function. AWS re:Post describes a wrong-architecture executable as a common cause of this class of error.

The path /tmp/chromium only tells you where the file was placed. It does not tell you whether the file is runnable on that Lambda environment. The executable, its native libraries, the package or layer that supplied them, and the function architecture must be considered together.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Diagnose the function before changing code

1. Read the Lambda architecture

In the AWS Lambda console, open the function, choose Configuration, open General configuration, select Edit, and read Architecture. The value is normally x86_64 or arm64. Save the value before changing anything.

You can also inspect it with the AWS CLI:

aws lambda get-function-configuration 
  --function-name YOUR_FUNCTION_NAME 
  --query 'Architectures' 
  --output text

Run the command against the same AWS account, Region, and function version that receives the failing invocation. Looking at a different alias or a locally defined function can send you toward the wrong fix.

2. Record the exact Chromium artifact

Find out how /tmp/chromium arrived in the deployment:

  • A package such as a Sparticuz Chromium release bundled with your application.
  • A Lambda layer containing Chromium and its libraries.
  • A downloaded archive extracted into /tmp during startup.
  • A file copied from another build, container image, or local development directory.

Record the package name, exact version, layer version, and the artifact’s intended target architecture. Do not infer this from the filename. Two archives can use the same filename while targeting different platforms.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Inspect the file inside Lambda

Temporarily log the following values from the function, then invoke it once:

const fs = require('node:fs');
const { execFileSync } = require('node:child_process');

function inspectChromium(path) {
  console.log('Lambda machine:', execFileSync('uname', ['-m'], { encoding: 'utf8' }).trim());
  console.log('Chromium path:', path);
  console.log('Exists:', fs.existsSync(path));
  if (fs.existsSync(path)) {
    console.log('Mode:', fs.statSync(path).mode.toString(8));
    try {
      console.log('file:', execFileSync('file', [path], { encoding: 'utf8' }).trim());
    } catch (error) {
      console.log('file command failed:', error.message);
    }
  }
}

exports.handler = async () => {
  inspectChromium('/tmp/chromium');
  return { statusCode: 200, body: 'inspection complete' };
};

uname -m reports the machine architecture visible to the runtime. The file command identifies the executable format when it is available. Together, these checks are more useful than the path alone. If the binary is in a layer, inspect the layer’s copy (often under /opt) before it is copied to /tmp.

Match the binary and function architectures

Lambda setting Binary you need Interpretation
x86_64 An x86-64-compatible Chromium build and native libraries An arm64-only executable will not run.
arm64 An arm64-compatible Chromium build and native libraries An x86-64-only executable will not run.

A Sparticuz Chromium GitHub issue from 2022 records the literal failure /tmp/chromium: /tmp/chromium: cannot execute binary file. A comment attributes that particular case to selecting Lambda arm64; the reporter says switching to x86_64 worked. A separate Sparticuz issue discusses an execution-format failure in local development. These reports establish why you should verify both sides of the pairing, but they are not a current compatibility matrix for every Sparticuz or Chromium release.

If the architectures do not match

  1. Choose a Chromium package or layer explicitly built for the function’s architecture.
  2. Alternatively, change the Lambda function architecture to one supported by the exact package version you intend to deploy.
  3. Redeploy the application and every related layer together. An updated function with an old layer can still execute the old, incompatible file.
  4. Publish or select the correct function version and alias, then invoke that version. Confirm the new artifact is the one being extracted to /tmp.

Do not treat the historical x86_64 workaround as a universal rule. Current arm64 support depends on the exact Chromium package and release; verify that release’s documentation before selecting an architecture.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When the architecture already matches

A matching architecture removes the leading explanation, but it does not prove that the deployed artifact is valid. Continue in this order.

Verify the artifact was not replaced or mixed

  • Print the package or layer version at startup and compare it with the version you built.
  • Check that the extraction step did not leave an older /tmp/chromium file from a previous warm invocation.
  • Use a unique temporary directory or remove the old file before extracting a new archive.
  • Check that the Chromium executable and its native libraries came from the same package release.

Lambda can reuse a warm execution environment. A deployment that changes the source archive but does not change the extraction logic can make it appear that the new binary is being tested when the old temporary file is still present.

Check local-versus-Lambda packaging

Do not assume that a binary tested on a developer workstation is suitable for Lambda. The separate local Sparticuz report demonstrates that execution-format failures can arise in a local context as well. Build, download, and extract Chromium for the environment in which it will execute. A file copied from a different operating system or CPU target may look correct in a directory listing while remaining unusable to Lambda.

Check permissions only after format

An executable bit problem generally produces a permission-related error rather than “cannot execute binary file,” but inspect the mode while diagnosing:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ls -l /tmp/chromium
chmod 755 /tmp/chromium

Preserve executable permissions when creating a ZIP or layer. Changing permissions cannot convert an x86-64 binary into an arm64 binary, so it is not a substitute for architecture alignment.

Check native dependencies

If the architecture and executable format match, inspect the binary’s shared-library requirements in a compatible build environment. A missing library normally produces a loader or shared-object error, not the exact format error, but a package can have more than one defect. Ensure the libraries shipped with the Chromium artifact are present at the paths expected by that build.

Use a minimal Puppeteer launch while testing

Keep the first test small: resolve the intended executable path, log it, launch one browser, and close it. Do not add application navigation, authentication, or parallel pages until the process starts reliably.

const puppeteer = require('puppeteer-core');

exports.handler = async () => {
  const executablePath = '/tmp/chromium';
  console.log({ executablePath });

  const browser = await puppeteer.launch({
    executablePath,
    headless: true,
    args: ['--no-sandbox', '--disable-setuid-sandbox']
  });

  const page = await browser.newPage();
  await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
  const title = await page.title();
  await browser.close();
  return { statusCode: 200, body: JSON.stringify({ title }) };
};

The launch options above do not repair an incompatible binary. They simply make it easier to distinguish a process-start failure from a later navigation or page-load failure. Use the executable path supplied by your package when it is not /tmp/chromium.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common symptoms and targeted fixes

Symptom Likely cause Next action
cannot execute binary file or Exec format error Architecture or executable format mismatch Compare Lambda’s architecture with file output and the package’s target; replace the artifact or select a supported function architecture.
No such file or directory for /tmp/chromium Wrong path, failed extraction, or missing layer Log directory contents, extraction errors, and the configured layer; confirm the file exists before launch.
Permission denied Executable mode was lost during packaging Restore executable permissions and rebuild the ZIP or layer while preserving modes.
Shared-library or loader error Incomplete package or incompatible native dependency Deploy the complete package for the same target environment and inspect its dependency set.
Works locally but fails in Lambda Different CPU architecture, operating system, packaging path, or artifact Inspect the file from inside Lambda rather than relying on local tests.
Still fails after a redeploy Old layer, alias, version, or warm /tmp file is being used Print the artifact version and path, update all layers, publish the intended version, and invoke that version directly.

Do not infer a network, IAM, or timeout problem solely from this message. Those can affect a browser after it starts, but the cited reports establish neither as the cause of this execution-format failure.

Deployment practices that prevent repeat failures

  • Document the Lambda architecture beside the Chromium package version in infrastructure configuration.
  • Keep application code, layers, and downloaded archives pinned to known versions rather than silently replacing one component.
  • Make the startup path fail loudly if extraction, file existence, or architecture checks fail.
  • Log the resolved executable path and package version for each new deployment.
  • Test the published Lambda version or alias that production invokes, not only an unpublished draft.
  • When switching between arm64 and x86_64, rebuild or replace every native dependency, not just the Chromium filename.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is simply to obtain a reliable website screenshot rather than maintain Chromium inside Lambda, ScreenshotNeo provides a hosted screenshot API and MCP server. It accepts a URL with one GET request and returns PNG, JPEG, WebP, or PDF output. Before capture it accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled.

Only clean shots are billed. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and each response identifies the result with X-Page-Verdict and X-Billed headers. An MCP server supplies take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.

Use the ScreenshotNeo API documentation for the complete option list. The service supports full-page captures with lazy images loaded, CSS-selector element captures, dark mode, 12 device presets plus custom viewports, retina scale, PDF paper sizes and page ranges, HTML/CSS-to-image, custom JavaScript and CSS, pre-capture clicks, selector waits, delay or network-idle waits, ad and tracker blocking, custom headers, cookies, user agents and Authorization, timezone and geolocation, transparent backgrounds, image resizing, configurable TTL caching, signed image links, asynchronous jobs with signed webhooks, bulk capture for up to 100 URLs per call, a usage API, an OpenAPI specification, and compatible parameter names used by other screenshot APIs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Call it directly:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

The Free plan includes 1,000 screenshots per month with no card required. Paid plans start at $5 for 3,000 shots; yearly billing provides two months free, and every feature is included on every plan. Create a free ScreenshotNeo account to try it without adding a card.

FAQ

Does this error prove that Chromium lacks arm64 support?

No. The historical Sparticuz report shows one arm64 deployment fixed by moving to x86_64, but it does not establish support or lack of support for current package releases. Check the exact version’s documentation and artifact.

Why can the file exist at /tmp/chromium and still fail?

Filesystem presence and CPU compatibility are separate checks. A correctly named, executable-looking file can still contain instructions for a different architecture.

Should I change Lambda architecture before checking the package?

Identify the package and inspect the deployed executable first. Changing the function without replacing incompatible layers or artifacts can leave the same failure in place.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Does this error prove that Chromium lacks arm64 support?

No. The historical Sparticuz report shows one arm64 deployment fixed by moving to x86_64, but it does not establish support or lack of support for current package releases. Check the exact version’s documentation and artifact.

Why can the file exist at /tmp/chromium and still fail?

Filesystem presence and CPU compatibility are separate checks. A correctly named, executable-looking file can still contain instructions for a different architecture.

Should I change Lambda architecture before checking the package?

Identify the package and inspect the deployed executable first. Changing the function without replacing incompatible layers or artifacts can leave the same failure in place.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.