Rashmi
Rashmi

Reputation: 605

Meteor : S3 Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed

Packages Used: cfs:standard-packages cfs:filesystem cfs:s3

Uploading around 245 images to Amazon s3. But getting error as: "s3 Error: Error storing file to the productImgS3 store: Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed."


    My server side file looks like below:

    FS.debug = true;

    var productImgStoreS3 = new FS.Store.S3("productImgS3", {
      region : "ap-south-1", 
      accessKeyId: "xxxx", 
      secretAccessKey: "xxxx", 
      bucket: "abcd",
      folder: "product",
      maxTries: 5 //optional, default 5
    });


    ProductImgUploadS3 = new FS.Collection("productS3", {
      stores: [productImgStoreS3],
      filter: {
        allow: {
          contentTypes: ['image/*']
        }
      }
    });

    ProductImgUploadS3.allow({
      insert: function() {
        return true;
      },
      update: function() {
        return true;
      },
      remove: function(fileObj) {
        return true;
      },
      download: function() {
        return true;
      }
    });


    ProductImgUploadS3.deny({
      insert: function() {
        return false;
      },
      update: function() {
        return false;
      },
      remove: function() {
        return false;
      },
      download: function() {
        return false;
      }
    });

    Meteor.publish("productsImgS3", function() {
        return ProductImgUploadS3.find({});
    });


My client file looks like:


    var productImgStoreS3 = new FS.Store.S3("productImgS3", { 

    });

    export const ProductImgUploadS3 = new FS.Collection("productS3", {
      stores: [productImgStoreS3],
      filter: {
        allow: {
          contentTypes: ['image/*']
        }
      }
    });

    ProductImgUploadS3.allow({
      insert: function() {
        return true;
      },
      update: function() {
        return true;
      },
      remove: function(fileObj) {
        return true;
      },
      download: function(fileObj) {
        return true;
      }
    });


    ProductImgUploadS3.deny({
      insert: function() {
        return false;
      },
      update: function() {
        return false;
      },
      remove: function() {
        return false;
      },
      download: function() {
        return false;
      }
    });

Thanks in advance!

Upvotes: 0

Views: 1654

Answers (1)

Rashmi
Rashmi

Reputation: 605

Unable to sort out the problem so now using "meteor add edgee:slingshot", which directly gives URL of image and not "_id" so it is better than using cfs:s3. But it gives "error : failed to upload file to cloud storage [-0]" sometimes Slingshot Issue .

OR

One can use https://github.com/Lepozepo/S3 instead.

Then also some images are failing may be because of socket is closing before accepting all images.

UPDATE : Connection is getting closed as n-number of images are trying to upload. Partial solution may be to send less images, may be 10 at a time.

                                *OR*

One may call upload method in error section for failed images.Just a temporary solution.

Upvotes: 0

Related Questions