PDF Generation: Playwright Browser Path Issues in Gadget Cloud
Hey team! 👋 Working on server-side PDF generation using Playwright in my Gadget app, but hitting browser executable path mismatches.
The Issue:
- Playwright looking for:
/home/api/.cache/ms-playwright/chromium_headless_shell-1181/chrome-linux/headless_shell
- Browser installed at: /home/user_86045/.cache/ms-playwright/chromium-1181/chrome-linux/chrome
- Error: browserType.launch: Executable doesn't exist at [path]
What I've tried:
- npx playwright install chromium
(installs to user cache, not api user)
- Setting PLAYWRIGHT_BROWSERS_PATH (permission denied)
- Multiple executablePath fallbacks in code
Questions:
1. What's the recommended approach for Playwright/Puppeteer browser management in Gadget?
2. Should I use explicit browser paths or is there a Gadget-specific way?
3. For production deployment, what's the best practice for browser installation?
4. Any recommended alternatives (Gotenberg, PDFShift, wkhtmltopdf) that work better in Gadget's environment?
Current Setup:
- Node.js backend route handling PDF generation
- Playwright with HTML-to-PDF conversion
- Complex project layouts with dynamic data
Any guidance would be super helpful! 🙏
Trace ID for reference: 887869274f47eeb07e2dd972c00725e24 Replies
tried several libraries; but always get the browser location issue
hey guys, could you please answer this
Give the team a chance. You only posted this 30 mins ago and they're only just starting their day. Have some patience.
sure
Hi Ahmad, would you be able to share your app url?