Skip to content

Deleting a template and recreating it causes 500 errors #1582

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

Closed
deansheather opened this issue May 19, 2022 · 1 comment
Closed

Deleting a template and recreating it causes 500 errors #1582

deansheather opened this issue May 19, 2022 · 1 comment
Labels
api Area: HTTP API

Comments

@deansheather
Copy link
Member

deansheather commented May 19, 2022

OS Information

  • OS: Linux
  • Architecture: amd64
  • coder --version: Coder v0.0.0-devel+c034e83 Wed May 18 23:15:19 UTC 2022
    c034e83

Steps to Reproduce

  1. create a template from an example like gcp-linux
  2. delete it with coder templates delete gcp-linux
  3. recreate the same template with the same name
  4. status code 500: execute transaction: insert template: pq: duplicate key value violates unique constraint "templates_organization_id_name_key"

Expected

You should be able to recreate templates

Actual

We are not clearing columns that have unique constraints, so you can't create a template with the same name twice in the same org.

Logs

Screenshot

image

Notes

In v1 we resolved this problem when we soft-deleted users by randomizing all of the unique fields (i.e. setting to a random UUID). Seems like this could be solved by renaming the template to a new UUID on deletion.

@misskniss misskniss added the api Area: HTTP API label May 24, 2022
@kylecarbs kylecarbs changed the title Bug: deleting a template and recreating it causes 500 errors Deleting a template and recreating it causes 500 errors Jun 7, 2022
@deansheather
Copy link
Member Author

Fixed by #2454

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Area: HTTP API
Projects
None yet
Development

No branches or pull requests

2 participants