thoughtbot / paperclip

Easy file attachment management for ActiveRecord
https://thoughtbot.com
Other
9.01k stars 2.43k forks source link

The whole aws-sdk is required, but not actually needed #2569

Closed Fodoj closed 6 years ago

Fodoj commented 6 years ago

It seems to be that requiring complete aws-sdk is not really needed. It's required here: https://github.com/thoughtbot/paperclip/blob/master/lib/paperclip/storage/s3.rb.

The problem with it is that it will include all AWS SDK libraries. Take a look at Gemfile.lock:

    aws-sdk-resources (3.12.0)
      aws-sdk-acm (~> 1)
      aws-sdk-alexaforbusiness (~> 1)
      aws-sdk-apigateway (~> 1)
      aws-sdk-applicationautoscaling (~> 1)
      aws-sdk-applicationdiscoveryservice (~> 1)
      aws-sdk-appstream (~> 1)
      aws-sdk-appsync (~> 1)
      aws-sdk-athena (~> 1)
      aws-sdk-autoscaling (~> 1)
      aws-sdk-autoscalingplans (~> 1)
      aws-sdk-batch (~> 1)
      aws-sdk-budgets (~> 1)
      aws-sdk-cloud9 (~> 1)
      aws-sdk-clouddirectory (~> 1)
      aws-sdk-cloudformation (~> 1)
      aws-sdk-cloudfront (~> 1)
      aws-sdk-cloudhsm (~> 1)
      aws-sdk-cloudhsmv2 (~> 1)
      aws-sdk-cloudsearch (~> 1)
      aws-sdk-cloudsearchdomain (~> 1)
      aws-sdk-cloudtrail (~> 1)
      aws-sdk-cloudwatch (~> 1)
      aws-sdk-cloudwatchevents (~> 1)
      aws-sdk-cloudwatchlogs (~> 1)
      aws-sdk-codebuild (~> 1)
      aws-sdk-codecommit (~> 1)
      aws-sdk-codedeploy (~> 1)
      aws-sdk-codepipeline (~> 1)
      aws-sdk-codestar (~> 1)
      aws-sdk-cognitoidentity (~> 1)
      aws-sdk-cognitoidentityprovider (~> 1)
      aws-sdk-cognitosync (~> 1)
      aws-sdk-comprehend (~> 1)
      aws-sdk-configservice (~> 1)
      aws-sdk-costandusagereportservice (~> 1)
      aws-sdk-costexplorer (~> 1)
      aws-sdk-databasemigrationservice (~> 1)
      aws-sdk-datapipeline (~> 1)
      aws-sdk-dax (~> 1)
      aws-sdk-devicefarm (~> 1)
      aws-sdk-directconnect (~> 1)
      aws-sdk-directoryservice (~> 1)
      aws-sdk-dynamodb (~> 1)
      aws-sdk-dynamodbstreams (~> 1)
      aws-sdk-ec2 (~> 1)
      aws-sdk-ecr (~> 1)
      aws-sdk-ecs (~> 1)
      aws-sdk-efs (~> 1)
      aws-sdk-elasticache (~> 1)
      aws-sdk-elasticbeanstalk (~> 1)
      aws-sdk-elasticloadbalancing (~> 1)
      aws-sdk-elasticloadbalancingv2 (~> 1)
      aws-sdk-elasticsearchservice (~> 1)
      aws-sdk-elastictranscoder (~> 1)
      aws-sdk-emr (~> 1)
      aws-sdk-firehose (~> 1)
      aws-sdk-gamelift (~> 1)
      aws-sdk-glacier (~> 1)
      aws-sdk-glue (~> 1)
      aws-sdk-greengrass (~> 1)
      aws-sdk-guardduty (~> 1)
      aws-sdk-health (~> 1)
      aws-sdk-iam (~> 1)
      aws-sdk-importexport (~> 1)
      aws-sdk-inspector (~> 1)
      aws-sdk-iot (~> 1)
      aws-sdk-iotdataplane (~> 1)
      aws-sdk-iotjobsdataplane (~> 1)
      aws-sdk-kinesis (~> 1)
      aws-sdk-kinesisanalytics (~> 1)
      aws-sdk-kinesisvideo (~> 1)
      aws-sdk-kinesisvideoarchivedmedia (~> 1)
      aws-sdk-kinesisvideomedia (~> 1)
      aws-sdk-kms (~> 1)
      aws-sdk-lambda (~> 1)
      aws-sdk-lambdapreview (~> 1)
      aws-sdk-lex (~> 1)
      aws-sdk-lexmodelbuildingservice (~> 1)
      aws-sdk-lightsail (~> 1)
      aws-sdk-machinelearning (~> 1)
      aws-sdk-marketplacecommerceanalytics (~> 1)
      aws-sdk-marketplaceentitlementservice (~> 1)
      aws-sdk-marketplacemetering (~> 1)
      aws-sdk-mediaconvert (~> 1)
      aws-sdk-medialive (~> 1)
      aws-sdk-mediapackage (~> 1)
      aws-sdk-mediastore (~> 1)
      aws-sdk-mediastoredata (~> 1)
      aws-sdk-migrationhub (~> 1)
      aws-sdk-mobile (~> 1)
      aws-sdk-mq (~> 1)
      aws-sdk-mturk (~> 1)
      aws-sdk-opsworks (~> 1)
      aws-sdk-opsworkscm (~> 1)
      aws-sdk-organizations (~> 1)
      aws-sdk-pinpoint (~> 1)
      aws-sdk-polly (~> 1)
      aws-sdk-pricing (~> 1)
      aws-sdk-rds (~> 1)
      aws-sdk-redshift (~> 1)
      aws-sdk-rekognition (~> 1)
      aws-sdk-resourcegroups (~> 1)
      aws-sdk-resourcegroupstaggingapi (~> 1)
      aws-sdk-route53 (~> 1)
      aws-sdk-route53domains (~> 1)
      aws-sdk-s3 (~> 1)
      aws-sdk-sagemaker (~> 1)
      aws-sdk-sagemakerruntime (~> 1)
      aws-sdk-serverlessapplicationrepository (~> 1)
      aws-sdk-servicecatalog (~> 1)
      aws-sdk-servicediscovery (~> 1)
      aws-sdk-ses (~> 1)
      aws-sdk-shield (~> 1)
      aws-sdk-simpledb (~> 1)
      aws-sdk-sms (~> 1)
      aws-sdk-snowball (~> 1)
      aws-sdk-sns (~> 1)
      aws-sdk-sqs (~> 1)
      aws-sdk-ssm (~> 1)
      aws-sdk-states (~> 1)
      aws-sdk-storagegateway (~> 1)
      aws-sdk-support (~> 1)
      aws-sdk-swf (~> 1)
      aws-sdk-transcribeservice (~> 1)
      aws-sdk-translate (~> 1)
      aws-sdk-waf (~> 1)
      aws-sdk-wafregional (~> 1)
      aws-sdk-workdocs (~> 1)
      aws-sdk-workmail (~> 1)
      aws-sdk-workspaces (~> 1)
      aws-sdk-xray (~> 1)

I didn't dig too much into Paperclip source code, but it seems to be that just requiring aws-sdk-s3 should be sufficient.

What do you think? I can submit a PR with the fix.

sidraval commented 6 years ago

2481 Took care of this 👍