Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
Add health check endpoint for Playwright service (ENG-2585) (#1752)
devin-ai-integration[bot]de4094b19ca4
diff --git a/apps/playwright-service-ts/api.ts b/apps/playwright-service-ts/api.tsindex aabcf3bfb..edbc43968 100644--- a/apps/playwright-service-ts/api.ts+++ b/apps/playwright-service-ts/api.ts@@ -153,6 +153,25 @@ const scrapePage = async (page: Page, url: string, waitUntil: 'load' | 'networki};};+app.get('/health', async (req: Request, res: Response) => {+ try {+ if (!browser || !context) {+ await initializeBrowser();+ }++ const testPage = await context.newPage();+ await testPage.close();++ res.status(200).json({ status: 'healthy' });+ } catch (error) {+ console.error('Health check failed:', error);+ res.status(503).json({+ status: 'unhealthy',+ error: error instanceof Error ? error.message : 'Unknown error occurred'+ });+ }+});+app.post('/scrape', async (req: Request, res: Response) => {const { url, wait_after_load = 0, timeout = 15000, headers, check_selector }: UrlModel = req.body;