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

Can not delete EventBridge rule target & EventBridge rule #6671

Open
3 of 4 tasks
lampvux opened this issue Nov 18, 2024 · 2 comments
Open
3 of 4 tasks

Can not delete EventBridge rule target & EventBridge rule #6671

lampvux opened this issue Nov 18, 2024 · 2 comments
Assignees
Labels
bug This issue is a bug. closing-soon This issue will automatically close in 4 days unless further comments are made. p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.

Comments

@lampvux
Copy link

lampvux commented Nov 18, 2024

Checkboxes for prior research

Describe the bug

I used AWS sdk v3 to delete eventbridge Rule Target & Rule, the response returned with both httpStatusCode 200. But the rule does not removed.

I used this aws lambda function to invoke :

    import {
      RemoveTargetsCommand,
      EventBridgeClient,
      DeleteRuleCommand
    } from "@aws-sdk/client-eventbridge";

    export const handler = async (event, context) => {
      try {
        // after delete an webhook, delete the rule target in event bridge
        const eventbridgeConfig = {};
        const client = new EventBridgeClient(eventbridgeConfig);
        const removeTargetsParams = {
          EventBusName: "lam",
          Force: true,
          Ids: [`my-id`], // required
          Rule: "my-rule", // required
        };
    
        const command = new RemoveTargetsCommand(removeTargetsParams);
        const response = await client.send(command);
    
        if (response.$metadata.httpStatusCode === 200) {
          // after the api destination is deleted, delete the rule in event bridge
          const deleteRuleParams = {
            EventBusName: process.env.EVENTBUS_NAME || 'default',
            Force: true,
            Name: "my-rule", // required
          };
          
          const deleterulecommand = new DeleteRuleCommand(deleteRuleParams);
          const response = await client.send(deleterulecommand);      
        }
      } catch (err) {
        console.error(err);
      }
    };

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

"@aws-sdk/[email protected]"

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

20.16.0

Reproduction Steps

use the lambda function above and test it with the id target rule & rule name

Observed Behavior

returned both success with delete target & rule :

{
  '$metadata': {
    httpStatusCode: 200,
    requestId: '20ab194e-93ae-4db9-b08b-80ca7195f59e',
    extendedRequestId: undefined,
    cfId: undefined,
    attempts: 1,
    totalRetryDelay: 0
  },
  FailedEntries: [],
  FailedEntryCount: 0
}

But no rule was deleted. I checked in the AWS Dashboard Console

Expected Behavior

EventBridge Rule deleted

Possible Solution

No response

Additional Information/Context

No response

@lampvux lampvux added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 18, 2024
@lampvux lampvux changed the title Can not delete event bridge rule target & event bridge rule Can not delete EventBridge rule target & EventBridge rule Nov 18, 2024
@RanVaknin
Copy link
Contributor

Hi @lampvux ,

Thanks for reaching out. This sounds like an API limitation, and not something related to the SDK.

From the Eventbridge docs:

When you delete a rule, incoming events might continue to match to the deleted rule. Allow a short period of time for changes to take effect.

Are you able to see the rule deleted if you wait a bit?

Thanks,
Ran~

@RanVaknin RanVaknin self-assigned this Dec 6, 2024
@RanVaknin RanVaknin added response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Dec 6, 2024
Copy link

This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. closing-soon This issue will automatically close in 4 days unless further comments are made. p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants