Comments (7)
Just seen the comment in the troubleshooting section about this... let me try
from retinal.
Ok, now I'm getting this error:
An error occurred while provisioning your stack: S3BucketXXXXXXXX
- XXXXXXXX already exists.
Slightly different. It is referring to the source bucket this time.
from retinal.
Hi @danielcrisp. I'm sorry to hear you're having difficulties using serverless-sharp-image
.
The issue you're running into is a bit of a catch-22. In order to run the unit tests, there needs to be an s3 bucket. But, to deploy, Serverless also tries to create those buckets. If you make the buckets to run the unit tests, then Serverless will complain that they already exist. Ugh.
The easiest solution is to manually create your S3 bucket(s) yourself, and remove the imageDestinationBucket
section from the resources
section in ~/serverless.yml
(line 81).
Another solution is to deploy before running the tests (I realise this is ass-backwards, but it'll get you going in a dev environment.) By deploying first, the correct AWS Cloud Formation template can be generated and deployed—which includes creating the bucket. This means you won't get that provisioning error. Then, the unit tests will be able to make use of the same bucket without you having to manually create it. To deploy directly, you can run ./node_modules/.bin/serverless deploy
within the project's root directory. Or, if you have serverless
installed globally, serverless deploy
within the project root should also work.
When I deploy this function in production, I end up setting up the s3 buckets manually because I don't want them to get accidentally deleted—furthermore, the source buckets are usually already in use and contain images before I add this function, and so it's impossible to create the bucket from scratch—since it's already in production use. In this case I remove the resources
section from serverless.yml so that Serverless and CloudFormation don't try to create the bucket resource.
from retinal.
Great - thanks for the indepth explanation
from retinal.
@adieuadieu I'm doing this:
The easiest solution is to manually create your S3 bucket(s) yourself, and remove the imageDestinationBucket section from the resources section in ~/serverless.yml (line 81).
But I still get the error that the source bucket still exists. If I remove the event from the lambda function too (like you say in the troubleshooting section), it deploys fine. But how will the resized function trigger without the event?
I'm trying to disable the creation of the S3 buckets (they will already exist).
from retinal.
This seems to be an issue with Cloudformation serverless/serverless#3968. Specifying the s3 event will create the bucket.
from retinal.
@superandrew213 yea; it's quite annoying. The simples work-around I'm aware of that I've also tried myself is to remove the s3 event from the serverless.yml
configuration and set it up manually in the AWS web Console. An alternative might be to use this plugin but I haven't tried this.
from retinal.
Related Issues (20)
- Update to sharp 0.18
- Feature: On-the-fly resizing API with API Gateway
- Convert configuration file to JavaScript format (instead of JSON)
- Remove dependency on webpack, serverless-webpack
- "type" (Content-Type) appears to be ignored HOT 2
- Does not work on eu-central-1 HOT 3
- Handler fails with error "Cannot read property 'forEach' of undefined" HOT 2
- Question: How to process skipped images if lambda was paused for some time ? HOT 3
- Is it possible to reduce the file size for a PNG file without actually resizing the image and not reducing the quality significantly ? HOT 3
- Support for transcoding short videos and generating time-lapse from series of stills, thumbnails & gifs HOT 6
- Feature: support libimageflow as an alternative to sharp/libvips?
- Feature: support for auto-generating LQIP and SVG loader placeholder images
- Enable X-Ray tracing
- 'Yarn test' gives an error. HOT 3
- Cannot find src/handler HOT 5
- Linter errors HOT 2
- Created a new repo for generating srcSet and Sizes for img tag HOT 1
- No way to pass density in case of SVG resizing
- deploying retinal issues HOT 1
- pre-compiled sharp is compatible with Lambda environment HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from retinal.