Recommended Free Tools
You can run a Puppeteer screenshot script in an HTTP-triggered Google Cloud function by deploying a Node.js handler with Puppeteer as a dependency, ensuring Chrome is available in the build, and setting the function’s entry point, region, trigger, memory, and timeout. This guide targets a second-generation Cloud Run function, the current Google Cloud functions experience; check the deployment and runtime documentation for current generation-specific options before deploying.
What you need to decide before deploying
- Function generation and runtime: Google’s current functions documentation uses the Cloud Run functions name, while first-generation functions and the
gcloud functionscommand remain relevant. Runtime availability changes; check Google’s runtime support table and select a supported Node.js runtime for your generation. - Screenshot delivery: This example returns a PNG in the HTTP response. For larger screenshots, repeated retrieval, or asynchronous jobs, store the result in a storage service and return a reference instead.
- Endpoint access: The sample is an HTTP function. Decide whether it should be publicly callable or restricted, and configure the trigger and access policy accordingly.
- URL safety: Do not expose an unrestricted screenshot endpoint that fetches arbitrary URLs without an SSRF and abuse-control policy. Validate destinations and restrict access as appropriate for your use case.
Prepare the project and install Puppeteer
The puppeteer package downloads a compatible Chrome for Testing browser during installation. puppeteer-core does not install Chrome; use it only when you will manage the browser executable or connection yourself. For the simplest deployment, this example uses puppeteer.
Create a project directory and add the following files. The Functions Framework supplies the HTTP handler interface expected by the deployment platform.
package.json
{
"name": "puppeteer-screenshot-function",
"version": "1.0.0",
"private": true,
"main": "index.js",
"scripts": {
"start": "functions-framework --target=screenshot"
},
"dependencies": {
"@google-cloud/functions-framework": "^3.0.0",
"puppeteer": "^24.0.0"
}
}
These version ranges illustrate the dependency declarations; choose versions that meet your project’s compatibility and reproducibility requirements, and commit the lockfile your package manager generates. The Google deployment documentation is at Deploy a function.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
.puppeteerrc.js
module.exports = {
cacheDirectory: './node_modules/.puppeteer_cache'
};
Puppeteer’s Cloud Functions troubleshooting guidance recommends putting the browser cache under node_modules/.puppeteer_cache. This can help when a cached node_modules build does not rerun Puppeteer’s install step. Confirm that your selected build pipeline actually installs Puppeteer’s browser or preserves this cache; a JavaScript dependency alone is not proof that Chrome is present.
Write the HTTP screenshot handler
Save this as index.js. It validates the input, opens a browser, navigates to the requested URL, captures a PNG, and closes Chrome whether the operation succeeds or fails. The deployment entry point must match the exported function name, screenshot.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
const functions = require('@google-cloud/functions-framework');
const puppeteer = require('puppeteer');
functions.http('screenshot', async (req, res) => {
const url = req.query.url || (req.body && req.body.url);
if (typeof url !== 'string' || url.length === 0) {
return res.status(400).json({ error: 'Provide a URL in the url query parameter or JSON body.' });
}
let browser;
try {
const parsed = new URL(url);
if (!['http:', 'https:'].includes(parsed.protocol)) {
return res.status(400).json({ error: 'Only http and https URLs are supported.' });
}
browser = await puppeteer.launch({ headless: true });
const page = await browser.newPage();
await page.goto(parsed.href, { waitUntil: 'networkidle2', timeout: 45000 });
const image = await page.screenshot({ type: 'png', fullPage: true });
res.set('Content-Type', 'image/png');
res.status(200).send(image);
} catch (error) {
console.error('Screenshot failed:', error);
res.status(500).json({ error: 'Screenshot capture failed.' });
} finally {
if (browser) {
await browser.close();
}
}
});
networkidle2, the 45-second navigation timeout, and full-page PNG capture are example choices, not universal requirements. Some sites keep network connections open, load content after navigation, or need a selector-based wait; adjust the wait strategy and screenshot options to your script. For sensitive deployments, return a generic error to callers, as above, and keep detailed diagnostics in logs.
Deploy the function
Install and initialize the Google Cloud CLI, select the intended project, and use a supported runtime and region. The command below illustrates a second-generation HTTP function; replace the project, region, and runtime with values valid for your account and current runtime table. Google’s gcloud functions deploy reference documents the available flags and generation-specific behavior.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
gcloud functions deploy screenshot
--gen2
--runtime=nodejs22
--source=.
--entry-point=screenshot
--region=us-central1
--trigger-http
--memory=1GiB
--timeout=120s
The runtime value shown is an example, not a timeless recommendation. Google’s runtime support list retrieved on October 3, 2026 included Node.js 24 for Cloud Run functions and Node.js 22 for both first-generation and Cloud Run functions; check that live table before deploying. The trigger flag makes the function HTTP-triggered; configure public invocation or authentication deliberately rather than assuming a particular access policy.
Set memory and timeout for the workload
Google’s deploy reference states that the default timeout for a new function is 60 seconds and that first-generation functions have a maximum timeout of 540 seconds. Browser startup, navigation, page scripts, and image creation all consume invocation time. Set a timeout that fits representative pages and the selected generation. No single memory minimum is established for Puppeteer screenshots; test the pages and capture dimensions you expect, then adjust resources if the function runs out of memory or fails to start.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Call the deployed function and handle its output
Once deployment completes, use the URL reported by the CLI. If the function requires authentication, include an authorized identity token; do not make it public solely to simplify a test.
curl -L "FUNCTION_URL?url=https%3A%2F%2Fexample.com" -o screenshot.png
A successful response from this handler has the image/png content type and image bytes in its body. The function does not save a copy elsewhere. For large full-page captures or work that may outlast a synchronous request, persist the image and return a storage reference instead of sending all bytes directly to the caller.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Troubleshoot deployment and runtime failures
“Could not find Chrome” or browser launch fails
- Inspect build logs to confirm that the
puppeteerdependency installed and its browser download completed. - Check that the project-root
.puppeteerrc.jsis included in the deployed source and that the build process retains the configured cache path. - If your pipeline caches
node_modules, verify that it did not skip Puppeteer’s install step while leaving the browser cache empty. Rebuild with the install step enabled or use a build configuration that preserves the browser download. - If you chose
puppeteer-core, provide and maintain a compatible Chrome executable or supported browser connection yourself.
Build succeeds but the function does not become ready
- Check Cloud Build logs for dependency, packaging, and browser installation errors first.
- Then inspect Cloud Logging for startup health-check errors. Confirm that
--entry-point=screenshotmatches the exported handler. - Look for exceptions, crashes, or long-running work in global scope. Google identifies initialization exceptions, crashes, and timeouts as causes of startup readiness failures; keep browser work inside the request handler.
- If logs indicate resource exhaustion during startup, test with more resources or a longer timeout. The suitable values depend on the workload.
Navigation times out or captures an incomplete page
- Check whether the site is reachable from the function and whether it blocks automated traffic or depends on authentication, cookies, or geolocation.
- Try a wait condition suited to the page: network-idle waits may not finish on sites with persistent connections, while a selector or a deliberate delay may better represent readiness.
- Test the same target with the same viewport and page conditions locally, then compare logs and invocation duration in the deployed function.
The caller receives an error or cannot invoke the function
- A 400 response means the request did not contain a non-empty
urlvalue or used an unsupported protocol. - A 500 response means capture raised an error; inspect Cloud Logging for the underlying detail.
- An authorization failure usually means the caller lacks permission under the function’s access policy. Grant the required identity access or deliberately change the policy after considering exposure risks.
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server. Instead of packaging Chrome and maintaining a function, send one GET request; the parameter names used by other screenshot APIs also work. See the ScreenshotNeo API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo removes cookie and consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Its MCP server lets AI agents use screenshot tools, and the free plan includes 1,000 screenshots a month without a card; paid plans start at $5 for 3,000 screenshots. Sign up for 1,000 free screenshots a month with no card.
Frequently Asked Questions
Can Google Cloud Functions run headless Chrome?
Yes. Puppeteer’s guidance says the Node.js runtime of Google Cloud Functions has the system packages needed to run Headless Chrome; the browser binary still needs to be installed or managed as described above.
Should I use puppeteer or puppeteer-core?
Use puppeteer when you want its installation process to download a compatible Chrome for Testing browser. Choose puppeteer-core when you will supply or connect to a browser yourself.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWhy does Puppeteer work locally but say Chrome is missing after deployment?
The deployed build may have installed the Node package without running or preserving Puppeteer’s browser installation. Check the build logs, cache directory, and whether your build pipeline skips install scripts.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

