2 months ago
Hi there, I'm using crawl4ai (using playwright) to crawl and extract data and use Fastapi to write api. I run my code successfully on local. But I got error: playwright.impl.errors.Error: BrowserType.launch: Executable doesn't exist at /root/.cache/ms-playwright/chromium-1161/chrome-linux/chrome when run api.
Previously, I posted a question here, and I got a solution to change from railway.json to railpack.json to create a Docker file for deploying, and it worked. Here's the railpack.json file
{ "$schema": "[https://schema.railpack.com](https://schema.railpack.com)", "provider": "python", "steps": { "playwright": { "inputs": [{ "step": "build" }], "commands": ["python -m playwright install --with-deps chromium"] } }, "deploy": { "inputs": [{ "step": "playwright" }], "startCommand": "hypercorn main:app --bind \"[::]:$PORT\"" } }
And here is the original post for this solution if you want to refer to it: https://discord.com/channels/713503345364697088/1351845229053087775
But then one day, I got a crash notification when I redeployed without changing anything. So I posted here and got a solution:
1) Update railpack.json to:
{
"$schema": "
https://schema.railpack.com/
",
"provider": "python",
"steps": {
"playwright": {
"inputs": [{ "step": "build" }],
"commands": ["python -m playwright install --with-deps chromium"]
}
}
}
2) Create "Procfile" in same directory as railpack.json, and add this one line to the file (without quote marks):
"web: hypercorn --bind 0.0.0.0:$PORT main:app"
Then it works. The original post here: https://discord.com/channels/713503345364697088/1357649850954416158
But today, I run my app and get the error: playwright.impl.errors.Error: BrowserType.launch: Executable doesn't exist at /root/.cache/ms-playwright/chromium-1161/chrome-linux/chrome when run api again.
Any help, please :((
Project id: 86b6d50c-4a4d-423a-81d5-4e7a0d38cacd