Skip to content

Dynamic require of "stream" is not supported #1426

Open
@mcfdez

Description

@mcfdez

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

Hello,

I am developing an application with Express and I am using Esbuild to compile it. Also, for a compatibility issue with certain libraries, the application is built and compiled in ESM mode.

However, after implementing the Supabase library, when I start the application I get this error:

Error: Dynamic require of “stream” is not supported

Inspecting the generated code, I see that it comes from @supabase/node-fetch.

var require_lib2 = __commonJS({
  "node_modules/@supabase/node-fetch/lib/index.js"(exports, module) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    function _interopDefault(ex) {
      return ex && typeof ex === "object" && "default" in ex ? ex["default"] : ex;
    }
    var Stream = _interopDefault(__require("stream"));

Is there any way to not use that library or to be able to start it in ESM mode?

To Reproduce

Create a Node application (v22) and compile it with Esbuild in ESM mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions