[SOLVED] Setting up mailgun config for ghostcms, after restart got this error

Hello, hope you’re doing well!

My YunoHost server

Hardware: VPS bought online, Linode
YunoHost version: 4.3.6.3
I have access to my server : Through SSH and through the webadmin
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no
If yes, please explain:

Description of my issue

Edited my /var/www/ghost/config.production.json file, as told by [SOLVED] Where can I edit the files for my apps? - #2 by ericg

Logs: hastebin

Followed the tutorial here: https://bironthemes.com/blog/ghost-mailgun-config/

Make sure to restart Ghost systemd service after your config changes (in the web admin)…

I did, that’s what prompted the error :cry:

I tried doing it again, keeps showing the same error as here hastebin

Error: Error parsing your configuration file: [/var/www/ghost/config.production.json]: Unexpected string in JSON at position 645

On peut voir ton bloc json à la ligne 645 ?

This is all I have in my JSON file, only 44 lines.

                                                                       /var/www/ghost/config.production.json                                                                         Modified  

        "level": "info",
        "rotation": {
            "enabled": true
        },
        "transports": ["file", "stdout"]
    }
}

"mail": {  
  "transport": "SMTP",  
  "options": {  
    "service": "Mailgun",  
    "host": "smtp.mailgun.org",  
    "port": "587",  
    "secure": true,
    "auth": {  
      "user": “postmaster@daily-bing.perthmod.com",
      "pass": "censored"  
    }  
  }  
}  

























^G Get Help     ^O Write Out    ^W Where Is     ^K Cut Text     ^J Justify      ^C Cur Pos      M-U Undo        M-A Mark Text   M-] To Bracket  M-Q Previous    ^B Back         ^◀ Prev Word
^X Exit         ^R Read File    ^\ Replace      ^U Uncut Text   ^T To Spell     ^_ Go To Line   M-E Redo        M-6 Copy Text   ^Q Where Was    M-W Next        ^F Forward      ^▶ Next Word

try with a comma (ligne 7), and share the full config (without the private info) as you need { and } at the beginning and at the end of your JSON config

 "level": "info",
        "rotation": {
            "enabled": true
        },
        "transports": ["file", "stdout"]
    }
},

"mail": {  
  "transport": "SMTP",  
  "options": {  
    "service": "Mailgun",  
    "host": "smtp.mailgun.org",  
    "port": "587",  
    "secure": true,
    "auth": {  
      "user": “postmaster@daily-bing.perthmod.com",
      "pass": "censored"  
    }  
  }  
}  

modified json file :slight_smile:

{
    "url": "https://daily-bing.perthmod.com/",
    "server": {
        "host": "127.0.0.1",
        "port": 4010
    },
    "database": {
        "client": "mysql",
        "connection": {
            "socketPath" : "/run/mysqld/mysqld.sock",
            "user"       : "ghost",
            "password"   : "censored",
            "database"   : "ghost"
        }
    },
    "auth": {
        "type": "password"
    },
    "paths": {
        "contentPath": "content/"
    },
    "logging": {
        "level": "info",
        "rotation": {
            "enabled": true
        },
        "transports": ["file", "stdout"]
    }
}

"mail": {  
  "transport": "SMTP",  
  "options": {,  
    "service": "Mailgun",  
    "host": "smtp.mailgun.org",  
    "port": "587",  
    "secure": true,
    "auth": {,  
      "user": “postmaster@daily-bing.perthmod.com",
      "pass": "censored"  
    }  
  }  
}  

got this error still hastebin

try like this:

{
    "url": "https://daily-bing.perthmod.com/",
    "server": {
        "host": "127.0.0.1",
        "port": 4010
    },
    "database": {
        "client": "mysql",
        "connection": {
            "socketPath" : "/run/mysqld/mysqld.sock",
            "user"       : "ghost",
            "password"   : "censored",
            "database"   : "ghost"
        }
    },
    "auth": {
        "type": "password"
    },
    "paths": {
        "contentPath": "content/"
    },
    "logging": {
        "level": "info",
        "rotation": {
            "enabled": true
        },
        "transports": ["file", "stdout"]  
	},
	"mail": {  
	  "transport": "SMTP",  
	  "options": {  
	    "service": "Mailgun",  
	    "host": "smtp.mailgun.org",  
	    "port": "587",  
	    "secure": true,
	    "auth": { 
	      "user": "posbing.perthmod.com",
	      "pass": "censored"  
	      }
	    }
	}
}

Edit: you can check your JSON file with a JSON parser like http://json.parser.online.fr/ . It will highlight the formatting errors.

1 Like
Error: Error parsing your configuration file: [/var/www/ghost/config.production.json]: Unexpected token “ in JSON at position 354
Jun 29 14:08:51 node[9004]:     at exports.File.File.loadSync (/var/www/ghost/node_modules/nconf/lib/nconf/stores/file.js:170:11)
Jun 29 14:08:51 node[9004]:     at exports.Provider.Provider.add (/var/www/ghost/node_modules/nconf/lib/nconf/provider.js:136:23)
Jun 29 14:08:51 node[9004]:     at exports.Provider.Provider.file (/var/www/ghost/node_modules/nconf/lib/nconf/provider.js:63:15)
Jun 29 14:08:51 node[9004]:     at Object.loadNconf (/var/www/ghost/core/shared/config/loader.js:32:11)
Jun 29 14:08:51 node[9004]:     at Object.<anonymous> (/var/www/ghost/core/shared/config/index.js:3:25)
Jun 29 14:08:51 node[9004]:     at Module._compile (internal/modules/cjs/loader.js:1085:14)
Jun 29 14:08:51 node[9004]:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
Jun 29 14:08:51 node[9004]:     at Module.load (internal/modules/cjs/loader.js:950:32)
Jun 29 14:08:51 node[9004]:     at Function.Module._load (internal/modules/cjs/loader.js:790:12)
Jun 29 14:08:51 node[9004]:     at Module.require (internal/modules/cjs/loader.js:974:19)

As @ericg mentioned, you should check the validity of your JSON, there seems to be syntax errors.

No errors when using http://json.parser.online.fr/

look for and replace it by " instead

Worked, tysm

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.