nodejs / nodejs/undici

`Uncaught TypeError: SharedArrayBuffer is not a constructor`

Open
#3,746 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
7.7k
Forks
880
Avg merge
2d 16h
Merged PRs (30d)
68

Description

This is more of a runtime issue but I'm still confused why/how undici requires SharedArrayBuffer.

The problem occurs with:

require('undici')
Uncaught TypeError: SharedArrayBuffer is not a constructor
    at node:internal/worker:94:32
    at NativeModule.compileForInternalLoader (node:internal/bootstrap/loaders:312:7)
    at nativeModuleRequire (node:internal/bootstrap/loaders:341:14)
    at node:worker_threads:11:5
    at NativeModule.compileForInternalLoader (node:internal/bootstrap/loaders:312:7)
    at NativeModule.compileForPublicLoader (node:internal/bootstrap/loaders:252:10)
    at loadNativeModule (node:internal/modules/cjs/helpers:44:9)
    at Function.Module._load (node:internal/modules/cjs/loader:823:15)
    at Module.require (node:internal/modules/cjs/loader:1023:19)
    at require (node:internal/modules/cjs/helpers:97:18)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with require('undici') in the affected Node.js runtime. Start at node:internal/worker and node:worker_threads in the stack trace, then inspect undici's loading entry point. Done means the runtime compatibility cause and supported runtime conditions are established, with require('undici') no longer failing where support is claimed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.