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

Trying to upload a blob as wav file and getting `Maximum call stack size exceeded` #856

Closed Leekao closed 1 year ago

Leekao commented 1 year ago

I'm trying to upload a blob which is a wav file I want to save on the server, this is my code:

On the client saving the blob:

const onComplete = (blob) => {
    const outputFile = new File([blob], "output.wav")
    console.log({outputFile})
    const id = Wavs.insert({
      file: outputFile,
      chunkSize: 'dynamic'
    }, true)
    Meteor.call('New File', id)
    Meteor.setTimeout(startRecording, 1000*60*10)
  };

and here is the collection definition file (Isomorphic):

import { Meteor } from 'meteor/meteor';
import { FilesCollection } from 'meteor/ostrio:files';

export const Wavs = new FilesCollection({
  collectionName: 'wavs',
  allowClientCode: true, // Allow remove files from Client
  onBeforeUpload(file) {
    return true;
  }
});

if (Meteor.isClient) {
  Meteor.subscribe('files.wavs.all');
}

if (Meteor.isServer) {
  Meteor.publish('files.wavs.all', function () {
    return Wavs.find().cursor;
  });
}

When I run this code I get "Maximum call stack" error and I can't figure out why, can anyone help?

dr-dimitru commented 1 year ago

Hello @Leekao,

No idea, you provided so little detail about actual error you get, where? on server? Please, update your issue following our ISSUE_TEMPLATE

Leekao commented 1 year ago

Thank you for your time, I followed the simple upload example and managed to solve my issue, no idea how but it is now resolved.