To deploy a Node.js app that creates PDFs with Playwright to Azure App Service, make the server listen on process.env.PORT, deploy Playwright as an application dependency, and ensure the deployed environment has browser binaries matching that Playwright version plus the browser’s required operating-system libraries. Then verify startup and generate a PDF in the deployed app. App Service’s built-in Node.js runtime and a custom container are both possible approaches, but the available guidance does not establish a universally best configuration or plan size for PDF workloads.
What must work in production
A local Playwright installation can conceal deployment gaps. The Node.js package, browser executable, and Linux libraries needed to launch that browser are separate parts of the runtime. Deploy all of them—or use an environment that provides the browser and libraries—and keep the browser version aligned with the installed Playwright package.
- HTTP startup: the app binds to the port Azure supplies in
PORT, rather than relying on a hard-coded local port. See Microsoft’s Node.js App Service quickstart. - Production dependencies: your deployment method installs or includes Playwright so it is available to the running app.
- Browser runtime: the deployed process can access a compatible Playwright browser and its OS dependencies.
- PDF verification: the deployed endpoint returns a valid PDF for a representative request and handles errors without leaving browser processes unmanaged.
Microsoft’s App Service documentation covers Node.js configuration, startup, and deployment; Playwright’s documentation covers browser installation and its Docker image. None of these sources provides PDF-workload-specific performance, concurrency, plan-sizing, or cost thresholds. Validate those against your app and expected usage.
Choose a deployment approach
Built-in App Service Node.js runtime
This route uses App Service’s Node.js environment and your selected deployment pipeline. It may fit when you can reliably install the right Playwright browser and OS dependencies as part of deployment or startup. Confirm that the Node.js runtime you intend to use is currently offered for your operating system, subscription, and region; runtime availability can change. Microsoft explains runtime configuration in Configure Node.js apps in Azure App Service.
Free tools Windows power users keep installed
One-click scans. No signup required.
#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.
Custom container
A container gives the team control over the runtime image and how browser binaries and libraries are included. Playwright’s Docker documentation describes an image with browsers and their system dependencies, but the Playwright package itself must still be installed in the application. The documentation describes that image as intended for testing and development; it does not establish it as a production-ready App Service base image for every PDF application. Pin the image to a version compatible with the project’s Playwright package and validate the resulting container on App Service.
| Decision area | Built-in Node.js runtime | Custom container |
|---|---|---|
| Browser and library control | Establish how deployment provides the compatible browser and required libraries. | Define and maintain the image contents, including browser and library versions. |
| Dependency installation | Configure deployment build automation or ship dependencies in the artifact. | Install application dependencies while building the image. |
| Startup | Use the App Service start script, PM2, or a custom startup command that matches the app. | Configure the container’s startup command or entry point to launch the server. |
| Workload performance and cost | Not established by the cited guidance for PDF-generation workloads; measure in the target configuration. | |
Prepare the Node.js application
The example below is a small Express server that accepts a URL, asks Playwright to render it, and streams a PDF response. It demonstrates the deployment-critical details: binding to Azure’s port, launching a browser, and closing it even if PDF creation fails. It is a starting point, not a public URL-to-PDF service design: validate or restrict requested URLs before exposing an endpoint, and add authentication and resource controls appropriate to your use.
Install dependencies
npm install express playwright
Keep playwright in the production dependencies, not only in development dependencies, if the deployed server imports it at runtime. Use a lockfile and deploy it with the app so builds can reproduce the dependency tree. Playwright browser binaries are separately installed; after choosing the Playwright version, install its matching browser using the corresponding Playwright CLI and make the browser available to the runtime. Playwright documents version matching and the default Linux browser cache at Playwright: Browsers.
Create the server
Save as server.js:
const express = require('express');
const { chromium } = require('playwright');
const app = express();
app.use(express.json({ limit: '32kb' }));
app.post('/pdf', async (req, res) => {
const { url } = req.body || {};
if (typeof url !== 'string') {
return res.status(400).json({ error: 'Provide a URL string.' });
}
let browser;
try {
browser = await chromium.launch({ headless: true });
const page = await browser.newPage();
await page.goto(url, { waitUntil: 'networkidle', timeout: 30000 });
const pdf = await page.pdf({ format: 'A4', printBackground: true });
res.setHeader('Content-Type', 'application/pdf');
res.setHeader('Content-Disposition', 'inline; filename="page.pdf"');
return res.send(pdf);
} catch (error) {
console.error('PDF generation failed:', error);
if (!res.headersSent) {
return res.status(500).json({ error: 'PDF generation failed.' });
}
} finally {
if (browser) await browser.close().catch((error) => {
console.error('Browser close failed:', error);
});
}
});
const port = process.env.PORT || 3000;
app.listen(port, '0.0.0.0', () => {
console.log(`Server listening on ${port}`);
});
page.pdf() is the Playwright call that produces PDF bytes; the example selects A4 paper and asks to print background graphics. Tune navigation readiness and timeout for the pages you actually render. A fixed networkidle wait can be unsuitable for sites with long-lived requests; choose and test a readiness condition appropriate to your page rather than assuming every site reaches network idle.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteRank #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.
Set the start script
In package.json, ensure the app has a production start script:
{
"scripts": {
"start": "node server.js"
}
}
With App Service, startup can use a package start script, PM2, or a custom command. Microsoft’s Node.js configuration guidance says that on Node.js versions after Node 14 LTS, PM2 must be explicitly started with --no-daemon when using PM2; for example, pm2 start server.js --no-daemon. Use the startup method that matches the selected runtime and verify the process stays in the foreground as expected.
Install the matching Playwright browser
Adding playwright to package.json does not by itself prove that a deployed Linux process can launch its browser. Playwright requires browser binaries corresponding to the package version; Linux browser files are cached by default under ~/.cache/ms-playwright. Ensure deployment installs or preserves the matching browser and that the App Service process can read it. If you use a container, keep its Playwright browser version compatible with the application package. The Playwright Docker image includes browsers and system dependencies, not the package itself.
For a built-in runtime deployment, establish how the browser and operating-system dependencies enter the deployed environment, then test browser launch after deployment. For a container, define the image and install the project’s pinned dependencies within it. Do not assume a browser cache from a developer workstation will exist on Azure.
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.
Deploy the app to App Service
- Create or select the App Service app. Choose an operating system and a Node.js runtime currently available to your subscription and region. Confirm the runtime in the Azure portal or CLI at deployment time.
- Choose the deployment path. Microsoft documents Zip deployment and deployment of files with
az webapp deploy. Follow Deploy files to Azure App Service for the deployment method and command flow you use. - Configure build automation when relying on Azure to install packages. For Git or Zip deployment with build automation enabled, App Service installs production npm dependencies. If build automation is not enabled, do not assume that installation occurred.
- Include dependencies for FTP/S deployments. Microsoft’s Node.js configuration guidance says FTP/S deployment requires packages to be uploaded manually. Include the required production dependencies in the artifact.
- Set and verify startup. Ensure the start script or configured command points to the deployed entry point. Check logs for the expected listening message and startup errors.
- Verify browser availability and PDF output. Call the deployed endpoint with a safe test URL, check the response content type and open the returned PDF. Also test an invalid input and a page that takes longer to load.
Use your project’s actual App Service name, resource group, deployment package, and selected method in Azure commands; the cited documentation’s quickstart and deployment article provide the current command details. Avoid copying a deployment command without adapting those values.
Validate reliability, performance, and cost
PDF rendering launches a browser process and consumes resources beyond the HTTP handler itself. The cited Azure and Playwright instructions do not provide a supported concurrency number, memory threshold, timeout limit for this app, or App Service plan recommendation. Measure with representative pages and the concurrency you expect rather than treating a sample as capacity guidance.
- Record navigation and PDF-generation duration separately so slow page loading can be distinguished from rendering.
- Test a small and a large page, a page with delayed assets, and repeated requests; observe memory and process behavior in the selected App Service configuration.
- Set application-level timeouts and request limits deliberately. Ensure failed navigations return a useful error and the browser is closed in all paths.
- Consider whether requests can reach arbitrary URLs. An unrestricted renderer can be abused to access internal network destinations; apply an allowlist or other URL and network controls before accepting untrusted input.
- Re-test after changing the Node.js runtime, Playwright package, browser image, or App Service configuration because each may affect browser startup and output.
Troubleshoot common deployment failures
App starts locally but Azure reports an unavailable site
Check that the server binds to process.env.PORT and listens on 0.0.0.0, rather than binding only to localhost or a fixed development port. Inspect App Service startup logs and confirm that the configured start command targets the deployed entry point.
Cannot find Playwright or module errors at startup
Confirm playwright is a production dependency and that the deployed package includes the expected lockfile and application files. If using Git or Zip deployment, verify build automation is enabled when relying on App Service to install production packages. With FTP/S, upload the dependencies as required by Microsoft’s guidance.
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
Browser executable is missing
The package may be present while the version-matched browser is absent or stored somewhere the deployed process cannot access. Check the Playwright package and browser versions, install the matching browser, and confirm the process can read the Playwright browser cache. See Playwright’s browser installation guidance.
Browser launches locally but fails on Azure Linux
A required system library may be missing, or the runtime may differ from the environment used for development. Use an environment that provides the required browser libraries, such as a carefully validated container approach, and examine the browser-launch error rather than changing versions at random. Playwright’s Docker documentation describes its image contents and version compatibility constraints.
PDF requests time out or return an error
Separate navigation failure from PDF-generation failure in logs. A site may never meet the chosen load condition, or the configured navigation timeout may not match the page. Test a different readiness condition where appropriate, set a suitable timeout, and ensure the error handler returns a response while the finally block closes the browser. This article’s example uses a 30-second navigation timeout as code configuration, not as an Azure limit or performance guarantee.
Need browser-level diagnostic logs
Playwright documents DEBUG=pw:browser for browser-launch debugging. Enable it temporarily in a diagnostic deployment or environment setting, reproduce the failure, and review the resulting logs; avoid leaving verbose diagnostics enabled unnecessarily.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
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 the task is simply to capture a web page as an image or PDF rather than operate your own Playwright browser, ScreenshotNeo provides a screenshot API and MCP server. Its API makes a GET request with a URL; for example, this cURL request saves a WebP screenshot:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options and response details. ScreenshotNeo removes cookie/consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots per month with no card, and paid plans start at $5 for 3,000. Sign up free for ScreenshotNeo.
Frequently Asked Questions
Does the Playwright Docker image include the Playwright npm package?
No. The documented image includes browsers and their system dependencies; install the Playwright package separately in the app.
Can I use FTP/S deployment and expect App Service to install Playwright?
No. Microsoft’s Node.js guidance says FTP/S deployments require the needed packages to be uploaded manually.
Does the cited guidance specify an App Service plan for PDF generation?
No. It does not establish plan sizing, concurrency, performance, or cost thresholds for a particular PDF workload.
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.

