W
Wasp•5w ago
andkho

Pg-Boss error

Hi everyone, I'm trying to deploy my wasp app using fly managed postgres, just cause is better for production. But I get this error: [info] Starting pg-boss... [info] pg-boss failed to start! [info] error: permission denied for database fly-db Usually I would be tempted to say that just the DATABASE_URL is wrong, but all the DB migrations with Prisma worked, schema has been generated and I have 40 records inside the _prisma_migrations table. This quick fix helped to get the app running: https://www.answeroverflow.com/m/1098429088164753498 But at some point I may want to use jobs, any ideas on a solution?
pg-boss failed to start! - Wasp
Hey guys, I'm pretty new to Wasp (first day) and also have little experience with Node.js. All my web experience was with Python (Flask). I installed Wasp and created a project based on SaaS, at first everything ran very well, I was able to configure the login through Google and everything worked perfectly. I went to restart the server and aft...
3 Replies
kapa.ai
kapa.ai•5w ago
Hi @andkho. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The error message:
pg-boss failed to start!
error: permission denied for database fly-db
pg-boss failed to start!
error: permission denied for database fly-db
suggests that while your Prisma migrations are working (meaning your DATABASE_URL is correct for Prisma), pg-boss is unable to connect due to insufficient permissions on the database. Key points from the knowledge sources: - pg-boss requires your app's database user to have sufficient privileges to create and manage its own schema and tables (it creates a schema called pgboss and several tables) [Declaring Jobs]. - Prisma migrations working does not guarantee that the user has all the permissions pg-boss needs. - This issue has been reported by others, and a common workaround is to comment out the jobs declaration in your Wasp file, which disables pg-boss and allows the app to start [Discord thread]. - However, if you want to use jobs, you will need to resolve the permission issue. What you can do: 1. Check Database User Permissions:
Ensure the user specified in your DATABASE_URL has the necessary privileges on the Fly Postgres database. The user must be able to create schemas and tables. You may need to connect to your database and run:
GRANT CREATE ON DATABASE fly-db TO <your_user>;
GRANT USAGE, CREATE ON SCHEMA public TO <your_user>;

GRANT CREATE ON DATABASE fly-db TO <your_user>;
GRANT USAGE, CREATE ON SCHEMA public TO <your_user>;

(Replace <your_user> with the actual username from your DATABASE_URL.) 2. Verify the Database URL:
Double-check that the DATABASE_URL used by your deployed app is the same one used for migrations, and that it points to the correct database and user. 3. Fly.io Database Setup:
If you are using Fly.io's managed Postgres, make sure you are using the correct credentials and that the user has not been restricted in a way that prevents schema/table creation. Sometimes, the default user may have limited permissions. 4. If you only need a workaround:
As you found, commenting out the jobs declaration disables pg-boss and avoids the error, but you will not be able to use background jobs until the permission issue is resolved [Discord thread]. Summary:
The root cause is almost certainly a permissions issue for the database user with respect to schema/table creation required by pg-boss. You will need to adjust your database user's privileges on Fly.io to resolve this and enable jobs in your Wasp app. If you need more detailed steps for Fly.io specifically, the knowledge sources do not provide them, but the general approach above should guide you in the right direction. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @andkho, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
miho
miho•5w ago
We should try Wasp with Managed Postgres ourselves to see what's going on 👍 thanks for the report!
miho
miho•5w ago
Created an issue for us to check it out: https://github.com/wasp-lang/wasp/issues/3010
GitHub
PgBoss and Managed Postgres on Fly.io error · Issue #3010 · wasp-...
We should research if PgBoss works with Managed Postgres: [info] Starting pg-boss... [info] pg-boss failed to start! [info] error: permission denied for database fly-db Based on: https://discord.co...

Did you find this page helpful?