veliovgroup / Meteor-Files

🚀 Upload files via DDP or HTTP to ☄️ Meteor server FS, AWS, GridFS, DropBox or Google Drive. Fast, secure and robust.
https://packosphere.com/ostrio/files
BSD 3-Clause "New" or "Revised" License
1.11k stars 166 forks source link

Since Meteor 2.11 - Exception in setTimeout callback: TypeError: fs.remove is not a function #870

Closed Gobliins closed 1 year ago

Gobliins commented 1 year ago

Hello,

after upgrading to Meteor 2.11 / Mongo 6, I get the mentioned error.

My Code, Serverside:

function loadFile() {
  ...
  return new Promise((resolve, reject) => {
    Files.load(loadUrl, options,
      (loadError, fileRef) => {
        if (loadError) {
          return reject({error: loadError});
        } else {
          return resolve({error: false, fileRef});
        }
      }, true);
  });
}

When i call this function with await, it never resolves nor rejects. When using .then(), i get the described error:

Exception in setTimeout callback: TypeError: fs.remove is not a function
at onEnd (packages/ostrio:files/server.js:1433:18) 
at packages/ostrio:files/server.js:1480:13
at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1329:12)
at packages/meteor.js:587:25
at runWithEnvironment (packages/meteor.js:1417:24)

On Meteor 2.10 it was working ok.

Is there an update needed or has something changed with Promises in Node 14 / Meteor 2.11?

Edit: Removed the promise code and worked with callbacks, but still hangs on Files.load().

dr-dimitru commented 1 year ago

@Gobliins confirmed as a bug, thank you; will follow up with fix shortly

Gobliins commented 1 year ago

Thx. If you need more info, just say. I just tested downgrading to Meteor 2.10. Code works as expected. It is running during Meteor startup BTW.

dr-dimitru commented 1 year ago

@Gobliins thank you for the report, fix should be available in v2.3.3; Please, upgrade to the latest package version. Let us know if issue is solved on your end

Gobliins commented 1 year ago

@dr-dimitru Thx for the fix. The error is not happening anymore. Unfortunately storing files is still not working in 2.11. No Entries inside the DB. On Filesystem I'm getting only 1KB files with plain text content: 503 - Service unavailable. However I'm not sure if this is a problem of meteor-files or the old CFS Packages retrieving the files. We're currently migrating away from CFS.

dr-dimitru commented 1 year ago

@Gobliins

Unfortunately storing files is still not working in 2.11. No Entries inside the DB. On Filesystem I'm getting only 1KB files with plain text content: 503 - Service unavailable. However I'm not sure if this is a problem of meteor-files or the old CFS Packages retrieving the files. We're currently migrating away from CFS.

Difficult to tell without errors and logs, try {debug: true} mode for further investigation

dr-dimitru commented 1 year ago

@Gobliins have you figured it out?

Gobliins commented 1 year ago

Hey, I was on a break / weekend. Today I'm back on it. But I think it's a problem of the old Collection-FS, since I get a timeout during the Files.load() method. My Guess is, that there's a problem with the download URL also happens since Meteor 2.11.

Gobliins commented 1 year ago

@dr-dimitru A little late but just wanted to tell you safe, it's not a problem of meteor-files :)

dr-dimitru commented 1 year ago

@Gobliins all good, thank you