Job did not have a CloudWatch Events Trigger




I created a job and set schedule. But this job did not work.
And I found this job did not have any triggers.

But I found CloudWatch Rule that was made by jets is already existed.

So I add this trigger manually , then the job works perfectly.

So my question is can I add this CloudWatch Events Trigger in the Jets code?


Looked more closely at the screenshot. It looks like a scheduled event. So the rate or cron declaration should have created it. Also, can you provide a code sample when you get a chance. Thanks!

Also, wondering if it’s an IAM permission issue. Has the default application-wide IAM policy been modified?


Yeap. here is my code.

My current Jets version is 1.9.16
And I set config.function.role from application.rb.
So I also paste my role’s permissions, too.

    "Version": "2012-10-17",
    "Statement": [
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
            "Resource": "*"

And also, I set that use a private RDS, so I need to create a NAT Gateway or NAT Instance but I did not yet. If you need more information then contact me anytime, thanks.


Thanks for the code sample. I see why the event trigger is not being created:

The current code looks something like this:

class StoreJob < ApplicationJob
  rate '1 hour'
  log_event 'jets/jobs/store/migrate' # this is current associated with the same method as the rate expression
  def migrate
    # ...

  def seed
    # ...

So, you need the log_event above whatever method you want it to be associated with right above the method definition. Here’s a guess of what you might want:

class StoreJob < ApplicationJob
  rate '1 hour'
  def migrate
    # ...

  log_event 'jets/jobs/store/migrate' # this was moved down
  def seed
    # ...

Hope that helps.