Skip to content

Conversation

@JsNcAr
Copy link

@JsNcAr JsNcAr commented Jan 23, 2026

Related Issue

No existing issue. This PR fixes PDF generation failures on non-Debian Linux distributions.

Description

PDF generation fails on non-Debian systems (OpenSUSE, Fedora, Arch) with "Playwright browser executable is missing" error, even when Chrome/Chromium is installed via system package managers.

Root Cause: _find_chromium_executable() only checked Windows paths, returning None on Linux/macOS.

Solution: Extended browser detection to support system-installed Chrome/Chromium across all platforms, enabling users on non-Debian distributions to use their system browsers when Playwright browser installation is unavailable.

Type

  • Bug Fix
  • Feature Enhancement
  • Documentation Update
  • Code Refactoring
  • Other (please specify):

Proposed Changes

  • Extended _find_chromium_executable() to detect Chrome/Chromium on Linux and macOS
  • Added common Linux installation paths (/usr/bin/chromium, /usr/bin/google-chrome, /usr/bin/google-chrome-stable)
  • Added Snap installation detection (/snap/bin/chromium)
  • Added Flatpak installation detection (system and user directories)
  • Added macOS Chrome detection
  • Preserved existing Windows behavior (no breaking changes)

Screenshots / Code Snippets (if applicable)

Before:
image

def _find_chromium_executable() -> Optional[str]:
    if sys.platform != "win32":
        return None  # ❌ Always failed on Linux/macOS
    # Windows-only paths...

After:

def _find_chromium_executable() -> Optional[str]:
    """Find system Chrome/Chromium/Edge executable across platforms."""
    if sys.platform == "win32":
        # Windows paths (unchanged)
    else:
        # ✅ Linux/macOS browser detection
        candidates = [
            Path("/usr/bin/google-chrome"),
            Path("/usr/bin/chromium"),
            Path("/snap/bin/chromium"),
            Path("/var/lib/flatpak/exports/bin/com.google.Chrome"),
            # ... more paths
        ]

How to Test

On non-Debian Linux (OpenSUSE, Fedora, Arch):

  1. Install Chrome or Chromium via system package manager:
    sudo zypper install chromium      # OpenSUSE
    sudo dnf install chromium-browser # Fedora
    sudo pacman -S chromium           # Arch
  2. Start backend: npm run dev:backend
  3. Create/edit a resume in the frontend
  4. Click "Download PDF" → Should generate PDF successfully

On Debian/Ubuntu (regression test):

  1. Verify PDF download still works with existing Chrome/Playwright setup
  2. No behavioral changes expected

On Windows (regression test):

  1. Verify PDF download works with existing Chrome/Edge detection
  2. No behavioral changes expected

Checklist

  • The code compiles successfully without any errors or warnings
  • The changes have been tested and verified
  • The documentation has been updated (if applicable)
  • The changes follow the project's coding guidelines and best practices
  • The commit messages are descriptive and follow the project's guidelines
  • All tests (if applicable) pass successfully
  • This pull request has been linked to the related issue (if applicable)

Additional Information

Tested Environment:

  • OS: OpenSUSE Tumbleweed
  • Browser: Chromium installed via zypper
  • Result: PDF generation works without Playwright browser installation

Impact:

  • Platforms: All non-Debian Linux distributions, macOS
  • Breaking Changes: None - Windows behavior unchanged, Playwright browsers still work as fallback
  • Benefits: Users can now use system browsers on distributions where Playwright package installation is difficult/unsupported

Technical Notes:

  • The function checks multiple common paths and returns the first valid executable found
  • Fallback order: System browser → Playwright browser (via original try/catch)
  • No changes to error handling or retry logic

Summary by cubic

Fixes PDF generation on non-Debian Linux by detecting system-installed Chrome/Chromium when Playwright isn’t available. Adds macOS support and keeps Windows behavior unchanged.

  • Bug Fixes
    • Extend _find_chromium_executable to search common Linux/macOS paths (usr/bin, Snap, Flatpak).
    • Detect Chrome, Chromium, and Edge; return the first valid executable.
    • Preserve Windows paths and keep Playwright as a fallback.

Written for commit 4aee8cb. Summary will update on new commits.

…ght support

Enable PDF generation on non-Debian systems (OpenSUSE, Fedora, Arch)
where Playwright browsers are hard to install. Users can now use
system-installed Chrome/Chromium instead.

- Add Linux browser path detection (/usr/bin/chromium, google-chrome)
- Support Snap and Flatpak installations
- Windows behavior unchanged

Previously _find_chromium_executable() only checked Windows paths,
causing failures when system browsers were available.

Tested on OpenSUSE with system Chromium
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="apps/backend/app/pdf.py">

<violation number="1" location="apps/backend/app/pdf.py:87">
P2: macOS fallback detection is missing: the non-Windows branch only checks Linux paths, so macOS systems without Playwright browsers still fail to find system Chrome despite the cross-platform intent.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

/ "Microsoft/Edge/Application/msedge.exe",
]
else:
# Linux/macOS paths
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: macOS fallback detection is missing: the non-Windows branch only checks Linux paths, so macOS systems without Playwright browsers still fail to find system Chrome despite the cross-platform intent.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/backend/app/pdf.py, line 87:

<comment>macOS fallback detection is missing: the non-Windows branch only checks Linux paths, so macOS systems without Playwright browsers still fail to find system Chrome despite the cross-platform intent.</comment>

<file context>
@@ -71,18 +71,33 @@ def _resolve_pdf_margins(margins: Optional[dict]) -> dict:
+            / "Microsoft/Edge/Application/msedge.exe",
+        ]
+    else:
+        # Linux/macOS paths
+        candidates = [
+            Path("/usr/bin/google-chrome"),
</file context>
Fix with Cubic

@srbhr
Copy link
Owner

srbhr commented Jan 23, 2026

Hey @JsNcAr

Thanks for this PR. I have some more questions and there's a few more people who are having the same problem.

Can you join our discord please? So that I can loop you into the conversation with all the other community members?

https://dsc.gg/resume-matcher

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

Successfully merging this pull request may close these issues.

2 participants