Skip to content

DELETE method with body for API method returning BAD REQUEST 400

0

I have a canary for an API GATEWAY. In this canary I have multiple steps, create a record via POST and do a GET method and clean up via DELETE method. DELETE method contains a body and always giving me error BAD REQUEST 400. I checked the logs on the lambda function for this canary and returning below message:

{ "state": "FAILED", "testRunError": ""400 Bad Request for step: api.something.com/v0/users/something-guid/permissions"", "executionResult": "SUCCEEDED", "executionError": "null", "artifactLocation": "some s3 location here", "startTime": 1722392837.814, "endTime": 1722392869.61, "resetTime": 0.001, "setupTime": 0.033, "launchTime": 5.451, "customerStepsStartTime": 1722392837.814, "customerStepsEndTime": 1722392869.251, "visualReference": null, "tmpSizeMB": "1040", "tmpUsagePercent": "20" }

All other DELETE methods in my other canaries are working fine. This same DELETE method is tested in postman and via curl and no issues. Problem is only via cloudwatch synthetics.

Anyone running into same problem? Please help. I already raised AWS support but they are not able to help me, going around and around, Im already dizzy.

1 Answer
0

Hello,

The issue is likely due to the DELETE method having a body, which is not allowed in API Gateway. Try removing the body from the DELETE method or changing the method to a POST or PUT, which allow bodies. This should resolve the 400 Bad Request error.

Additionally, you can check the API Gateway settings to ensure that the DELETE method is configured correctly and allows bodies. If the issue persists,

https://apidog.com/articles/http-delete-request-body/#sending-delete-request-with-body

EXPERT

answered 2 years ago

  • Hi Kranthi, thanks for your reply.

    However the issue only happens for cloudwatch synthetics canary for the API. The API GATEWAY has no problem with the DELETE method with a request body. Also testing the API via postman or via curl is successful.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.