egg icon indicating copy to clipboard operation
egg copied to clipboard

由于sequelzie时区问题导致egg-scripts启动报错

Open jiaotashidi opened this issue 7 years ago • 2 comments

sequelize配置如下

config.sequelize = {
    datasources: [
      {
        delegate: 'XXX',
        baseDir: 'model/XXX',
        dialect: 'mysql',
        host: 'XXX',
        port: 3306,
        database: 'XXX',
        username: 'XXX',
        password: 'XXX',
        timezone: '+8:00',
        pool: {
          max: 3,
          min: 0,
          idle: 60000,
          acquire: 60000,
        },
      }
	]
}

启动脚本配置如下

"scripts": {
	"start": "egg-scripts start --port=7008 --env=prod --workers=3 --daemon --title=XXX",
	"start-test": "egg-scripts start --port=7008 --env=test --workers=3 --daemon --title=XXX",
	"stop": "egg-scripts stop --title=XXX",
	"dev": "egg-bin dev --port=7008",
	"debug": "egg-bin debug",
	"test-local": "egg-bin test --port=7008",
	"test": "npm run lint -- --fix && npm run test-local",
	"cov": "egg-bin cov",
	"tsc": "ets && tsc -p tsconfig.json",
	"ci": "npm run lint && npm run cov && npm run tsc",
	"autod": "autod",
	"lint": "tslint --project . -c tslint.json",
	"clean": "ets clean"
}

执行步骤如下: npm run clean npm run tsc npm run start-test 启动报错 查看日志:

Ignoring invalid timezone passed to Connection: +8:00. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection

jiaotashidi avatar Oct 29 '19 06:10 jiaotashidi

+08:00 instead of +8:00

supperchong avatar Oct 29 '19 08:10 supperchong

非常感谢,已解决

jiaotashidi avatar Oct 29 '19 08:10 jiaotashidi