duna-oss / flystorage

Flystorage; File storage abstraction for Node / TypeScript

Home Page:https://flystorage.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

StreamReader is not defined Using S3 Adapter

Titou325 opened this issue · comments

Hi! We are using this library that really saves us a lot of time dealing with the specificities of each storage provider. Recently, we have been running into an intermittent (or maybe not?) issue with the S3 adapter, and have a hard time pinpointing what is going south.

Here is the error we get:

ReferenceError: StreamReader is not defined
  File "<anonymous>", in Function.assign
  File "/app/node_modules/peek-readable/lib/index.js?iitm=true", line 6, col 18
  File "node:internal/modules/esm/module_job", line 222, col 25, in ModuleJob.run
  File "node:internal/modules/esm/loader", line 323, col 24, in ModuleLoader.import
Error: Unable to write the file. Reason: StreamReader is not defined
  File "/app/node_modules/@flystorage/file-storage/dist/esm/errors.js", line 45, col 71, in UnableToWriteFile.because
    static because = (reason, { context = {}, cause = undefined }) => new UnableToWriteFile(`Unable to write the file. Reason: ${reason}`, c {snip}
  File "/app/node_modules/@flystorage/file-storage/dist/esm/file-storage.js", line 77, col 44, in FileStorage.write
    throw errors.UnableToWriteFile.because(errors.errorToMessage(error), { cause: error, context: { path, options } });
  File "node:internal/process/task_queues", line 95, col 5, in process.processTicksAndRejections
  File "/src/api/routes/pdf/generate/index.ts", line 153, col 11, in Object.?
    await bucket.createObject({

Have you seen any similar errors / know what might be referenced as StreamReader? Mostly looking for something to point us in the right direction.

Many thanks!

There seems to be an incompatibility in Node 20 with the latest versions of peek-readable. Upgrading to Node 22 got rid of the error with a clean package-lock install. Will close it as it is not directly related but may be found by others looking for the same thing! Thanks