Skip to content

Conversation

@EnriqueCanals
Copy link
Contributor

I have done some digging into what could possibly be causing this issue, but to no avail. It seems as though the ResourceConflictException error that is expected if a resource already exists doesn't get returned when the previously created resource is one that was created via the Lambda console for ScheduleEvent triggers- see this line in schedule_events.js to see where this error is expected to be present for existing resources.

So, if the trigger you're trying to add to the Lambda is already there because it was added manually via the Lambda UI/console, including it via the eventSourceFile will result in a duplicate trigger being added since the Lambda SDK interprets those as separate resources for some reason (even though the SourceArn is identical).

I can try to work on a fix for this later this week/weekend, but for now I figured including it in the docs might be useful if anyone out there is experiencing this issue.

If you'd like to recreate the issue for yourself, try the following:

  • In the trigger section for a Lambda- click on Add Trigger
  • In the next prompt, select CloudWatch Events - Schedule
  • Next, select the rule you want and Submit.
    • You should now see a CloudWatch Event trigger for your function in the console
  • Next, include the same event rule in your eventSourceFile and deploy.
  • Finally, return to the triggers section in the Lambda console and you will see 2 identical triggers for your lambda.

@abetomo
Copy link
Contributor

abetomo commented May 16, 2017

Thank you.

Schedule events are managed by StatementId. (https://github.com/motdotla/node-lambda/blob/master/lib/schedule_events.js#L53)
Duplicate checks are made accordingly.

I think that two events are registered because the numbering rule of node-lambda is different from that of the web console.

It seems difficult to check the duplication with the event created from the web console from the prepared API.

When operating with node-lambda it may be better to note the content that you should refrain from using the web console.

@DeviaVir DeviaVir merged commit ca9ed8f into motdotla:master May 16, 2017
@DeviaVir DeviaVir mentioned this pull request Jun 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants