network icon indicating copy to clipboard operation
network copied to clipboard

Cannot delete my Ory Project

Open Benehiko opened this issue 3 years ago • 1 comments

Preflight checklist

Describe the bug

When deleting my Ory project using the APIs I get an error:

{"error":{"code":500,"status":"Internal Server Error","request":"6caaf7b8-1a72-9cf0-b0ab-f9d537487516","message":"ERROR: delete on table \"ory_keto_networks\" violates foreign key constraint \"keto_relation_tuples_nid_fk\" on table \"keto_relation_tuples\" (SQLSTATE 23503)"}}

Reproducing the bug

1, Call the API

curl -X DELETE https://api.console.ory.sh/projects/<project-id> -H "Accept: application/json" --cookie "<your cookies>"
  1. Get error message

Relevant log output

No response

Relevant configuration

No response

Version

latest

On which operating system are you observing this issue?

Ory Cloud

In which environment are you deploying?

Ory Cloud

Additional Context

https://ory-community.slack.com/archives/C02MR4DEEGH/p1660659578640199

Benehiko avatar Aug 17 '22 21:08 Benehiko

@zepatrik PTAL

aeneasr avatar Aug 17 '22 22:08 aeneasr

It worked for me (https://github.com/ory/network/discussions/217#discussioncomment-4717198).

vinckr avatar Jan 18 '23 12:01 vinckr

I now got the same error with one of my testing projects. It seems you cant delete projects that have namespaces/relationships. You can reproduce like this:

  • ory create project
  • create a namespace and a relationship
  • use the above command to delete and get error
  • remove namespace & relationship
  • voila you can delete the project

vinckr avatar Jan 24 '23 22:01 vinckr

@hperl

aeneasr avatar Jan 25 '23 06:01 aeneasr

I guess we have to add ON DELETE CASCADE? Somehow missed this issue until now...

zepatrik avatar Jan 25 '23 09:01 zepatrik

Fixed via https://github.com/ory/keto/commit/0dd2ba9dc67bb0431d2a80d95e92fc18e5290843

jonas-jonas avatar Jan 30 '24 12:01 jonas-jonas