New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Knex doesn't accept string parameters passed by Heroku #2570
Comments
Yup, tarn is very strict about passed parameters, and knex client doesn't have pretty much any tests so it seems to be broken. https://github.com/Vincit/tarn.js/blob/master/lib/Pool.js#L28 Indeed sounds like knex bug, that it is passing pool.max as string. |
The issue isn't really knex or knex-migrator, Ghost provides the config to knex-migrator and should be providing it with the correct type. The knex docs are plenty clear that it expects a number type for pool.max. Ghost uses nconf to parse the environment variables, its a simple fix to have nconf parse the data types. I've verified with a heroku Ghost deploy of my own that it works. Make a change in core/server/config/index.js around line 30 to add parseValues: true to the nconf.env config nconf.env({
separator: '__',
parseValues: true
}); |
@sdhawley thanks for investigating more, sounds like this is not knex bug after all then. |
@sdhawley how did you change that file and not have heroku get rid of changes when editing it, it appears that when you exit the dyno it destroys the changes |
@aldavies I edited the file in my local repo, committed it, and then pushed to heroku. Not sure what your setup looks like but if you don't have the change saved in the git repo it won't persist. |
@sdhawley Make the changes to core/server/config/index.js and push it to your repository. You need to add the 'parseValues:true' property.
|
When I run this command:
I get the following error:
I am using ghost@1.21.6 and a ClearDB database installed this way:
According to the answer I received from knex-migrator when filing a bug, the issue could be between heroku and knex: the
database__pool__max
value would be passed as a string by heroku but not converted to integer by knex.I am wondering how Ghost/Heroku deployment procedures I have found (like this) could work with such an issue.
Did anybody else encounter the same issue?
Environment
Knex-migrator version: 3.1.5
Knex version: 0.14.4
Database + version: ClearDB MySQL
OS: Ubuntu 16.04
The text was updated successfully, but these errors were encountered: