Skip to content

Post processing files uploaded to S3 (Deprecated by Cloudflare Images)

License

Notifications You must be signed in to change notification settings

thematters/serverless-file-post-processing

Repository files navigation

serverless-file-post-processing

Deployment Status Test Status Commitizen friendly

Post processing files uploaded to S3

Use Cases

  • Resize & compress images uploaded to AWS S3
  • Delete thumbnails when the original image is deleted

Development

We use The Serverless Framework to develop and deploy our AWS Lambda functions.

See their docs for more details.

Deployment

Serverless App will be deployed automatically by GitHub Actions.

Migataion

To migrate legacy images that unprocessed by the current version of Lambda function, please run:

npm run migrate:images

WARNING

From Configuring Amazon S3 event notifications:

If your notification ends up writing to the bucket that triggers the notification, this could cause an execution loop. For example, if the bucket triggers a Lambda function each time an object is uploaded, and the function uploads an object to the bucket, then the function indirectly triggers itself. To avoid this, use two buckets, or configure the trigger to only apply to a prefix used for incoming objects.

Troubleshooting

If you are facing the following error, try to delete enabled S3 events first.

An error occurred: *****CustomS31 - Failed to create resource. Unable to validate the following destination configurations