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 · 0 comments
Open
3 of 4 tasks

Can not delete EventBridge rule target & EventBridge rule #6671

lampvux opened this issue Nov 18, 2024 · 0 comments
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

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
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. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant