Over the past few days, I’ve been diving into using Azure Functions to implement synthetic monitoring with Playwright. The goal was simple: run browser automation tests every 30 minutes or 1 hour to monitor critical system functionalities. However, as with many cloud adventures, there were some surprises along the way.
1. Choosing the Right Plan
The first dilemma was: Consumption Plan or Premium Plan?
The Consumption Plan is cheap but does not support running browsers like Playwright because of strict sandbox limitations.
The Premium Plan eliminates cold starts, offers dedicated CPU/RAM, and allows running browsers — essential for automation tasks.
Within the Premium Plan, there are different SKUs: EP1, EP2, and EP3. For a proof of concept (POC) running tests every 30 minutes or 1 hour, EP1 (1 vCPU / 3.5 GB RAM) is enough and much cheaper (~$130–150/month). Heavier workloads require EP2 or EP3 with more CPU and memory.
I opted for EP1. This ensures Playwright runs stably, even when opening headless browsers.
2. Deployment Structure and “No Functions Found”
Initially, I deployed my Function App via .zip using Azure Pipeline and Release, including dist/, host.json, and other project folders. However, the logs showed:
0 functions found
I discovered that Azure Functions requires the function folder to be at the root of the deployment or correctly configured. In modern Functions (v4, JavaScript/TypeScript), each function file must use @azure/functions and host.json needs to be at the root.
To maintain my project structure (dist/functions, dist/support, dist/tests), the solution was to point the deployment to the root of dist and ensure host.json and .js function files were correctly located.
3. Playwright and Browsers
One of the biggest challenges was running Playwright on Azure.
Chromium works fine ✅
Firefox and WebKit fail ❌
Typical error:
Error: browserType.launch: spawn UNKNOWN
This happens because the Azure Functions Windows sandbox doesn’t provide all system dependencies Firefox/WebKit require.
Possible Solutions:
- Use Chromium only – works reliably and is sufficient for synthetic monitoring.
- Deploy via Linux Function App + --with-deps – installs necessary system libraries.
- Custom Container – a Docker image based on mcr.microsoft.com/playwright comes with Chromium, Firefox, and WebKit pre-installed with dependencies. This is ideal for production.
4. Environment Variables and Paths
To make Playwright locate the browser, I had to set:
PLAYWRIGHT_BROWSERS_PATH = 0
This ensures the Azure Function looks for browsers in the correct location in node_modules
. If you install browsers in the pipeline with npx playwright install chromium, the node_modules
folder must be included all browsers that you need and with PLAYWRIGHT_BROWSERS_PATH = 0 Playwright will look at for the right location.
Conclusion
After going through all of this, I finally succeeded in getting the Azure Function TimerTrigger to run reliably. The execution traces were sent to Application Insights, allowing me to monitor each run in real time. Additionally, the errors that occurred during the tests helped me realize that the reports were being stored in Azure Blob Storage, providing a reliable way to analyze test results and gain insights for further improvements.
Top comments (0)