TypeError: Cannot read property 'connection' of undefined

  • What’s your URL? https://cupofcodes.pl

  • What version of Ghost are you using? 3.21.0

  • What configuration? Production

  • What browser? ALL

  • What errors or information do you see in the console?
    App 95760 output: **********************/versions/3.20.3/core/shared/config/utils.js:103
    App 95760 output: delete database.connection.host;
    App 95760 output: ^
    App 95760 output:
    App 95760 output: TypeError: Cannot read property ‘connection’ of undefined
    App 95760 output: at exports.Provider.sanitizeDatabaseProperties (**************/versions/3.20.3/core/shared/config/utils.js:103:25)
    App 95760 output: at Object.loadNconf */versions/3.20.3/core/shared/config/index.js:52:11)
    App 95760 output: at Object. (
    /versions/3.20.3/core/shared/config/index.js:83:27)
    App 95760 output: at Module._compile (internal/modules/cjs/loader.js:1158:30)
    App 95760 output: at Object.Module._extensions…js (internal/modules/cjs/loader.js:1178:10)
    App 95760 output: at Module.load (internal/modules/cjs/loader.js:1002:32)
    App 95760 output: at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    App 95760 output: at Module.require (internal/modules/cjs/loader.js:1044:19)
    App 95760 output: at Module.require (/usr/local/lib/ruby/gems/2.5/gems/passenger-6.0.4/src/helper-scripts/node-loader.js:80:25)
    App 95760 output: at require (internal/modules/cjs/helpers.js:77:18)

  • What steps could someone else take to reproduce the issue you’re having?
    Install ghost 3.2x on passenger application server

earlier version 3.16 work after upgrade to 3.2x I have this issue.
Did anyone have something similar? ?

my config file

{
  "url": "https://cupofcodes.pl",
  "server": {
    "port": hidden,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "mysql",
    "connection": {
      "host": "hidden",
      "user": "hidden",
      "password": "hidden",
      "database": "hidden"
    }
  },
  "mail": {
    "transport": "Direct"
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "systemd",
  "paths": {
    "contentPath": "hiddent"
  }
}

Version 3.16.1 works

system

Debug Information:
    OS: FreeBSD, v11.3
    Node Version: v12.16.1
    Ghost Version: 3.21.0
    Ghost-CLI Version: 1.13.1
    Environment: production
    Command: 'ghost install --port 7072'

ghost cli 1.13 because latest version crash on yarn install dependencies with output

Downloading and installing Ghost v3.21.0
A ProcessError occurred.

Message: Command failed: yarn install --no-emoji --no-progress
SyntaxError: Unknown token: { line: 1, col: 0, type: 'INVALID', value: undefined } 1:0 in *******/.config/yarn
    at Parser.unexpected *********/.npm-global/lib/node_modules/ghost-cli/node_modules/yarn/lib/cli.js:64332:11)
    at Parser.parse *********/.npm-global/lib/node_modules/ghost-cli/node_modules/yarn/lib/cli.js:64463:14)
    at parse *********/.npm-global/lib/node_modules/ghost-cli/node_modules/yarn/lib/cli.js:64537:21)
    at module.exports.exports.default *********/.npm-global/lib/node_modules/ghost-cli/node_modules/yarn/lib/cli.js:64099:96)
    at loadRcFile *********/.npm-global/lib/node_modules/ghost-cli/node_modules/yarn/lib/cli.js:56942:58)
    at **********/.npm-global/lib/node_modules/ghost-cli/node_modules/yarn/lib/cli.js:56916:14
    at **********/.npm-global/lib/node_modules/ghost-cli/node_modules/yarn/lib/cli.js:101331:14
    at Array.map (<anonymous>)
    at parseRcPaths *********/.npm-global/lib/node_modules/ghost-cli/node_modules/yarn/lib/cli.js:101329:78)
    at Object.findRc *********/.npm-global/lib/node_modules/ghost-cli/node_modules/yarn/lib/cli.js:101343:10)

Someone can help ? What changed between ghost 3.16.1 and 3.2x ??

Problem solved. Before update config was in “current/core/server/config/env/” after upgrade config have to be in “current”

To be clear that hasn’t changed, config should always have been in the root directory of your install* so current is also the incorrect location.

We moved where config lives internally, but it should not have had any impact because no one should be editing the core folder.

Folder structure docs are here:

OK, thanks for reply and link

I get this error when I call ghost restart and ghost is not already running.

1 Like