Adonisjs Migration - MySQL using password no
Trying to deploy an app on railway with adonisjs and a MySQL database, I can get the web app running correctly, but trying to connect to the db errors out.
I think I've narrowed down the error to being related to the adonisjs mysql driver, not passing in the correct env variables, but will need to troubleshoot more. Wanted to see if anyone else had experienced this error
14 Replies
Project ID:
N/A
can you show a screenshot of your service variables
@elquesobandito ^^
Hey @Brody sorry, just seeing this now I can share the variables shortly
I also just tested using PG instead of MySQL for a database and the deployment / migration went off without a hitch
so it's definitely something in how Adonis (or Knex as the database service layer) is handling the MySQL connection
Here's all the variables I have for the working PgSQL version, its just a testing deploy so nothing in here that really needs to be kept secret
The MySQL deploy was the same just with
DB_CONNECTION=pg
and then MYSQL_USER=${{MySQL.MYSQLUSER}}
for that servicewell I'm interested in seeing the variables for the service that isn't working not one that is working lol
screenshot of the service variables with everything that's not sensitive in the slightest shown please
Sorry, I get what you're saying but I already swapped out the MySQL service for PG so I'll have to go back recreate it. When I have a couple minutes I'll just spin up a fresh adonis web project with MySQL and commit it to a public repo
well hold on, if you are happy with postgres so am i
For now I can confirm that there's some sort of issue using the base config MySQL in adonisjs and that using postgresql resolves the issue
postgres uses significantly less memory than mysql, so i am more than happy to say the solution is to simply use postgres
but more likely than not, it was probably just a misconfiguration in the service variables
that accounts for most database connection issue i have seen
yeah, it's definitely possible, I'll still spin up a new project just to test and out and see cause now I'm more curious myself haha
fair enough, id still be down to help out though
sounds good, I'll start it now and post a link to the public repo
The other thing is that Adonisjs is about to release a new major version, v6, but I don't have access to that code base yet, so not sure if the issue (if it is an issue and not just wrong env variables) will still exist
wait and see!
wait, I just remembered I had a copy of the original env config from when I was testing it out too, aaaaaaaaand it looks like
.PASSWORD
is missing the .MYSQL
infront of itthere you go
🙂