cloudflare / cloudflare/workerd

Issue with nodejs_compat + dynamic require of node:events

Open
#854 29 comments 3 reactions 0 assignees View on GitHub
feature request
Dominant language
C++
Stars
8.7k
Forks
739
Avg merge
2d 20h
Merged PRs (30d)
174

Description

### Which Cloudflare product(s) does this pertain to?

Workers/Other, Wrangler

### What version of `Wrangler` are you using?

2.18.0

### What operating system are you using?

Mac

### Describe the Bug

Attempting to upload a worker with Wrangler using `compatibility_flags = ['nodejs_compat']` or command line `--compatibility-flags="nodejs_compat"` fails with this error message:

```
Uncaught Error: Dynamic require of "node:events" is not supported
at worker.js:13:11
at worker.js:13348:28
at worker.js:13631:3
[code: 10021]
```

The package using `node:events` is this LaunchDarkly SDK: https://github.com/launchdarkly/js-core/tree/main/packages/sdk/cloudflare

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.