influxdata / influxdata/influxdb
InfluxDB 2: Cannot find buckets after delete organization
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
The **Internal Server Error** occurs when I try find `buckets` after delete an organization
```bash
# Create organization
--> POST http://127.0.0.1:9999/api/v2/orgs
--> {"name":"Constant Pro1584083712360-IT","status":"active"}
<-- 201 Created http://127.0.0.1:9999/api/v2/orgs
<-- {
"links": {
"buckets": "/api/v2/buckets?org=Constant Pro1584083712360-IT",
"dashboards": "/api/v2/dashboards?org=Constant Pro1584083712360-IT",
"labels": "/api/v2/orgs/2baf67eea476317e/labels",
"logs": "/api/v2/orgs/2baf67eea476317e/logs",
"members": "/api/v2/orgs/2baf67eea476317e/members",
"owners": "/api/v2/orgs/2baf67eea476317e/owners",
"secrets": "/api/v2/orgs/2baf67eea476317e/secrets",
"self": "/api/v2/orgs/2baf67eea476317e",
"tasks": "/api/v2/tasks?org=Constant Pro1584083712360-IT"
},
"id": "2baf67eea476317e",
"name": "Constant Pro1584083712360-IT",
"description": "",
"createdAt": "2020-03-13T08:15:12.381838+01:00",
"updatedAt": "2020-03-13T08:15:12.381838+01:00"
}
### Delete organization
--> DELETE http://127.0.0.1:9999/api/v2/orgs/2baf67eea476317e
<-- 204 No Content http://127.0.0.1:9999/api/v2/orgs/2baf67eea476317e
# Find buckets
--> GET http://127.0.0.1:9999/api/v2/buckets
<-- 500 Internal Server Error http://127.0.0.1:9999/api/v2/buckets
<-- {
"code": "internal error",
"message": "finding organization mapping for user 7306a90a879e9a2a: organization not found"
}
```
__Steps to reproduce:__
1. Create organization
2. Delete this organization
3. Find buckets
__Expected behavior:__
Return buckets.
__Actual behavior:__
```
error api error encountered {"log_id": "0LWglbJ0000", "error": "finding organization mapping for user 7306a90a879e9a2a: organization not found"}
```
__Environment info:__
* InfluxDB version: docker v2.0.0-beta.6, latest nightly build
Probably caused by https://github.com/influxdata/influxdb/pull/17117 cc @gavincabbage
Contributor guide
Research direction
Start by reproducing the organization create/delete sequence and the subsequent GET /api/v2/buckets request against the InfluxDB API. Review the behavior associated with pull request 17117 and trace the organization lookup reported in the error. Done means querying buckets after deleting an organization no longer returns a 500 internal error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100