Required System information
Node.js version: v18.16.0 NPM version: v9.5.1 Strapi version: v4.11.0 Database:ClearDB Operating system: macOS Monterey version 12.6.6 Is your project Javascript or Typescript:JS
Describe the bug
Trying to deploy Strapi on Heroku with ClearDB fails due to error "unable to acquire a connection"
Steps to reproduce the behavior
1.- Open an account on Heroku. 2.- Create an app (following the Strapi-Heroku deployment guide) 3.- Install the ClearDB add-on. 4.- Modify ./config/database.js to
const path = require('path');
module.exports = ({ env }) => {
const client = 'mysql';
const connections = {
mysql: {
connector: 'bookshelf',
settings: {
client: 'mysql',
host: 'XX',
port: '3306',
database: 'XXX',
username: 'XXX',
password: 'XXX',
options: {
dialectOptions: {
supportBigNumbers: false,
bigNumberStrings: false,
},
ssl:false
},
},
},
};
return {
connection: {
client,
...connections[client],
},
};
};
package.json:
"name": "my-api",
"private": true,
"version": "0.1.0",
"description": "A Strapi application",
"scripts": {
"develop": "strapi develop",
"start": "strapi start",
"build": "strapi build",
"strapi": "strapi"
},
"dependencies": {
"@strapi/plugin-i18n": "^4.11.0",
"@strapi/plugin-users-permissions": "4.11.0",
"@strapi/strapi": "4.11.0",
"dotenv": "^16.1.4",
"knex": "^2.4.2",
"mysql": "^2.18.1"
"mysql2": "^3.5.0"
},
"author": {
"name": "A Strapi developer"
},
"strapi": {
"uuid": "b106d56a-d879-475a-ab20-8ba1926a3c0b"
},
"engines": {
"node": "18.16.0",
"npm": "9.5.1"
},
"license": "MIT"
}
Expected behavior
Deployment is OK and admin opens. Error msg after running npm run develop
Error: Unable to acquire a connection
at Client_MySQL.acquireConnection (/Users/xx/node_modules/@strapi/database/node_modules/knex/lib/client.js:303:13)
at Runner.ensureConnection (/Users/xx/node_modules/@strapi/database/node_modules/knex/lib/execution/runner.js:287:46)
at Runner.run (/Users/xx/node_modules/@strapi/database/node_modules/knex/lib/execution/runner.js:30:30)
at Target.then (/Users/xx/node_modules/@strapi/database/node_modules/knex/lib/builder-interface-augmenter.js:24:43)
Error msg from heroku logs
debug: ⛔️ Server wasn't able to start properly.
error: Cannot set properties of undefined (setting 'supportBigNumbers')
TypeError: Cannot set properties of undefined (setting 'supportBigNumbers')
at MysqlDialect.configure (/app/node_modules/@strapi/database/lib/dialects/mysql/index.js:20:60)
at new Database (/app/node_modules/@strapi/database/lib/index.js:32:18)
at Database.init (/app/node_modules/@strapi/database/lib/index.js:121:14)
at Strapi.bootstrap (/app/node_modules/@strapi/strapi/lib/Strapi.js:421:30)
at Strapi.load (/app/node_modules/@strapi/strapi/lib/Strapi.js:492:16)
at async Strapi.start (/app/node_modules/@strapi/strapi/lib/Strapi.js:218:9)
npm notice
npm notice New minor version of npm available! 9.5.1 -> 9.7.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.7.1
npm notice Run npm install -g npm@9.7.1 to update!
npm notice
Process exited with status 1
Other Context
-Heroku config vars includes all the Keys/Values for username, password, database, port, host, ssl:false, name -application worked as expected via the heroku default database SQLite
Connection to ClearDB database is successful when testing via Sequel Pro application with the credentials directly referenced in the code (ie host, username, password, port) to debug I have hard coded in the credentials directly into the database.js, rather than via the .env