Skip to content

BrowserFailedError on GitHub Actions when running tests with Kaleido #242

Closed

Description

@idanmoradarthas

Description:
When running my test suite using Kaleido on GitHub Actions, I encountered a recurring issue with the browser crashing. The error output suggests that the browser closes immediately after starting, resulting in a BrowserFailedError.

ERROR    asyncio:base_events.py:1826 Task exception was never retrieved
  future: <Task finished name='Task-2' coro=<Browser._open_async() done, defined at /Users/runner/work/.../.tox/.../choreographer/browser.py:246> exception=BrowserFailedError('The browser seemed to close immediately after starting. Perhaps adding debug_browser=True will help.')>
...
choreographer.browser.BrowserFailedError: Close() was called before the browser finished opening- maybe it crashed?
...

Steps to Reproduce:

  1. Set up a GitHub Action workflow to test the project.
  2. Install Kaleido and its dependencies within the matrix (includes ubuntu-latest, windows-latest, and macos-latest).
  3. Run the test suite via tox (defined in the workflow file, see below).

Relevant GitHub Action Workflow:

name: Build

on:
  push:
  pull_request:
    types: [ opened, reopened ]

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ ubuntu-latest, windows-latest, macos-latest ]
        python-version: [ "3.9", "3.10", "3.11", "3.12" ]
    steps:
      - uses: actions/checkout@v4
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
          cache: pip
      - name: Install tox
        run: pip install tox tox-gh-actions
      - name: Install graphviz and Chromium dependencies
        if: runner.os == 'Linux'
        run: |
          sudo apt-get update
          sudo apt-get -y install graphviz chromium-browser libnss3-dev libgdk-pixbuf2.0-dev libgtk-3-dev libxss-dev
      - name: Run tox
        run: tox -e py

System Information:

  • OS: Windows, macOS, and Ubuntu (latest versions)
  • Python Versions: 3.9, 3.10, 3.11, 3.12
  • Kaleido Version: 0.4.1 and 1.0.0rc0
  • Tox Version: 4.24.1

Expected Behavior: Kaleido should start a browser instance and successfully save images during test execution.

Actual Behavior: The browser crashes immediately after starting, causing the test suite to fail.

Additional Context: This issue occurs specifically within the GitHub Actions environment. The suggestion to enable debug_browser=True did not provide additional clarity. The same tests run successfully in a local development environment.

Activity

  1. joelsamiller commented on Jan 27, 2025

    @joelsamiller

    I am having the same issue on windows-latest and the same Python versions

  2. self-assigned this
    on Jan 29, 2025
  3. added
    TNG
    on Jan 29, 2025
  4. ayjayt commented on Jan 29, 2025

    @ayjayt
    Collaborator

    Hi friends, there's very very imminently the actual Kaleido v1 (ie not a release candidate) coming out, and this issue may go away with its improvements.

    I will ping you two when it is official released, and if you still have the issue, I will direct you to posting the debug output.

    Thanks for your patience!

  5. ayjayt commented on Feb 24, 2025

    @ayjayt
    Collaborator

    Copied from my other comment:

    There are new pre-releases slated on github of kaleido: https://github.com/plotly/Kaleido/tree/latest-tag

    Once Kaleido > = v1.0.0rc1 is integrated into plotly.py (for figure.write_figure(PATH) shortcut API), it will be released as v1.0.0 official.

    But the base Kaleido API is stable and can also be used like this:

    import kaleido
    kaleido.write_fig_sync(some_figure, path="./output./")

    Here are some more examples:
    https://github.com/plotly/Kaleido/blob/master/src/py/docs/examples.md

    The new kaleido release requires a chromium-ish browser (chromium, chrome, edge) to be installed and accesible.
    This is also possible from a CLI that comes with kaleido:

    kaleido_get_chrome --help

    That command also uses tested chromiums in case new versions introduce bugs (they do sometimes).

    Feel free to @ me for any help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

TNGactive

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions