Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling S3.delete from server side #159

Closed
luckyvs1 opened this issue Jan 21, 2018 · 5 comments
Closed

Calling S3.delete from server side #159

luckyvs1 opened this issue Jan 21, 2018 · 5 comments

Comments

@luckyvs1
Copy link

Currently I'm trying to use the S3.delete function in the server side to delete an object after an x amount of time has passed. So after the appropriate time has passed using the Meteor.setTimeout the S3.delete function is called to delete the file from Amazon S3.

But I get the following error:
I20180121-15:01:39.901(-8)? Exception in setTimeout callback: TypeError: S3.delete is not a function I20180121-15:01:39.902(-8)? at app/server/document_manager/methods.js:24:11 I20180121-15:01:39.902(-8)? at [object Object]._.extend.withValue (packages/meteor.js:1122:17) I20180121-15:01:39.903(-8)? at packages/meteor.js:445:45 I20180121-15:01:39.903(-8)? at runWithEnvironment (packages/meteor.js:1176:24)

Is there a work around for calling S3.delete on the server side?

@luckyvs1
Copy link
Author

luckyvs1 commented Jan 22, 2018

@Lepozepo, can you confirm if this is a valid solution I have tested it and it works, but want to know if there are any known issues, as I read the server side upload had some errors (re: your comments in #148).

In place of S3.delete, on the server side I would use the S3.knox.deleteFile, so the code is the following:

S3.knox.deleteFile(
  relative_path,
  function(err,response) {
    if(response) {
      console.log('Success, file has been deleted');
    } else {
      console.log('Unable to delete, please try again later');
    }
  }
);

I can't seem to markdown the code with my formatting intact, so apologies for the poorly formatted code.

@Lepozepo
Copy link
Owner

@luckyvs1 no worries, that is definitely ok :D hope to enable server side uploads and functions again soon (for the very late christmas update lol)

@Lepozepo
Copy link
Owner

Also @luckyvs1 you can use 3 ticks to format your code ^_^

@harvinder34
Copy link

is there any update on server side upload?

@Lepozepo
Copy link
Owner

Lepozepo commented Aug 4, 2019

@harvinder34 I've been super disconnected from the Meteor community lately, I'll see if I can fit some time into upgrading some of these super old meteor packages next week with some of the new work I have on npm. If you really need server side uploads immediately, you might find it easier to use the aws-sdk package from AWS directly. Just do an npm i aws-sdk in your project and follow AWS's documentation for uploading server files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants