Skip to content
Open
Show file tree
Hide file tree
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
73 changes: 73 additions & 0 deletions components/screenshotbase/actions/capture/capture.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import screenshotbase from "../../screenshotbase.app.mjs";
import { axios } from "@pipedream/platform";

export default {
key: "screenshotbase-take",
name: "Take Screenshot",
description: "Render a website screenshot or PDF via Screenshotbase.",
version: "0.1.1",
type: "action",
props: {
screenshotbase,
url: {
label: "URL",
type: "string",
description: "Website to render",
optional: false,
},
width: {
type: "integer",
label: "Width",
optional: true,
default: 1280,
},
height: {
type: "integer",
label: "Height",
optional: true,
default: 800,
},
format: {
type: "string",
label: "Format",
description: "png | jpeg | pdf",
optional: true,
options: ["png", "jpeg", "pdf"],
},
fullPage: {
type: "boolean",
label: "Full Page",
optional: true,
},
waitForSelector: {
type: "string",
label: "Wait for CSS Selector",
optional: true,
},
omitBackground: {
type: "boolean",
label: "Transparent Background",
optional: true,
},
Comment on lines +42 to +51
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Declared props are not sent to the API.

The waitForSelector and omitBackground props are declared but never included in the params object (lines 55-61), meaning users who configure these options will expect them to work but they won't be sent to the Screenshotbase API.

Apply this diff to include the missing parameters:

     const params = {
       url: this.url,
       viewport_width: this.width,
       viewport_height: this.height,
       format: this.format,
       full_page: this.fullPage ? 1 : undefined,
+      wait_for_selector: this.waitForSelector,
+      omit_background: this.omitBackground ? 1 : undefined,
     };

Verify the correct parameter names with the Screenshotbase API documentation, as I've assumed snake_case naming convention based on other parameters.


🏁 Script executed:

#!/bin/bash
grep -nR "const params" -n components/screenshotbase/actions/capture/capture.mjs
sed -n '1,200p' components/screenshotbase/actions/capture/capture.mjs | sed -n '50,80p'

Length of output: 550


Pass declared props to the API

Add the missing wait_for_selector and omit_background parameters so user‐configured options are sent:

   const params = {
     url: this.url,
     viewport_width: this.width,
     viewport_height: this.height,
     format: this.format,
     full_page: this.fullPage ? 1 : undefined,
+    wait_for_selector: this.waitForSelector,
+    omit_background: this.omitBackground ? 1 : undefined,
   };

Verify the exact parameter names against the Screenshotbase API docs.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
waitForSelector: {
type: "string",
label: "Wait for CSS Selector",
optional: true,
},
omitBackground: {
type: "boolean",
label: "Transparent Background",
optional: true,
},
const params = {
url: this.url,
viewport_width: this.width,
viewport_height: this.height,
format: this.format,
full_page: this.fullPage ? 1 : undefined,
wait_for_selector: this.waitForSelector,
omit_background: this.omitBackground ? 1 : undefined,
};
🤖 Prompt for AI Agents
In components/screenshotbase/actions/capture/capture.mjs around lines 42-51, the
declared action props waitForSelector and omitBackground are defined but not
passed to the Screenshotbase API; update the code that builds the API request
payload to include wait_for_selector (from waitForSelector) and omit_background
(from omitBackground) using the exact parameter names from the Screenshotbase
docs, ensuring optional props are only added when present and mapping camelCase
to snake_case.

},
async run({ steps, $ }) {
const base = this.screenshotbase.baseUrl();
const params = {
url: this.url,
viewport_width: this.width,
viewport_height: this.height,
format: this.format,
full_page: this.fullPage ? 1 : undefined,
};
const res = await axios($, {
method: "GET",
url: `${base}/v1/take`,
headers: { apikey: this.screenshotbase.$auth.api_key },
params,
});
$.export("result", res);
return res;
},
};


40 changes: 40 additions & 0 deletions components/screenshotbase/actions/take_advanced/take_advanced.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import screenshotbase from "../../screenshotbase.app.mjs";
import { axios } from "@pipedream/platform";

export default {
key: "screenshotbase-take-advanced",
name: "Take Screenshot (Advanced)",
description: "Render a website with full set of parameters (format, quality, full_page, viewport)",
version: "0.1.0",
type: "action",
props: {
screenshotbase,
url: { label: "URL", type: "string", optional: false },
format: { label: "Format", type: "string", optional: true, options: ["jpg", "jpeg", "png", "gif"] },
quality: { label: "Quality (jpg/jpeg only)", type: "integer", optional: true },
full_page: { label: "Full Page", type: "boolean", optional: true },
viewport_width: { label: "Viewport Width", type: "integer", optional: true, default: 1280 },
viewport_height: { label: "Viewport Height", type: "integer", optional: true, default: 800 },
},
async run({ $ }) {
const base = this.screenshotbase.baseUrl();
const params = {
url: this.url,
format: this.format,
quality: this.quality,
full_page: this.full_page ? 1 : undefined,
viewport_width: this.viewport_width,
viewport_height: this.viewport_height,
};
const res = await axios($, {
method: "GET",
url: `${base}/v1/take`,
headers: { apikey: this.screenshotbase.$auth.api_key },
params,
});
$.export("result", res);
return res;
},
};


36 changes: 36 additions & 0 deletions components/screenshotbase/actions/take_html/take_html.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import screenshotbase from "../../screenshotbase.app.mjs";
import { axios } from "@pipedream/platform";

export default {
key: "screenshotbase-take-html",
name: "Take from HTML",
description: "Render a screenshot from raw HTML (served by Screenshotbase)",
version: "0.1.0",
type: "action",
props: {
screenshotbase,
html: { label: "HTML", type: "string", optional: false },
viewport_width: { label: "Viewport Width", type: "integer", optional: true, default: 800 },
viewport_height: { label: "Viewport Height", type: "integer", optional: true, default: 400 },
format: { label: "Format", type: "string", optional: true, options: ["jpg", "jpeg", "png", "gif"] },
},
async run({ $ }) {
const base = this.screenshotbase.baseUrl();
const params = {
html: this.html,
format: this.format,
viewport_width: this.viewport_width,
viewport_height: this.viewport_height,
};
const res = await axios($, {
method: "GET",
url: `${base}/v1/take`,
headers: { apikey: this.screenshotbase.$auth.api_key },
params,
});
$.export("result", res);
return res;
},
};


35 changes: 35 additions & 0 deletions components/screenshotbase/actions/take_pdf/take_pdf.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import screenshotbase from "../../screenshotbase.app.mjs";
import { axios } from "@pipedream/platform";

export default {
key: "screenshotbase-take-pdf",
name: "Take PDF",
description: "Render a PDF from a website URL",
version: "0.1.0",
type: "action",
props: {
screenshotbase,
url: { label: "URL", type: "string", optional: false },
viewport_width: { label: "Viewport Width", type: "integer", optional: true, default: 1280 },
viewport_height: { label: "Viewport Height", type: "integer", optional: true, default: 800 },
},
async run({ $ }) {
const base = this.screenshotbase.baseUrl();
const params = {
url: this.url,
format: "pdf",
viewport_width: this.viewport_width,
viewport_height: this.viewport_height,
};
const res = await axios($, {
method: "GET",
url: `${base}/v1/take`,
headers: { apikey: this.screenshotbase.$auth.api_key },
params,
});
$.export("result", res);
return res;
},
};


38 changes: 38 additions & 0 deletions components/screenshotbase/screenshotbase.app.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
export default {
type: "app",
app: "screenshotbase",
name: "Screenshotbase",
propDefinitions: {},
auth: {
type: "custom",
fields: {
api_key: {
label: "API Key",
description: "Get your key from the Screenshotbase dashboard.",
type: "string",
},
base_url: {
label: "Base URL (optional)",
type: "string",
optional: true,
description: "Override API base, defaults to https://api.screenshotbase.com",
},
},
test: {
request: {
url: "https://api.screenshotbase.com/status",
headers: {
apikey: "{{auth.api_key}}",
},
},
},
Comment on lines +21 to +28
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Test ignores custom base_url.

The test block hardcodes https://api.screenshotbase.com/status even when the user provides a custom base_url in the auth configuration. This will cause false negatives for users with custom base URLs, as the connection test will always validate against the default endpoint rather than their configured one.

Apply this diff to respect the user's base_url configuration:

     test: {
       request: {
-        url: "https://api.screenshotbase.com/status",
+        url: "{{auth.base_url || 'https://api.screenshotbase.com'}}/status",
         headers: {
           apikey: "{{auth.api_key}}",
         },
       },
     },

Note: If the test endpoint path differs between environments, you may need to adjust the template accordingly.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
test: {
request: {
url: "https://api.screenshotbase.com/status",
headers: {
apikey: "{{auth.api_key}}",
},
},
},
test: {
request: {
url: "{{auth.base_url || 'https://api.screenshotbase.com'}}/status",
headers: {
apikey: "{{auth.api_key}}",
},
},
},
🤖 Prompt for AI Agents
In components/screenshotbase/screenshotbase.app.mjs around lines 21 to 28, the
test request currently hardcodes the default status URL; change it to build the
URL from the user's configured base_url with a fallback to the default (e.g. use
auth.base_url if present otherwise https://api.screenshotbase.com, then append
the /status path, taking care to avoid double slashes), leaving the apikey
header intact so the connection test runs against the user's base_url when
provided.

connectionLabel: "Screenshotbase",
},
methods: {
baseUrl() {
return this.$auth.base_url?.trim() || "https://api.screenshotbase.com";
},
},
};