neonctl
neonctl copied to clipboard
create-app (aka bootstrap) by default assumes that `neondb_owner` user already exists
neonctl bootstrap (aka create-app) by default assumes that neondb_owner user already exists and at the same time doesn't accept owner_name as a parameter
Steps to reproduce
- Create some project and database, don't use
neondbname. - Make sure that
neondb_owneruser doesn't exists. - Run
neonctl bootstrap
Expected result
-
neondb_owneruser is created if not exists
Actual result
<REDACTED>
✔ What Neon project would you like to use? › some_existing_project
Branch
┌─────────────────────────┬────────────────┬─────────┬─────────┬──────────────────────┬──────────────────────┐
│ Id │ Name │ Primary │ Default │ Created At │ Updated At │
├─────────────────────────┼────────────────┼─────────┼─────────┼──────────────────────┼──────────────────────┤
│ br-misty-bonus-a29xcad8 │ dev/y8pjG4iG3d │ false │ false │ 2024-08-23T20:41:21Z │ 2024-08-23T20:41:21Z │
└─────────────────────────┴────────────────┴─────────┴─────────┴──────────────────────┴──────────────────────┘
INFO: Resource is locked. Waiting 3000ms before retrying...
ERROR: database owner not found
which under the hood comes from
curl -i --request POST \
--url https://console.neon.tech/api/v2/projects/ancient-bush-51935299/branches/br-blue-surf-a2a0d1bc/databases \
--header "Authorization: Bearer $token" \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"database": {
"name": "slo",
"owner_name": "casey"
}
}
'
HTTP/2 422
{"code":"","message":"database owner not found"}
Nice to have
additional --owner-name flag where you can define it. ~~I think it could also be created if not exist but that's debatable~~ otherwise this could be reused https://github.com/neondatabase/neonctl/blob/76f9b9fabb2c56c30e8f930a142f2d11532e5419/src/commands/databases.ts#L80-L93