Skip to content

Updating compatibility_date causes deployment to fail #5244

@garysassano

Description

@garysassano

What versions & operating system are you using?

index.js

import { launch } from "@cloudflare/playwright";

export default {
  async fetch(_request: Request, env: Env) {
    const browser = await launch(env.BROWSER);
    const page = await browser.newPage();

    await page.goto("https://demo.playwright.dev/todomvc");

    const TODO_ITEMS = ["buy some cheese", "feed the cat", "book a doctors appointment"];

    const newTodo = page.getByPlaceholder("What needs to be done?");
    for (const item of TODO_ITEMS) {
      await newTodo.fill(item);
      await newTodo.press("Enter");
    }

    const img = await page.screenshot();
    await browser.close();

    return new Response(img, {
      headers: {
        "Content-Type": "image/png",
      },
    });
  },
};

wrangler.jsonc

/**
 * For more details on how to configure Wrangler, refer to:
 * https://developers.cloudflare.com/workers/wrangler/configuration/
 */
{
	"$schema": "node_modules/wrangler/config-schema.json",
	"name": "cloudflare-playwright-screenshot",
	"main": "src/index.ts",
	"compatibility_flags": ["nodejs_compat_v2"],
	"compatibility_date": "2025-06-30",
	"workers_dev": true,
	"upload_source_maps": true,
	"observability": {
      "enabled": true
  	},
	"browser": {
	  "binding": "BROWSER"
	},
}

Please provide a link to a minimal reproduction

https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/docs/browser-rendering/platform/playwright.mdx

Describe the Bug

If you update the compatibility_date flag to 2025-09-17, it breaks the deployment:

Uncaught Error: No such module "node:fs".
  imported from "index.js"
 [code: 10021]

In order to fix the error you have two options:

  • Set compatibility_flags to nodejs_compat instead of nodejs_compat_v2
  • Set compatibility_date to an older date like 2025-06-30 instead of 2025-09-17

Please provide any relevant error logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting reporter responseNeeds clarification or followup from OPbugSomething isn't working

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions