Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/crawling/src/crawling/crawlYoutubeVerify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import { isValidKYExistNumber } from './isValidKYExistNumber';
// 기존에 등록된 KY 노래방 번호가 실제로 KY 노래방과 일치하는지 검증
// 유효한 곡은 verify_ky_songs 테이블에 insert

const browser = await puppeteer.launch();
// action 우분투 환경에서의 호환을 위해 추가
const browser = await puppeteer.launch({
headless: true,
args: ['--no-sandbox', '--disable-setuid-sandbox'],
});
Comment on lines +12 to +16

Choose a reason for hiding this comment

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

Action required

1. Browser not closed safely 🐞 Bug ⛯ Reliability

crawlYoutubeVerify launches a Browser at module scope without a try/finally, and it calls
browser.close() without awaiting it, so any thrown error can bypass cleanup and leave Chromium
running. This can hang or flake CI runs because Supabase getters can throw before the close is
reached.
Agent Prompt
### Issue description
`crawlYoutubeVerify.ts` does not guarantee Puppeteer cleanup: it launches `browser` at module scope, has no `try/finally`, and calls `browser.close()` without `await`. Any thrown error (e.g., from Supabase getters) can skip cleanup and leave Chromium running.

### Issue Context
Supabase getter functions used in this script throw on error, so lifecycle cleanup must be guaranteed.

### Fix Focus Areas
- packages/crawling/src/crawling/crawlYoutubeVerify.ts[12-50]

### Implementation notes
- Wrap the whole script body in `const main = async () => { ... }`.
- Use `try { ... } catch (e) { ... } finally { await browser.close(); }`.
- Consider moving `page` creation inside the `try` and setting a non-zero `process.exitCode` on fatal errors.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

const page = await browser.newPage();

const data = await getSongsKyNotNullDB();
Expand Down