adobe / spacecat-api-service

Edge Delivery services experience success as a service automation: SpaceCat + Star Catalogue
Apache License 2.0
3 stars 1 forks source link

Key Event POST new event with non-existent Type will timeout #359

Open iustinp opened 2 weeks ago

iustinp commented 2 weeks ago

Description Trying to create a new key event of a type other than the existing ones, will result in request timing out.

To Reproduce E.g. Try adding a key of type: "type"

Expected behavior Request should return an error.

AndreiAlexandruParaschiv commented 4 days ago

hey @iustinp, this shouldn't happen as there is a validation check for types in place here: https://github.com/adobe/spacecat-shared/blob/6bed3412af558946575f9f6be6d313ff0511db40/packages/spacecat-shared-data-access/src/models/key-event.js#L68-L70 In case a type is not in the KEY_EVENT_TYPES set, it will throw an error like below:


{
    "message": "Unknown value for \"type\": type"
}

The status code is 500 Internal Server error but it should a 400 - Bad Request as the type is incorrect.

iustinp commented 4 days ago

Hello! Indeed, i was able to see that the timeout-like behaviour is induced by Power Automate HTTP request action, because while the response from the spacecat API is instant (with the details you provided), the automation only fails after ~25minutes. I will add extra checks on my side and also look to optimise the flow to throw such errors much faster. In the meantime this probably can stay up for the wrong status code. Thank you for looking into this!