-
-
Notifications
You must be signed in to change notification settings - Fork 852
Added anchor browser example #2488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
WalkthroughAdds a new docs page at docs/guides/example-projects/anchor-browser-web-scraper.mdx detailing a scheduled Anchor Browser web scraping workflow with Trigger.dev, including code samples and cleanup handling. Updates docs/guides/introduction.mdx to include a new row in the Example projects table linking to the guide and its GitHub repo. Modifies docs/docs.json to insert the new guide into the Guides & examples → Example projects navigation, placed before the batch LLM evaluator entry. No application code or APIs are changed. Estimated code review effort🎯 2 (Simple) | ⏱️ ~10–15 minutes
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal). Please share your feedback with us on this Discord post. 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Pre-merge checks (2 passed, 1 warning)❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/guides/example-projects/anchor-browser-web-scraper.mdx (1)
120-125
: Typo: “Browser our” → “Browse our”.-- Browser our [example projects](/guides/introduction) to see how you can use Trigger.dev with other services. +- Browse our [example projects](/guides/introduction) to see how you can use Trigger.dev with other services.
🧹 Nitpick comments (3)
docs/guides/example-projects/anchor-browser-web-scraper.mdx (3)
49-58
: Verify SDK import and env var naming against current Anchor SDK.Docs commonly use
AnchorClient
withANCHOR_API_KEY
, while some pages show a namedAnchorbrowser
. The default import used here may not match the SDK; the env var name differs too. Please confirm and align to reduce copy/paste errors.Option aligning with quickstart:
-import Anchorbrowser from "anchorbrowser"; +import { AnchorClient } from "anchorbrowser"; -const client = new Anchorbrowser({ - apiKey: process.env.ANCHOR_BROWSER_API_KEY!, +const client = new AnchorClient({ + apiKey: process.env.ANCHOR_API_KEY!, });Refs: SDK quickstart (AnchorClient, ANCHOR_API_KEY) and alternate examples. (docs.anchorbrowser.io)
61-66
: Prefer returned live_view_url over manual construction.The create-session response includes
live_view_url
. Using it avoids future URL format changes.- console.log(`Live View URL: https://live.anchorbrowser.io?sessionId=${session.data.id}`); + console.log(`Live View URL: ${session.data.live_view_url}`);Anchor’s API returns
live_view_url
; live view embedding guidance recommends using that value. (docs.anchorbrowser.io)
75-89
: Make result parsing deterministic (avoid brittle string contains).Relying on a free-form string with “Show:” is fragile. Either request structured output or parse with a schema/regex.
- const result = response.data.result?.result || response.data.result || response.data; - if (result && typeof result === "string" && result.includes("Show:")) { + const raw = response.data.result?.result ?? response.data.result ?? response.data; + const m = typeof raw === "string" + ? raw.match(/Show:\s*(.+?),\s*Price:\s*(.+?),\s*Time:\s*(.+)$/) + : null; + if (m) { + const [, show, price, time] = m; return { success: true, - bestDeal: result, + bestDeal: { show, price, time }, liveViewUrl: `https://live.anchorbrowser.io?sessionId=${session.data.id}`, };Or change the prompt to request JSON and
JSON.parse
it.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
docs/docs.json
(1 hunks)docs/guides/example-projects/anchor-browser-web-scraper.mdx
(1 hunks)docs/guides/introduction.mdx
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (4)
docs/docs.json (1)
339-351
: Nav entry looks good; please verify route build succeeds.The slug path format matches surrounding entries. After merge, run the docs build and click-test the new item in the “Guides & examples → Example projects” menu to ensure no missing-page regressions.
docs/guides/introduction.mdx (1)
48-49
: LGTM: new example row renders and links correctly.Name, docs link, and repo URL look consistent with the new guide.
docs/guides/example-projects/anchor-browser-web-scraper.mdx (2)
67-76
: Endpoint usage looks correct.
tools.performWebTask
withsessionId
,url
, andprompt
matches the v1 API.Reference. (docs.anchorbrowser.io)
90-98
: Nice: robust session cleanup.Good use of
finally
and nested try/catch to avoid leaking sessions if the task throws.
No description provided.