Error release command failed - ERROR 42501 (insufficient_privilege) permission denied to create extension "timescaledb"

Hi all,

I’m deploying my first Phoenix app. I had a lot of work to do managing build time secrets in my Dockerfile, but all good now. However, it fails at:

image size: 151 MB
==> Creating release
--> release v2 created

--> You can detach the terminal anytime without stopping the deployment
==> Release command detected: /app/bin/migrate

--> This release will not be available until the release command succeeds.
Error release command failed, deployment aborted

I can see this in fly logs (I followed Troubleshooting · Fly Docs), any tips:

2023-02-16T10:34:44Z app[5f5a6c9d] lhr [info]Preparing to run: `/app/bin/migrate` as nobody
2023-02-16T10:34:44Z app[5f5a6c9d] lhr [info]2023/02/16 10:34:44 listening on 
2023-02-16T10:34:48Z app[5f5a6c9d] lhr [info]10:34:48.614 [info] execute "CREATE EXTENSION IF NOT EXISTS timescaledb"
2023-02-16T10:34:48Z app[5f5a6c9d] lhr [info]** (Postgrex.Error) ERROR 42501 (insufficient_privilege) permission denied to create extension "timescaledb"
2023-02-16T10:34:48Z app[5f5a6c9d] lhr [info]    hint: Must have CREATE privilege on current database to create this extension.

I did this after the first failure, so TimescaleDB is enabled - Enable TimescaleDB · Fly Docs

I’ve even tried this:

fly pg connect --app xxxxxxx-db 
Connecting to fdaa:1:55ae:a7b:8e:cae1:349e:2... complete
psql (14.6 (Debian 14.6-1.pgdg110+1))
Type "help" for help.

postgres=# ALTER role postgres superuser 



I’ll logged in to the db and ran the create extension by hand. Not sure why this failed?


1 Like

I’m not sure if the regular user has superuser privileges, I brought this up to the people who work on the database stuff. The guides recommend logging directly like you did and doing create extension but I don’t see a reason why the migration user couldn’t. Enable TimescaleDB · Fly Docs

1 Like

Yeah, it breaks a lot of automation really.