Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

chicag0's avatar

Some Jobs throw Unknown database on Laravel Vapor

I'm running a Laravel site using Vapor, and for the most part everything has been working great for several months. I am using RDS as well as RDS Proxy.

When poking around in the Logs I noticed that some percentage of my Jobs, maybe something like 10-15% fail with PDOException: SQLSTATE[42000]: Syntax error or access violation: 1049 Database Unknown database 'siteName' in /var/task/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php:75

It is not always the same Jobs that fail, and most work fine, so I cant seen to sort out why it would use the wrong DB Name. The "wrong name" is my sites app_name, but in lowercase

In my vapor.yml I set database: my-rds-name and database-proxy: true and that works great -- and then in my .env.production I set the actual database name DB_DATABASE=sitename.com-production

I set the DB name in the .env because I have multiple "databases" inside RDS that are used by other Laravel sites.

Has anyone seen this issue before?

0 likes
0 replies

Please or to participate in this conversation.