2017-10-11 22 views
0

基本的に、私はHerokuにデプロイされたアプリケーションを持っています。今、私はClearDBアドオンに接続しようとしていますが、奇妙なエラーがあります。ここでNode.jsを使用してHerokuでClearDB MySQLに接続できません

は私のHerokuのの設定です:

C:\Users\GDrAnimal\Self-Project\Facebook Bot>heroku config 
=== arcane-forest-17003 Config Vars 
DATABASE_URL: mysql://b9490a25809735:[email protected]/heroku_1d0d2358c241fd0?reconnect=true 

そしてここでは、私のコードはNodejs

var mysql = require('mysql'); 

//Database 
var connection = mysql.createConnection({ 
    host: "us-cdbr-iron-east-05.cleardb.net", 
    user: "b9490a25809735", 
    password: "37eb78b5" 
    database: 'heroku_1d0d2358c241fd0' 
}); 

connection.connect(); 

app.get('/', (req, res) => { 
    connection.query('SELECT * from Student_Bot', function(err, rows, fields) { 
     if (err) { 
      console.log('Error Reported ', err); 
      throw err; 
     } 
     res.send(['Hello World!!!! HOLA MUNDO!!!!', rows]); 
    }); 
}); 

を使用している私は私のアプリを開こうとするとしかし、それがクラッシュしています... ここに私のHerokuのですログ:

2017-10-11T03:29:02.994422+00:00 app[web.1]: SyntaxError: Unexpected 
identifier 
2017-10-11T03:29:02.994423+00:00 app[web.1]:  at createScript 
(vm.js:56:10) 
2017-10-11T03:29:02.994423+00:00 app[web.1]:  at Object.runInThisContext (vm.js:97:10) 
2017-10-11T03:29:02.994424+00:00 app[web.1]:  at Module._compile (module.js:542:28) 
2017-10-11T03:29:02.994425+00:00 app[web.1]:  at Object.Module._extensions..js (module.js:579:10) 
2017-10-11T03:29:02.994426+00:00 app[web.1]:  at Module.load (module.js:487:32) 
2017-10-11T03:29:02.994426+00:00 app[web.1]:  at tryModuleLoad (module.js:446:12) 
2017-10-11T03:29:02.994427+00:00 app[web.1]:  at Function.Module._load (module.js:438:3) 
2017-10-11T03:29:02.994427+00:00 app[web.1]:  at Module.runMain (module.js:604:10) 
2017-10-11T03:29:02.994428+00:00 app[web.1]:  at run (bootstrap_node.js:383:7) 
2017-10-11T03:29:02.994429+00:00 app[web.1]:  at startup (bootstrap_node.js:149:9) 
2017-10-11T03:29:03.094049+00:00 heroku[web.1]: Process exited with status 1 
2017-10-11T03:29:03.109659+00:00 heroku[web.1]: State changed from starting to crashed 
2017-10-11T03:29:03.113306+00:00 heroku[web.1]: State changed from crashed to starting 
2017-10-11T03:29:04.742139+00:00 heroku[web.1]: Starting process with command `node bot.js` 
2017-10-11T03:29:07.004884+00:00 app[web.1]: /app/bot.js:27 
2017-10-11T03:29:07.004904+00:00 app[web.1]:   database: 'heroku_1d0d2358c241fd0' 
2017-10-11T03:29:07.004905+00:00 app[web.1]:   ^^^^^^^^ 
2017-10-11T03:29:07.004905+00:00 app[web.1]: 
2017-10-11T03:29:07.004906+00:00 app[web.1]: SyntaxError: Unexpected identifier 
2017-10-11T03:29:07.004907+00:00 app[web.1]:  at createScript (vm.js:56:10) 
2017-10-11T03:29:07.004907+00:00 app[web.1]:  at Object.runInThisContext (vm.js:97:10) 
2017-10-11T03:29:07.004908+00:00 app[web.1]:  at Module._compile (module.js:542:28) 
2017-10-11T03:29:07.004909+00:00 app[web.1]:  at Object.Module._extensions..js (module.js:579:10) 
2017-10-11T03:29:07.004909+00:00 app[web.1]:  at Module.load (module.js:487:32) 
2017-10-11T03:29:07.004910+00:00 app[web.1]:  at tryModuleLoad (module.js:446:12) 
2017-10-11T03:29:07.004910+00:00 app[web.1]:  at Function.Module._load (module.js:438:3) 
2017-10-11T03:29:07.004911+00:00 app[web.1]:  at Module.runMain (module.js:604:10) 
2017-10-11T03:29:07.004912+00:00 app[web.1]:  at run (bootstrap_node.js:383:7) 
2017-10-11T03:29:07.004912+00:00 app[web.1]:  at startup (bootstrap_node.js:149:9) 
2017-10-11T03:29:07.086015+00:00 heroku[web.1]: State changed from starting to crashed 
2017-10-11T03:29:07.070905+00:00 heroku[web.1]: Process exited with status 1 
2017-10-11T04:05:26.000000+00:00 app[api]: Build started by user [email protected] 
2017-10-11T04:05:36.046510+00:00 app[api]: Release v47 created by user [email protected] 
2017-10-11T04:05:36.046510+00:00 app[api]: Deploy 1366f9f3 by user [email protected] 
2017-10-11T04:05:36.525080+00:00 heroku[web.1]: State changed from crashed to starting 

答えて

1

あなたの可変男性にはカンマがありません。

password: "37eb78b5"<missing comma> 
database: 'heroku_1d0d2358c241fd0' 

次回、エラーログが表示され、デバッグできます。

2017-10-11T03:29:07.004884 + 00:00アプリ[web.1]:/app/bot.js:27 2017-10-11T03:29:07.004904 + 00:00アプリ[ web.1]:データベース: 'heroku_1d0d2358c241fd0'

関連する問題