Deploy of s3_event job fails on Custom::S3BucketConfiguration if not already deployed
Closed this issue · 1 comments
Checklist
- Upgrade Jets: Are you using the latest version of Jets? This allows Jets to fix issues fast. There's a
jets upgrade
command that makes this a simple task. There's also an Upgrading Guide: http://rubyonjets.com/docs/upgrading/ - Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on https://community.boltops.com
- Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.
My Environment
Software | Version |
---|---|
Operating System | MacOS 14.2.1 |
Jets | 5.0.9 |
Ruby | 3.2.0 installed via asdf |
Expected Behaviour
I am attempting to deploy s3_event job, for which I would expect S3 bucket + SNS topic + Lambda function and associated resources within Cloudformation stack.
Current Behavior
Cloudformation stack creation fails upon attempt to create S3BucketConfiguration.
Step-by-step reproduction instructions
Create new project. Do not deploy project.
jets new {project} --mode job
Add .tools-versions
file
ruby 3.2.0
Generate new s3_event job
jets generate job {job name } --type s3
Update s3_event job with desired bucket name. I happened to make my bucket name the same as the project name. My file looked like...
class S3IngestJob < ApplicationJob
s3_event "{same name as project}" # S3 bucket
def perform
puts "event #{JSON.dump(event)}"
puts "s3_events #{JSON.dump(s3_events)}"
puts "s3_objects #{JSON.dump(s3_objects)}"
end
end
Run jets deploy
This fails with log entries as follows (***
represents redaction):
Code Sample
See above
Solution Suggestion
I was able to successfully deploy by:
- tearing down the Cloudformation stack
- deleting my s3_event job
- running
jets deploy
with no job other than initialapplication_job.rb
configured - re-adding my s3_event job, but with a different bucket name (not same as project name)
- redeploying
This was my first ever usage of jets, so perhaps this is rookie error. It would however be helpful if documentation noted that s3_event jobs cannot have a bucket name that matches the project name or that the "bare" project must first be deployed (depending on whichever of these issues was actually the root cause).
@mikecbrant What was the bucket name exactly?
I am unable to repro with a random project and bucket name. application name: "my-app-#{random_string}".
I have a theory that this is not a jets issue per say but rather the bucket name you chose was not globally unique in your s3 region on AWS.
Assuming you create an application with the name "my-app", jets will deploy and create a deployment bucket with the following name: "my-app-{env}-{random_string}".
However it will not add modify your bucket name for events, so if any other person on AWS owns a "my-bucket" s3 bucket, it will fail to create because it is not globally unique. When you changed the bucket name to something not the application name you may have just happen to create a unique bucket name.