Install
$ agentstack add skill-tranhieutt-software-development-department-cloud-run-puppeteer Open-source listing — not yet scanned by AgentStack. Follow the source repository for install instructions.
Security review
⚠ Flagged1 finding(s); flagged for manual review. · v0.1.0 How review works →
- • Prompt-injection patterns
- • Secret / credential exfiltration
- • Dangerous shell & filesystem operations
- • Untrusted network calls
- • Known-malicious package signatures
- high Destructive filesystem operation.
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
Cloud Run + Puppeteer Deployment Guide
Hard-won lessons from deploying Puppeteer to Cloud Run. These are non-obvious gotchas that cost significant debug time.
MUST: Use gen2 Execution Environment
Cloud Run gen1 uses gVisor sandbox — blocks Linux syscalls Chrome needs to create processes. Puppeteer will hang/timeout silently.
gcloud run deploy my-service \
--execution-environment gen2 # **Windows/Git Bash warning:** `--set-env-vars` với path Unix sẽ bị Git Bash convert thành Windows path. Set `ENV` trực tiếp trong Dockerfile thay vì truyền qua CLI.
---
## Puppeteer Launch Config cho Cloud Run
```javascript
const browser = await puppeteer.launch({
headless: 'new',
timeout: 60000, // cold start cần thời gian — mặc định 30s không đủ
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage', // /dev/shm nhỏ trong container
'--single-process',
'--no-zygote',
'--disable-gpu',
],
});
waitUntil hợp lệ trong Puppeteer
Chỉ có 4 giá trị hợp lệ — 'commit' (từ Playwright) KHÔNG tồn tại:
| Giá trị | Ý nghĩa | |---------|---------| | load | Chờ event load (chậm nhất) | | domcontentloaded | Chờ DOM parse xong (khuyên dùng) | | networkidle0 | Không còn request nào trong 500ms | | networkidle2 | ≤ 2 request đang chờ trong 500ms |
Với trang nặng từ server overseas, dùng domcontentloaded + timeout cao + waitForFunction chờ content cụ thể:
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 120000 });
await page.waitForFunction(
() => document.body && document.body.innerText.includes('target-text'),
{ timeout: 60000 }
);
Block Resource để Tăng Tốc
Chặn images, CSS, fonts giảm băng thông đáng kể — quan trọng khi crawl từ server overseas:
await page.setRequestInterception(true);
page.on('request', (req) => {
if (['image', 'stylesheet', 'font', 'media'].includes(req.resourceType())) {
req.abort();
} else {
req.continue();
}
});
Recommended Cloud Run Deploy Command
gcloud run deploy my-service \
--image gcr.io/PROJECT_ID/my-image \
--region asia-southeast1 \
--platform managed \
--execution-environment gen2 \
--memory 2Gi \
--cpu 2 \
--timeout 300 \
--set-secrets "/secrets/service-account.json=my-secret:latest" \
--allow-unauthenticated
Puppeteer cần ít nhất 2Gi RAM — Chrome dùng nhiều memory.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: tranhieutt
- Source: tranhieutt/softwaredevelopment_department
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.