Skip to content

Deno crashes when using the fetch API #5301

@davidebombelli

Description

@davidebombelli

Bug Description

When importing and using fetch, Deno throws a TypeError due to a missing API in their environment.

Reproducible By

  1. Create file fetch.js with the following content:
import { fetch } from 'undici'

await fetch('https://www.google.com/')
  1. Run file deno fetch.js.

Expected Behavior

When running node fetch.js, the fetch is executed and the program ends without any output.

Logs & Screenshots

> deno fetch.js 
error: Uncaught (in promise) TypeError: webidl.util.markAsUncloneable is not a function
    webidl.util.markAsUncloneable(this)
                ^
    at new CacheStorage (file:///home/username/undici/node_modules/undici/lib/web/cache/cachestorage.js:20:17)
    at Object.<anonymous> (file:///home/username/undici/node_modules/undici/index.js:179:25)
    at Module._compile (node:module:874:34)
    at loadMaybeCjs (node:module:899:10)
    at Object..js (node:module:884:12)
    at Module.load (node:module:755:32)
    at Module._load (node:module:589:12)
    at Module.require (node:module:770:19)
    at require (node:module:958:16)
    at file:///home/username/undici/node_modules/undici/index.js:7:9

Environment

OS:
Linux 6.8.0-106-generic x86_64 x86_64

Deno:
deno 2.7.14 (stable, release, x86_64-unknown-linux-gnu)
v8 14.7.173.20-rusty
typescript 5.9.2

Additional context

Deno offers a compatibility layer that allows the runtime to use NPM packages. However, the API markAsUncloneable from node:worker_threads is undefined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions