Skip to content

URLPattern constructor type definition broken in 2025-05-20 (V8 13.7 update) #10070

@timkelty

Description

@timkelty

What versions & operating system are you using?

System:
OS: macOS 15.5
CPU: (10) arm64 Apple M1 Max
Memory: 211.91 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.17.1 - ~/.nvm/versions/node/v22.17.1/bin/node
npm: 10.9.2 - ~/.nvm/versions/node/v22.17.1/bin/npm
pnpm: 8.15.4 - /opt/homebrew/bin/pnpm
npmPackages:
@cloudflare/unenv-preset: ^2.4.1 => 2.4.1
@cloudflare/vitest-pool-workers: ^0.8.57 => 0.8.57
wrangler: ^4.26.0 => 4.26.0

Please provide a link to a minimal reproduction

No response

Describe the Bug

With "compatibility_date": "2025-04-16", this works fine:

it("Constructs URLPattern objects", () => {
	const urlPattern = new URLPattern(
		{
			pathname: "/foo/bar",
			search: "?baz=123",
		},
		"https://example.com",
	);
	expect(urlPattern.test("https://example.com/foo/bar?baz=123")).toBe(true);
	expect(urlPattern.test("https://example.com/foo/bar?baz=456")).toBe(false);
});

But with 2025-05-20, you'll get an error:

TypeError: Failed to construct URLPattern
 ❯ test/redirects.test.ts:25:21
     23|
     24| it("Constructs URLPattern objects", () => {
     25|  const urlPattern = new URLPattern(
       |                     ^
     26|   {
     27|    pathname: "/foo/bar",

Note: if instead, you use the baseURL property in the first argument, it seems to work.

Please provide any relevant error logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that isn't working

    Type

    Projects

    Status

    Untriaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions