cloudflare / cloudflare/workerd

Updating `compatibility_date` causes deployment to fail

Open
#5,244 1 comment 0 reactions 0 assignees View on GitHub
awaiting reporter response bug
Dominant language
C++
Stars
8.7k
Forks
739
Avg merge
2d 20h
Merged PRs (30d)
174

Description

### What versions & operating system are you using?

### index.js

```ts
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

```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:

```sh
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_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.