jets icon indicating copy to clipboard operation
jets copied to clipboard

Deploy of s3_event job fails on Custom::S3BucketConfiguration if not already deployed

Open mikecbrant opened this issue 1 year ago • 0 comments

Checklist

  • [x] 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
  • [x] 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):

event: { "RequestType": "Create", "ServiceToken": "arn:aws:lambda:us-east-2:***:function:***-jets-s3_bucket_config", "ResponseURL": "https://cloudformation-custom-resource-response-useast2.s3.us-east-2.amazonaws.com/arn%3Aaws%3Acloudformation%3Aus-east-2%3A***%3Astack/i***-X7F069DJ018B/67b86b30-be04-11ee-a1d4-0af8fa8f40c5%7CS3BucketConfiguration%7C9b05a71b-49cc-4dcb-8379-e208b1de4d9d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240128T174142Z&X-Amz-SignedHeaders=host&X-Amz-Expires=7200&X-Amz-Credential=***%2Fus-east-2%2Fs3%2Faws4_request&X-Amz-Signature=5506a4257c949d76a6925882295c237b076c275206beb65507b950032fcd4bb7", "StackId": "arn:aws:cloudformation:us-east-2:***:stack/***-X7F069DJ018B/67b86b30-be04-11ee-a1d4-0af8fa8f40c5", "RequestId": "9b05a71b-49cc-4dcb-8379-e208b1de4d9d", "LogicalResourceId": "S3BucketConfiguration", "ResourceType": "Custom::S3BucketConfiguration", "ResourceProperties": { "ServiceToken": "arn:aws:lambda:us-east-2:***:function:***-jets-s3_bucket_config", "Bucket": "***", "NotificationConfiguration": { "TopicConfigurations": [ { "TopicArn": "arn:aws:sns:us-east-2:***:***-X7F069DJ018B-SnsTopic-j6ipRgj9Ezp3", "Events": [ "s3:ObjectCreated:*" ] } ] } } } context: "#<0x00007ff24fad5338><0x00007ff24fad5338>

""

mikecbrant avatar Jan 28 '24 18:01 mikecbrant