Skip to content

[BUG] (likely) Chromium Segfault on ARM - Graviton lambdas, Apple Silicon + Docker Lambda #19

@alessbelli

Description

@alessbelli

Environment

  • chromium Version: 107
  • puppeteer / puppeteer-core Version: ^18.1.0
  • Node.js Version: 16.x
  • Lambda / GCF Runtime: nodejs16.x, arm64

Expected Behavior

chrome doesn't crash

Current Behavior

on puppeteer browser start,

Error: Failed to launch the browser process!
/tmp/chromium: /tmp/chromium: cannot execute binary file

Steps to Reproduce

create a lambda with arm64 architecture (Architectures: ["arm64"])
invoke the following code

const chromium = require('@sparticuz/chromium')
const puppeteer = require('puppeteer-core')

exports.handler = async (event, context, callback) => {
  let result = null;
  let browser = null;

  try {
    browser = await puppeteer.launch({
      args: chromium.args,
      defaultViewport: chromium.defaultViewport,
      executablePath: await chromium.executablePath,
      headless: chromium.headless,
      ignoreHTTPSErrors: true,
    });

  } catch (error) {
    return callback(error);
  } finally {
    if (browser !== null) {
      await browser.close();
    }
  }

  return callback(null, result);
};

Possible Solution

This is likely because the chromium binary is compiled using x64 as a target.
I believe that for it to work properly, there should be ansible steps to compile for arm, and two different binaries should be present here, then either based on runtime environment detection or based on arguments, the correct executable should be used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions