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

Trying to create a destination with a name that is already in use causes 500 error #930

Open
stveit opened this issue Nov 1, 2024 · 0 comments
Labels
bug Something is not working as expected

Comments

@stveit
Copy link
Contributor

stveit commented Nov 1, 2024

This was tested via the Argus react frontend.

Backend v.1.16.0, API v1(stable), frontend v.1.14.1

The API returns a 500 error if you try to create a destination that has the same name, media type and belongs to the same user.

Steps to reproduce (example using email media, but should be the same for all media):

  1. Go to /destinations page
  2. Create an email destination with a name so the "title" field should not be empty (multiple destinations with a blank doesnt seem to cause any issues)
  3. Try to create another email destination with a unique and valid email address, but the same name as the first destination
  4. API will reply with a 500 error code

I'm pretty sure the error is caused by a this constraint:

models.UniqueConstraint(fields=["user", "media", "label"], name="unique_label_per_user_and_medium"),

API tries to save via the serializer, but an exception is thrown as the constraint is not met. The error is not handled anywhere so it ends in a 500 error.

Expected behaviour

I expected to see this happen: Probably a 400 code reply with the error message "Destination label must be unique per media", or something along those lines

@stveit stveit added the bug Something is not working as expected label Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working as expected
Projects
None yet
Development

No branches or pull requests

1 participant