remix-run / remix

Build Better Websites. Create modern, resilient user experiences with web fundamentals.
https://remix.run
MIT License
28.56k stars 2.41k forks source link

First parameter has member 'readable' that is not a ReadableStream (with @vercel/blob) #7614

Open jorisre opened 9 months ago

jorisre commented 9 months ago

What version of Remix are you using?

2 and 1.19

Are all your remix dependencies & dev-dependencies using the same version?

Steps to Reproduce

  1. Start a new project using Remix
  2. Add @vercel/blob package
  3. Call the list function of @vercel/blob from a Remix loader
  4. đŸ’¥ Error happen:

    throw new TypeError(${context} is not a ReadableStream.); ^ TypeError: First parameter has member 'readable' that is not a ReadableStream.

This CodeSandbox shows the error, does anyone know a workaround?

https://codesandbox.io/p/sandbox/sparkling-flower-hmrkj4

Expected Behavior

Should not throw an error and return the blobs

Actual Behavior

It throws the following error:

info building... info built (537ms) [remix-serve] http://localhost:3000 (http://192.168.1.102:3000)

/Users/joris/w/blob/node_modules/web-streams-polyfill/src/lib/validators/readable-stream.ts:5 throw new TypeError(${context} is not a ReadableStream.); ^ TypeError: First parameter has member 'readable' that is not a ReadableStream. at assertReadableStream (/Users/joris/w/blob/node_modules/web-streams-polyfill/src/lib/validators/readable-stream.ts:5:11) at convertReadableWritablePair (/Users/joris/w/blob/node_modules/web-streams-polyfill/src/lib/validators/readable-writable-pair.ts:15:3) at ReadableStream.pipeThrough (/Users/joris/w/blob/node_modules/web-streams-polyfill/src/lib/readable-stream.ts:211:23) at fetchFinale (/Users/joris/w/blob/node_modules/undici/lib/fetch/index.js:973:52) at mainFetch (/Users/joris/w/blob/node_modules/undici/lib/fetch/index.js:773:5) at processTicksAndRejections (node:internal/process/task_queues:95:5)

nakleiderer commented 7 months ago

I ran into this issue as well when enqueuing a job with BullMQ. Since this was occurring in the Node-side of my application (I'm running a custom server), I removed the installGlobals() call. After this, my BullMQ jobs enqueued successfully.

  System:
    OS: macOS 14.1.2
    CPU: (10) arm64 Apple M1 Max
    Memory: 3.77 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.10.0 - ~/.asdf/installs/nodejs/20.10.0/bin/node
    npm: 10.2.3 - ~/.asdf/plugins/nodejs/shims/npm
  npmPackages:
    @remix-run/dev: ^2.3.1 => 2.3.1 
    @remix-run/eslint-config: ^2.3.1 => 2.3.1 
    @remix-run/express: ^2.3.1 => 2.3.1 
    @remix-run/node: ^2.3.1 => 2.3.1 
    @remix-run/react: ^2.3.1 => 2.3.1 
    bullmq: ^4.15.0 => 4.15.0 
module.exports = {
  appDirectory: "src",
  cacheDirectory: "./node_modules/.cache/remix",
  ignoredRouteFiles: ["**/.*", "**/*.css", "**/*.test.{js,jsx,ts,tsx}"],
  serverModuleFormat: "esm",
  serverPlatform: "node",
  watchPaths: ["./tailwind.config.cjs"],
};
maxfi commented 3 months ago

Possibly related: https://github.com/vercel/remix/issues/62#issuecomment-2041038392