If Puppeteer PDF generation times out in a Firebase Function, first identify which layer is expiring: page.pdf(), navigation or another Puppeteer wait, browser startup, or the Firebase function itself. Puppeteer’s PDF and page-wait APIs commonly default to 30 seconds, while Firebase’s maximum runtime depends on the trigger type. Set explicit, measured timeouts below the platform ceiling, make page readiness predictable, verify Chrome is packaged, and close the browser in a finally block.
Find out which timeout is expiring
A message that says “timed out” does not by itself identify the failing layer. Add timestamps before and after each expensive operation: puppeteer.launch(), page.goto(), every waitFor* call, page.pdf(), and browser.close(). Log the operation name and elapsed time so you can compare the failure with the relevant timeout.
- About 30 seconds: inspect Puppeteer’s operation defaults first. PDF options and page wait APIs document 30-second defaults. Puppeteer PDFOptions and Puppeteer Page API.
- Near the configured function limit: check Firebase’s runtime configuration and trigger type. The platform may be stopping the invocation, regardless of a larger Puppeteer timeout. Firebase: Manage functions.
- Before navigation begins: investigate browser launch and whether the deployed function contains the expected Chrome files. Puppeteer: Cloud Functions.
Do not start by increasing every timeout. A long timeout can hide a wait condition that will never complete, while a Puppeteer timeout cannot extend Firebase’s platform limit.
Know the two timeout budgets
Puppeteer operation timeouts
Puppeteer documents a 30,000 ms default for page.pdf(). The default can be changed with Page.setDefaultTimeout(), or overridden for an individual PDF call using its timeout option. Navigation and many wait operations also default to 30 seconds; their timeout can be set per call or through page defaults. For those wait APIs, 0 disables the Puppeteer timeout. See the PDFOptions API and Page API.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →#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.
Setting page.pdf({ timeout: 0 }) removes that particular Puppeteer deadline; it does not make the Firebase invocation unlimited. In a serverless function, an operation that runs too long can still be cut off by the enclosing platform.
Firebase function runtime limits
Firebase’s current management documentation lists maximum durations by trigger type. These are platform ceilings, not recommended target durations or guarantees that a particular PDF will finish:
| Function type | Documented maximum runtime | Source |
|---|---|---|
| HTTP and callable | 3,600 seconds (60 minutes) | Firebase management documentation |
| Scheduled and task-queue | 1,800 seconds (30 minutes) | Firebase management documentation |
| Other event-driven functions; applicable first-generation functions | 540 seconds (9 minutes) | Firebase management documentation; RuntimeOptions reference |
The RuntimeOptions reference describes its timeout values as 0 to 540 seconds. Check the documentation for your specific generation and trigger rather than applying that figure to every function: Firebase’s management page lists longer limits for HTTP/callable and scheduled/task-queue functions. Configure the timeout using the runtime options supported by the SDK generation you deploy.
Set a deliberate runtime and operation budget
Give the Firebase function enough time for launch, page loading, readiness checks, PDF creation, and cleanup. Keep each operation’s timeout inside the overall function budget, with time remaining to handle errors and close Chrome. Measure actual invocations across representative documents; there is no documented universal timeout or memory value that guarantees every PDF workload.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsRank #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.
For second-generation HTTPS functions, timeoutSeconds and memory are set in the options passed to onRequest. The following is an illustrative starting point, not a universal setting. Its 300-second runtime and 60-second operation limits must be adjusted to your trigger ceiling and measured workload.
const { onRequest } = require('firebase-functions/v2/https');
const puppeteer = require('puppeteer');
exports.renderPdf = onRequest(
{ timeoutSeconds: 300, memory: '1GiB' },
async (req, res) => {
let browser;
try {
browser = await puppeteer.launch({ timeout: 60000 });
const page = await browser.newPage();
page.setDefaultNavigationTimeout(60000);
await page.goto(req.body.url, {
waitUntil: 'domcontentloaded',
timeout: 60000,
});
await page.pdf({
path: '/tmp/output.pdf',
format: 'A4',
timeout: 60000,
printBackground: true,
});
res.send('ok');
} finally {
if (browser) await browser.close();
}
}
);
Use this pattern only with suitable request validation and error handling for your application. In particular, do not allow arbitrary, untrusted URLs to turn a PDF endpoint into an unrestricted browser or network proxy. The Firebase management guide and RuntimeOptions reference cover runtime configuration; the Puppeteer APIs document operation-level controls.
Make navigation and page readiness predictable
Choose a wait condition that matches the page
page.goto() can wait for different milestones. domcontentloaded returns when the document has been parsed, but it does not establish that an application has finished rendering its final content. If the page uses client-side rendering, wait for a specific application signal or a selector that indicates the document is ready. Give that wait a finite timeout and log it separately.
Broad network-idle conditions can be a poor fit for pages that keep analytics, polling, chat, or other requests open. Puppeteer’s PDF guide shows navigation using networkidle2, but that example is not a requirement for every page. Choose the least restrictive readiness condition that still ensures the content you need is present. Puppeteer: PDF generation.
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.
Account for fonts and assets
page.pdf() waits for fonts to load by default. A slow remote font or other external asset can therefore extend PDF creation even after navigation has returned. The official PDF guide documents this behavior. Where you control the page, consider self-hosting or preloading fonts and assets, then wait for an application-level readiness signal. Avoid disabling a wait blindly if the resulting PDF must include those fonts. Puppeteer: PDF generation.
Budget for the whole pipeline
PDF work is not limited to the final page.pdf() call. A useful timing log records launch duration, navigation duration and outcome, readiness-wait duration, PDF duration, and cleanup duration. If the page itself is slow, raising only the PDF timeout will not fix a navigation timeout; if rendering is slow because of fonts, changing page.goto() alone will not solve it.
Ensure Chrome is present in the deployed function
A function that works locally can fail or stall during startup if the deployed artifact does not contain the browser executable Puppeteer expects. Puppeteer’s Cloud Functions guidance recommends configuring its cache directory under node_modules, where the deployment packaging can include the cached browser files. Follow the current instructions for your Puppeteer version and deployment setup, then inspect the deployed artifact or build output to confirm the expected executable is present. Puppeteer: Cloud Functions.
Do not assume that installing the JavaScript package alone guarantees a browser will be available in the production runtime. Check the precise launch error and the deployed cache location before increasing the launch timeout: waiting longer cannot repair a missing executable.
Recommended Free Tools
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
Close the browser on success and failure
Put browser.close() in a finally block so it runs if navigation, a selector wait, or PDF generation throws. The official Puppeteer PDF workflow closes the browser after generating the document. Cleanup reduces the chance that a failed request leaves browser processes around and adds latency to later work. Puppeteer: PDF generation.
Allow enough time for cleanup within the function’s runtime budget. If browser.close() itself is taking a long time, log that separately; do not let an unobserved cleanup wait look like a PDF timeout.
Troubleshoot by the error and elapsed time
| Symptom | Likely layer | What to check |
|---|---|---|
TimeoutError: Timed out after 30000 ms while waiting for… |
A Puppeteer operation using its documented 30-second default | Identify the named API in the error and logs. Set a suitable timeout for that navigation, wait, or PDF call; verify its condition can actually complete. PDFOptions; Page API. |
Launch hangs or Could not find expected browser locally |
Browser startup or deployment packaging | Check Puppeteer’s cache placement and confirm the expected browser files are included in the deployed artifact. Cloud Functions guidance. |
| The invocation ends near 540 seconds | Firebase runtime ceiling for applicable event-driven or first-generation cases | Verify function generation, trigger type, and configured runtime. Do not infer the limit from the trigger’s name alone. Management documentation; RuntimeOptions reference. |
| An HTTP request stops despite a larger Puppeteer timeout | Firebase runtime configuration or HTTP ceiling | Confirm it is an HTTP/callable function and that timeoutSeconds is set within the documented 3,600-second maximum. Management documentation. |
| Navigation completes, but PDF generation stalls | PDF work, fonts, or assets | Log the PDF call independently; remember that fonts are awaited by default. Inspect font and asset loading and use the PDF timeout option appropriate to the workload. PDF generation guide; PDFOptions. |
| Navigation or a selector wait consumes the budget | Readiness condition is too broad or never becomes true | Log the individual wait, use a condition tied to the page’s real readiness, and set a finite timeout rather than waiting indefinitely. Page API. |
Tune performance, reliability, and cost from measurements
There is no universal memory allocation or completion-time benchmark established for all Puppeteer PDF workloads. A simple page and a document with many images, remote fonts, scripts, or concurrent rendering requests do not have the same resource needs. Record duration and failures by stage, and tune memory, timeout, and concurrency using the documents your function actually processes.
- Trigger ceiling: identify the function generation and trigger before selecting an overall timeout.
- Startup reliability: verify browser cache placement and the deployed executable rather than treating every launch delay as a timeout setting problem.
- Readiness: prefer a specific app-ready signal over an unnecessarily broad network-idle wait.
- Complexity: measure representative document size, asset count, and font behavior.
- Concurrency and cleanup: observe overlapping work and ensure each invocation closes its browser in all outcomes.
Increasing the function’s memory or runtime can be appropriate when measurements show resource pressure or legitimate work duration, but neither is a substitute for fixing a missing browser, a never-satisfied selector, or an unnecessary wait.
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.
Or skip the browser setup
If your goal is to capture a web page as a PDF rather than run your own Chromium-based rendering pipeline, ScreenshotNeo offers a one-request API. See the ScreenshotNeo documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.pdf
Request a PDF response using the API’s PDF options in the documentation. ScreenshotNeo accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots. ScreenshotNeo.
Sign up for ScreenshotNeo’s free plan and get 1,000 screenshots a month with no card.
Frequently Asked Questions
Does setting the PDF timeout to zero make a Firebase PDF job unlimited?
No. It disables Puppeteer’s timeout for that PDF operation, but the Firebase function remains subject to its configured runtime and platform ceiling.
Free tools Windows power users keep installed
One-click scans. No signup required.
Why does Puppeteer wait for fonts during PDF generation?
Puppeteer waits for fonts by default so they can be available to the generated PDF; slow remote fonts can add time to the PDF call.
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.

