Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem to deploy when removing a schedule from a lambda function #3255

Closed
christiansaiki opened this issue Feb 15, 2017 · 4 comments
Closed

Comments

@christiansaiki
Copy link

This is a Bug Report

Description

I've edited my serverless.yml file to remove a schedule
Then I've tried to deploy with sls deploy -v but I've got the following message
Serverless Error ---------------------------------------
An error occurred while provisioning your stack: StartInstancesEventsRuleSchedule1- <my_schedule>
exists in stack arn:aws:cloudformation:us-east-1:...
What is the proper way to remove a schedule?
Thanks in advance

For bug reports:

  • What went wrong?
    The deploy of the service didn't go through

  • What did you expect should have happened?
    I was expecting to have my service deployed without the schedule that was supposed to be deleted

  • What was the config you used?

service: lambda-jobs 
plugins:
  - serverless-plugin-include-dependencies
provider:
  name: aws
  runtime: nodejs4.3

# you can add statements to the Lambda function's IAM Role here
  iamRoleStatements:
   - Effect: Allow
     Action:
       - ec2:StartInstances
       - ec2:StopInstances
       - ec2:DescribeInstances
       - ec2:DescribeInstanceStatus
       - ec2:CreateNetworkInterface
       - ec2:DescribeNetworkInterfaces
       - ec2:DeleteNetworkInterface
     Resource: "*"
     Condition:
       StringEquals:
         ec2:Region: us-east-1

   - Effect: Allow
     Action:
       - kms:Decrypt
     Resource: "*"


# you can define service wide environment variables here
  environment:
   B_ENV: lambda-jobs
   B_PRODUCTION: true

functions:
  startInstanceAndEtl:
    vpc:
      securityGroupIds:
        - my-sg
      subnetIds:
        - my-subnet
    handler: functions/startInstanceAndEtl.startInstanceAndEtl
    timeout: 120
    events:
    - schedule:
        name: 'startInstanceAndEtl_atomic_events'
        enabled: true
        description: 'startInstanceAndEtl_atomic_events'
        rate: cron(30 7 * * ? *)
        input:
          databaseName: 'atomic_events'
          clusterName: ingestor-only-atomic_events
          periodicity: default
    - schedule:
        name: 'startInstanceAndEtl_sales_per_marketing_channel_everyday'
        enabled: true
        description: 'startInstanceAndEtl_sales_per_marketing_channel_everyday'
        rate: cron(50 8 * * ? *)
        input:
          databaseName: 'sales_per_marketing_channel'
          clusterName: ingestor-only-sales_per_marketing
          periodicity: default
  startInstances:
    vpc:
      securityGroupIds:
        - my-sg
      subnetIds:
        - my-subnet
    handler: functions/startInstance.startInstances
    timeout: 120
    events:
    - schedule:
        name: 'start_ingestor_only_fact_sales_saturday'
        enabled: true
        description: 'start_ingestor_only_fact_sales_saturday'
        rate: cron(50 9 ? * SAT *)
        input:
          clusterName: ingestor_only_fact_sales
          periodicity: Saturday
      #fact_sale_per_sku_per_store
    - schedule:
        name: 'start_ingestor_only_fact_sale_per_sku_per_store_sun_to_fri'
        enabled: true
        description: 'start_ingestor_only_fact_sale_per_sku_per_store_sunday_through_friday'
        rate: cron(5 9 ? * SUN-FRI *)
        input:
          clusterName: ingestor_only_fact_sale_per_sku_per_store
          periodicity: default

# you can add CloudFormation resource templates here
#resources:
Resources:
 NewResource:
   Type: AWS::S3::Bucket
   Properties:
     BucketName: lambda-jobs
  • What stacktrace or error message from your provider did you see?
    Serverless Error ---------------------------------------
    An error occurred while provisioning your stack: StartInstancesEventsRuleSchedule1- <my_schedule>
    exists in stack arn:aws:cloudformation:us-east-1:...

Additional Data

  • Serverless Framework Version you're using: 1.6.1
  • Operating System: Elementary OS Freya
@pmuens pmuens added the bug label Feb 16, 2017
@christiansaiki
Copy link
Author

@christiansaiki
Copy link
Author

Just an update, when I removed the whole function and all it's schedules there was no problem to execute the command sls deploy

@christiansaiki
Copy link
Author

Another update
My way of removing the schedules was to do sls remove and than sls deploy. Nevertheless I had to do some manual stuff like adding a kms key to the lambda policy

But I figured out a better way, first remove the whole function that had the schedule that I wanted to remove. And than put back the function with all the schedules that I wanted to keep

@pmuens
Copy link
Contributor

pmuens commented Jan 15, 2019

Thanks for opening @christiansaiki 👍

Closing this issue since it's quite stale and we've implemented some improvements in the meantime. Feel free to reopen if this is still an issue!

@pmuens pmuens closed this as completed Jan 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants