Cannot delete my Ory Project
Preflight checklist
- [X] I could not find a solution in the existing issues, docs, nor discussions.
- [X] I agree to follow this project's Code of Conduct.
- [X] I have read and am following this repository's Contribution Guidelines.
- [X] This issue affects my Ory Cloud project.
- [X] I have joined the Ory Community Slack.
- [X] I am signed up to the Ory Security Patch Newsletter.
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>"
- 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
@zepatrik PTAL
It worked for me (https://github.com/ory/network/discussions/217#discussioncomment-4717198).
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
@hperl
I guess we have to add ON DELETE CASCADE? Somehow missed this issue until now...
Fixed via https://github.com/ory/keto/commit/0dd2ba9dc67bb0431d2a80d95e92fc18e5290843