Skip to content

Feat: Lightpanda extension #2192

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

Merged
merged 28 commits into from
Jul 28, 2025

Conversation

nrigaudiere
Copy link
Contributor

Closes N/A

✅ Checklist

  • I have followed every step in the contributing guide
  • The PR title follows the convention.
  • I ran and tested the code works

Testing

  • Launched the pnpm dev command in ./docs to make sure that the additions to the documentation were working and compliant with the overall look and feel of the documentation.
  • Built the lightpanda extension to make sure the Docker instructions were working
  • Tested the example tasks in a production environment

Changelog

The main purpose of that PR is to add the Lightpanda documentation and examples. It has 3 working examples with different use cases (fetching a page, using Lightpanda's cloud and using Lightpanda browser with Puppeteer). This PR also provides the code of the extension which gets the nightly build (only version currently available) and gives users ability to run Lightpanda in their tasks.

  • Add Lightpanda extension + documentation
  • Add Guide examples for Lightpanda
  • Add example task for Lightpanda

Screenshots

Screenshot 2025-06-23 at 11 55 09

Screenshot 2025-06-23 at 16 42 36

💯

Copy link

changeset-bot bot commented Jun 24, 2025

🦋 Changeset detected

Latest commit: 0a0c06a

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

coderabbitai bot commented Jun 24, 2025

Walkthrough

This change set introduces support and documentation for the Lightpanda browser extension within the Trigger.dev ecosystem. It adds a new build extension (lightpanda) to the @trigger.dev/build package, including the implementation file and updates to the package's export configuration. Documentation is expanded with a new configuration guide, an example usage guide, and navigation updates to reference Lightpanda in various menus and overviews. The example guide demonstrates three integration methods for Lightpanda (cloud, CLI, and CDP server) using TypeScript code. Two changeset files are included to record the addition of the Lightpanda extension and a separate UI-related update.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

  • Complexity: Moderate. The primary complexity arises from the new build extension implementation and the comprehensive documentation and example code. The changes are well-contained, with no modifications to existing logic, but require careful review for correctness, clarity, and integration consistency.
  • Volume: Several new documentation files, a new extension source file, updates to package exports, and navigation configuration.
  • Estimated time: ~18 minutes for a human reviewer to verify the new extension, its configuration, documentation accuracy, and example code, plus a quick check of the changeset metadata.

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c7cb791 and 0a0c06a.

📒 Files selected for processing (2)
  • .changeset/rare-mails-fail.md (1 hunks)
  • docs/introduction.mdx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/introduction.mdx
  • .changeset/rare-mails-fail.md
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (5)
docs/config/config-file.mdx (1)

431-434: Let’s retry locating the file with a simpler command:

#!/bin/bash
find docs -type f -iname 'lightpanda.mdx'
packages/build/src/extensions/lightpanda.ts (1)

5-9: Consider expanding configuration options.

The current configuration is limited but functional. Consider future extensibility for common use cases.

Potential improvements:

  • Support for additional architectures if Lightpanda expands support
  • Configurable installation path for advanced users
  • Support for stable releases when available (currently only nightly)

Also applies to: 11-11

docs/guides/examples/lightpanda.mdx (2)

92-94: Fix formatting and grammar.

Missing comma and formatting issue in the proxy example.

-_Example using a German IP :_
+_Example using a German IP:_

-`wss://cloud.lightpanda.io/ws?proxy=datacenter&country=de&token=TOKEN```
+```
+wss://cloud.lightpanda.io/ws?proxy=datacenter&country=de&token=TOKEN
+```

108-108: Fix grammar: Use "Set up" instead of "Setup".

"Setup" is a noun; the verb should be "Set up".

-- Setup the [Lightpanda build extension](/config/extensions/lightpanda)
+- Set up the [Lightpanda build extension](/config/extensions/lightpanda)

Also applies to: 151-151

docs/introduction.mdx (1)

96-97: Keep the build-extension table alphabetically sorted for easier scanning.

The newly added lightpanda row sits between puppeteer and ffmpeg.
All other rows are alphabetically ordered; moving this row after ffmpeg preserves that convention and prevents merge conflicts in future additions.

-| puppeteer | Use Puppeteer with Trigger.dev | [Learn more](/config/extensions/puppeteer) |
-| lightpanda | Use Lightpanda Browser with Trigger.dev | [Learn more](/config/extensions/lightpanda) |
-| ffmpeg | Use FFmpeg with Trigger.dev | [Learn more](/config/extensions/ffmpeg) |
+| puppeteer | Use Puppeteer with Trigger.dev | [Learn more](/config/extensions/puppeteer) |
+| ffmpeg | Use FFmpeg with Trigger.dev | [Learn more](/config/extensions/ffmpeg) |
+| lightpanda | Use Lightpanda Browser with Trigger.dev | [Learn more](/config/extensions/lightpanda) |
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 485f71c and dada9c7.

⛔ Files ignored due to path filters (3)
  • docs/images/intro-lightpanda.jpg is excluded by !**/*.jpg
  • references/v3-catalog/src/trigger/lightpandaTask.ts is excluded by !references/**
  • references/v3-catalog/trigger.config.ts is excluded by !references/**
📒 Files selected for processing (10)
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam._index/route.tsx (1 hunks)
  • docs/config/config-file.mdx (1 hunks)
  • docs/config/extensions/lightpanda.mdx (1 hunks)
  • docs/config/extensions/overview.mdx (1 hunks)
  • docs/docs.json (2 hunks)
  • docs/guides/examples/lightpanda.mdx (1 hunks)
  • docs/guides/introduction.mdx (1 hunks)
  • docs/introduction.mdx (2 hunks)
  • packages/build/package.json (3 hunks)
  • packages/build/src/extensions/lightpanda.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`apps/webapp/**/*`: The webapp at apps/webapp is a Remix 2.1 app that uses Node.js v20. Use zod extensively in the webapp.

apps/webapp/**/*: The webapp at apps/webapp is a Remix 2.1 app that uses Node.js v20.
Use zod extensively in the webapp.

  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam._index/route.tsx
🧠 Learnings (1)
docs/introduction.mdx (1)
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:09.989Z
Learning: Build extensions in 'trigger.config.ts' allow customization of the build process, such as copying files, including packages, installing system dependencies, and enabling TypeScript features.
🪛 LanguageTool
docs/guides/examples/lightpanda.mdx

[uncategorized] ~92-~92: Possible missing comma found.
Context: ...iki/ISO_3166-1_alpha-2) country code. Example using a German IP : ```wss://cloud.li...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~103-~103: A comma might be missing here.
Context: ... using Lightpanda Using the Lightpanda binary we will dump the HTML for a provided UR...

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)


[grammar] ~108-~108: The word “Setup” is a noun. The verb is spelled with a space.
Context: ...ggering the task. ### Prerequisites - Setup the [Lightpanda build extension](/confi...

(NOUN_VERB_CONFUSION)


[uncategorized] ~148-~148: Do not mix variants of the same word (‘initialise’ and ‘initialize’) within a single text.
Context: ... use a Lightpanda CDP server This task initialises a Lightpanda CDP server to allow you to...

(EN_WORD_COHERENCY)


[grammar] ~151-~151: The word “Setup” is a noun. The verb is spelled with a space.
Context: ...y via Trigger.dev. ### Prerequisites - Setup the [Lightpanda build extension](/confi...

(NOUN_VERB_CONFUSION)


[style] ~154-~154: Consider a more concise word here.
Context: ...ask will have to launch a child process in order to have the websocket available to scrape ...

(IN_ORDER_TO_PREMIUM)

🔇 Additional comments (10)
docs/config/extensions/overview.mdx (1)

55-56: LGTM – new Lightpanda row looks correct

The link path and description render correctly and follow the table’s existing style – no issues spotted.

docs/guides/introduction.mdx (2)

96-97: Confirm exported identifier casing

The table lists the extension as lightpanda. Ensure the build package exports exactly the same lowercase identifier (e.g. export const lightpanda = …). A mismatch would break consumer imports like:

import { lightpanda } from "@trigger.dev/build/extensions/core";

86-87: Check that the Lightpanda hero image is committed

Broken images silently hurt the docs UX. Please confirm public/images/intro-lightpanda.jpg (or equivalent) exists and is picked up by the docs build.

#!/bin/bash
# Locate the Lightpanda hero image
fd --strip-cwd-prefix 'intro-lightpanda.jpg' | head -n 20
apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam._index/route.tsx (1)

718-719: New Lightpanda example link wired correctly

Path, description and external-link behaviour align with existing entries – looks good.

docs/docs.json (1)

81-81: LGTM! Navigation structure updated correctly.

The Lightpanda extension and example entries are properly placed in the documentation navigation structure, following the existing patterns and alphabetical ordering.

Also applies to: 362-362

docs/config/extensions/lightpanda.mdx (1)

1-31: Documentation structure and content look good.

The documentation follows the established pattern for extension documentation with clear configuration instructions and proper references to examples.

packages/build/package.json (1)

34-34: LGTM! Package exports configured correctly.

The Lightpanda extension exports are properly configured following the same pattern as other extensions, with correct paths for both CommonJS and ESM module systems.

Also applies to: 66-68, 196-206

packages/build/src/extensions/lightpanda.ts (1)

17-19: LGTM! Extension structure and lifecycle integration.

The extension properly integrates with the build lifecycle, correctly skips dev environments, and follows the established pattern for build extensions.

Also applies to: 43-55

docs/guides/examples/lightpanda.mdx (1)

1-86: Comprehensive examples with good coverage.

The guide provides excellent coverage of different Lightpanda usage patterns with detailed code examples and clear documentation. The three examples effectively demonstrate the versatility of the integration.

Also applies to: 101-244

docs/introduction.mdx (1)

86-87: Double-check that the new image asset has been added and exported.

img="/images/intro-lightpanda.jpg" will break at build time if the file hasn’t been committed or the path/case differs (S3/Netlify deploys are case-sensitive).
Please verify the asset exists in docs/public/images (or the equivalent assets dir) and matches the exact filename.

#!/bin/bash
# Confirm the Lightpanda hero image is present
fd intro-lightpanda.jpg docs | head -n 10

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (6)
docs/guides/examples/lightpanda.mdx (6)

45-48: Comprehensive URL validation still missing (see prior review).
Previous feedback already requested adding a validateUrl helper and replacing this simple truthy check. The current code is still vulnerable to malformed / malicious input.


124-127: Comprehensive URL validation still missing (see prior review).
Same issue as in Example #1 – please reuse the shared validateUrl helper.


136-136: execSync remains injection-prone and lacks error handling.
The earlier review already suggested wrapping the call in try/catch, validating the URL, and using JSON.stringify (or similar) to prevent shell expansion.


193-196: Comprehensive URL validation still missing (see prior review).
Identical concern as above – adopt the shared helper.


230-233: Child-process cleanup logic unchanged.
The previous review recommended a safer, two-phase termination (SIGTERM → delay → SIGKILL) and handling in the catch block to avoid zombies.


240-242: Ensure process cleanup in error branch.
If spawnLightpanda succeeds but a later step throws, the Lightpanda process is left running. Integrate the cleanup suggested in prior feedback.

🧹 Nitpick comments (2)
docs/guides/examples/lightpanda.mdx (2)

64-71: Filter‐out null / empty hrefs for cleaner results.
getAttribute('href') can return null; returning these values forces every consumer to re-filter. Consider:

-      return Array.from(document.querySelectorAll('a')).map(row => {
-        return row.getAttribute('href')
-      })
+      return Array.from(document.querySelectorAll('a'))
+        .map(a => a.getAttribute('href'))
+        .filter(Boolean)

109-109: Minor wording fixes for docs.

-### Prerequisites
-- Setup the [Lightpanda build extension](/config/extensions/lightpanda)
+### Prerequisites
+- Set up the [Lightpanda build extension](/config/extensions/lightpanda)

Similarly, prefer “initializes” (or “starts”) over “initialises” for consistency with US spelling used elsewhere.

Also applies to: 152-152

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aab534b and 6ded313.

📒 Files selected for processing (1)
  • docs/guides/examples/lightpanda.mdx (1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/guides/examples/lightpanda.mdx

[uncategorized] ~93-~93: Possible missing comma found.
Context: ...iki/ISO_3166-1_alpha-2) country code. Example using a German IP : ```wss://cloud.li...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~104-~104: A comma might be missing here.
Context: ... using Lightpanda Using the Lightpanda binary we will dump the HTML for a provided UR...

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)


[grammar] ~109-~109: The word “Setup” is a noun. The verb is spelled with a space.
Context: ...ggering the task. ### Prerequisites - Setup the [Lightpanda build extension](/confi...

(NOUN_VERB_CONFUSION)


[uncategorized] ~149-~149: Do not mix variants of the same word (‘initialise’ and ‘initialize’) within a single text.
Context: ... use a Lightpanda CDP server This task initialises a Lightpanda CDP server to allow you to...

(EN_WORD_COHERENCY)


[grammar] ~152-~152: The word “Setup” is a noun. The verb is spelled with a space.
Context: ...y via Trigger.dev. ### Prerequisites - Setup the [Lightpanda build extension](/confi...

(NOUN_VERB_CONFUSION)


[style] ~155-~155: Consider a more concise word here.
Context: ...ask will have to launch a child process in order to have the websocket available to scrape ...

(IN_ORDER_TO_PREMIUM)

@nrigaudiere nrigaudiere force-pushed the feat/lightpanda-extension branch from 6ded313 to 60f3357 Compare June 25, 2025 08:20
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (5)
packages/build/src/extensions/lightpanda.ts (2)

11-57: LGTM! Security improvements have been implemented.

The extension implementation looks solid with proper type definitions and build lifecycle integration. I can see the security improvements from previous reviews have been incorporated:

  • Error handling with || (echo "Failed to download..." && exit 1)
  • Retry logic with --retry 3
  • Binary verification with version check

The code follows good practices for build extensions and properly handles environment variable setup.


23-42: Consider implementing Docker layer optimization.

Based on previous review discussions, combining all RUN statements into a single instruction would reduce Docker layers and improve build efficiency. The current approach uses multiple RUN statements which creates unnecessary layers.

docs/guides/examples/lightpanda.mdx (3)

45-48: Address URL validation security concern.

The URL validation is insufficient and could lead to security issues. This was flagged in previous reviews.

Apply the comprehensive URL validation suggested in previous reviews:

const validateUrl = (url: string): void => {
  if (!url || typeof url !== 'string') {
    throw new Error('URL is required and must be a string')
  }
  
  try {
    new URL(url)
  } catch {
    throw new Error('Invalid URL format')
  }
  
  if (!url.startsWith('http://') && !url.startsWith('https://')) {
    throw new Error('URL must use http or https protocol')
  }
}

Replace the existing validation:

-    if (!payload.url) {
-      logger.warn('Please define the payload url')
-      throw new Error('payload.url is undefined')
-    }
+    validateUrl(payload.url)

136-136: Fix command injection vulnerability.

The execSync call is vulnerable to command injection as flagged in previous reviews.

Apply the security fix from previous reviews:

-    const e = execSync(`${process.env.LIGHTPANDA_BROWSER_PATH} fetch --dump ${payload.url}`)
+    // Validate URL format to prevent command injection
+    const urlPattern = /^https?:\/\/.+/
+    if (!urlPattern.test(payload.url)) {
+      throw new Error('Invalid URL format')
+    }
+    
+    try {
+      const result = execSync(`${process.env.LIGHTPANDA_BROWSER_PATH} fetch --dump ${JSON.stringify(payload.url)}`, {
+        encoding: 'utf8',
+        timeout: 30000 // 30 second timeout
+      })
+      return {
+        message: result,
+      }
+    } catch (error) {
+      logger.error('Lightpanda fetch failed', { error })
+      throw new Error(`Failed to fetch page: ${error}`)
+    }

231-233: Improve process cleanup as suggested in previous reviews.

The current cleanup approach may not handle all scenarios properly.

Apply the improved cleanup logic:

      // Stop Lightpanda's CDP Server
-     lpProcess.stdout.destroy()
-     lpProcess.stderr.destroy()
-     lpProcess.kill()
+     if (lpProcess && !lpProcess.killed) {
+       lpProcess.kill('SIGTERM')
+       
+       // Give process time to gracefully shutdown
+       await new Promise(resolve => setTimeout(resolve, 1000))
+       
+       // Force kill if still running
+       if (!lpProcess.killed) {
+         lpProcess.kill('SIGKILL')
+       }
+     }

Also add cleanup in the catch block:

    } catch (e: any) {
+     // Ensure process cleanup on error
+     if (lpProcess && !lpProcess.killed) {
+       lpProcess.kill('SIGKILL')
+     }
      throw new Error(e)
    }
🧹 Nitpick comments (1)
docs/guides/introduction.mdx (1)

72-72: Consider adding the missing article for better readability.

The static analysis tool correctly identifies a missing article. Consider this minor improvement:

-| [Lightpanda](/guides/examples/lightpanda)                                     | Use Lightpanda browser (or cloud version) to get a webpage's content.                                                                                |
+| [Lightpanda](/guides/examples/lightpanda)                                     | Use Lightpanda browser (or the cloud version) to get a webpage's content.                                                                                |
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6ded313 and 60f3357.

⛔ Files ignored due to path filters (3)
  • docs/images/intro-lightpanda.jpg is excluded by !**/*.jpg
  • references/v3-catalog/src/trigger/lightpandaTask.ts is excluded by !references/**
  • references/v3-catalog/trigger.config.ts is excluded by !references/**
📒 Files selected for processing (11)
  • .changeset/rare-mails-fail.md (1 hunks)
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam._index/route.tsx (1 hunks)
  • docs/config/config-file.mdx (1 hunks)
  • docs/config/extensions/lightpanda.mdx (1 hunks)
  • docs/config/extensions/overview.mdx (1 hunks)
  • docs/docs.json (2 hunks)
  • docs/guides/examples/lightpanda.mdx (1 hunks)
  • docs/guides/introduction.mdx (1 hunks)
  • docs/introduction.mdx (2 hunks)
  • packages/build/package.json (3 hunks)
  • packages/build/src/extensions/lightpanda.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
  • docs/config/extensions/overview.mdx
  • docs/config/config-file.mdx
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam._index/route.tsx
  • docs/docs.json
  • .changeset/rare-mails-fail.md
  • docs/introduction.mdx
  • docs/config/extensions/lightpanda.mdx
  • packages/build/package.json
🧰 Additional context used
🪛 LanguageTool
docs/guides/examples/lightpanda.mdx

[uncategorized] ~93-~93: Possible missing comma found.
Context: ...iki/ISO_3166-1_alpha-2) country code. Example using a German IP : ```wss://cloud.li...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~104-~104: A comma might be missing here.
Context: ... using Lightpanda Using the Lightpanda binary we will dump the HTML for a provided UR...

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)


[grammar] ~109-~109: The word “Setup” is a noun. The verb is spelled with a space.
Context: ...ggering the task. ### Prerequisites - Setup the [Lightpanda build extension](/confi...

(NOUN_VERB_CONFUSION)


[uncategorized] ~149-~149: Do not mix variants of the same word (‘initialise’ and ‘initialize’) within a single text.
Context: ... use a Lightpanda CDP server This task initialises a Lightpanda CDP server to allow you to...

(EN_WORD_COHERENCY)


[grammar] ~152-~152: The word “Setup” is a noun. The verb is spelled with a space.
Context: ...y via Trigger.dev. ### Prerequisites - Setup the [Lightpanda build extension](/confi...

(NOUN_VERB_CONFUSION)


[style] ~155-~155: Consider a more concise word here.
Context: ...ask will have to launch a child process in order to have the websocket available to scrape ...

(IN_ORDER_TO_PREMIUM)

docs/guides/introduction.mdx

[uncategorized] ~72-~72: You might be missing the article “the” here.
Context: ... | Use Lightpanda browser (or cloud version) to get a web...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

🔇 Additional comments (1)
docs/guides/examples/lightpanda.mdx (1)

1-246: Excellent comprehensive documentation, but security issues need attention.

This is a very well-structured guide that provides three practical examples for different Lightpanda usage patterns. The documentation is thorough and will be valuable for users.

However, the security concerns from previous reviews still need to be addressed before this goes live.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (4)
docs/guides/examples/lightpanda.mdx (4)

51-55: URL validation still missing – integrate validateUrl helper

The simple null/undefined guard does not protect against malformed or malicious URLs. Re-use the validateUrl helper previously suggested to ensure type checking, protocol enforcement, and proper error messaging.


129-135: execSync call remains vulnerable to command injection & lacks error handling

payload.url is interpolated directly into the shell string, exposing command-injection risk and omitting any error capture. Reapply the earlier guidance: validate the URL, use array-style arguments or JSON.stringify, and wrap the execution in try/catch with robust logging.


183-188: URL validation still missing in CDP task

Same issue as above—use the shared validateUrl helper instead of the basic null/undefined check.


214-219: Graceful Lightpanda CDP process cleanup required

A single lpProcess.kill() risks leaving zombies or hanging if the process ignores the signal. Reuse the previously suggested SIGTERM → delay → SIGKILL pattern and ensure cleanup in the catch path.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 60f3357 and c7cb791.

📒 Files selected for processing (7)
  • .changeset/empty-dolls-judge.md (1 hunks)
  • .changeset/rare-mails-fail.md (1 hunks)
  • docs/config/extensions/lightpanda.mdx (1 hunks)
  • docs/config/extensions/overview.mdx (0 hunks)
  • docs/docs.json (2 hunks)
  • docs/guides/examples/lightpanda.mdx (1 hunks)
  • docs/guides/introduction.mdx (1 hunks)
💤 Files with no reviewable changes (1)
  • docs/config/extensions/overview.mdx
✅ Files skipped from review due to trivial changes (1)
  • .changeset/empty-dolls-judge.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • docs/docs.json
  • docs/guides/introduction.mdx
  • docs/config/extensions/lightpanda.mdx
  • .changeset/rare-mails-fail.md
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to trigger.config.ts : Build extensions such as `additionalFiles`, `additionalPackages`, `aptGet`, `emitDecoratorMetadata`, `prismaExtension`, `syncEnvVars`, `puppeteer`, `ffmpeg`, and `esbuildPlugin` must be configured in `trigger.config.ts` as shown.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : ALWAYS generate Trigger.dev tasks using the `task` function from `@trigger.dev/sdk/v3` and export them as shown in the correct pattern.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : You MUST use `@trigger.dev/sdk/v3` when writing Trigger.dev tasks.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to trigger.config.ts : Global lifecycle hooks, telemetry, runtime, machine settings, log level, max duration, and build configuration must be set in `trigger.config.ts` as shown.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to trigger.config.ts : The `trigger.config.ts` file must use `defineConfig` from `@trigger.dev/sdk/v3` and follow the configuration structure shown.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : If you are able to generate an example payload for a task, do so.
docs/guides/examples/lightpanda.mdx (9)

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : ALWAYS generate Trigger.dev tasks using the task function from @trigger.dev/sdk/v3 and export them as shown in the correct pattern.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : If you are able to generate an example payload for a task, do so.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : When triggering a task from backend code, use tasks.trigger, tasks.batchTrigger, or tasks.triggerAndPoll as shown in the examples.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : When implementing scheduled (cron) tasks, use schedules.task from @trigger.dev/sdk/v3 and follow the shown patterns.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : When implementing schema tasks, use schemaTask from @trigger.dev/sdk/v3 and validate payloads as shown.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : When using retry, queue, machine, or maxDuration options, configure them as shown in the examples for Trigger.dev tasks.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : You MUST use @trigger.dev/sdk/v3 when writing Trigger.dev tasks.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : When using lifecycle hooks (init, cleanup, onStart, onSuccess, onFailure, handleError), implement them as shown in the examples for Trigger.dev tasks.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : When triggering a task from inside another task, use yourTask.trigger, yourTask.batchTrigger, yourTask.triggerAndWait, yourTask.batchTriggerAndWait, batch.triggerAndWait, batch.triggerByTask, or batch.triggerByTaskAndWait as shown.

@nicktrn
Copy link
Collaborator

nicktrn commented Jul 28, 2025

Thanks again for this @nrigaudiere 🙏

@nicktrn nicktrn merged commit 5ea6605 into triggerdotdev:main Jul 28, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants