tencentyun / wafer2-startup

Wafer - 腾讯云下一代小程序综合解决方案
1.02k stars 225 forks source link

启动node后,报Error: ERR_INIT_SDK_LOST_CONFIG #173

Closed ldc4 closed 5 years ago

ldc4 commented 5 years ago

在腾讯云VPS自行部署的一套环境,跑node的时候出现下述问题。 看大意应该是丢失配置。请问丢失了什么配置?ps: 直接下载的你们提供的Demo,除了数据库密码、appId和appSecret修改了,其他的都原封不动

以下是日志:

koa-weapp-demo@1.0.0 start /data/release/weapp pm2 start process.prod.json --no-daemon

pm2 launched in no-daemon mode (you can add DEBUG="*" env variable to get more messages) [PM2] Applying action restartProcessId on app [session](ids: 0) [PM2] session ✓ ┌──────────┬────┬─────────┬─────────┬───────┬────────┬─────────┬────────┬─────┬───────────┬──────┬──────────┐ │ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │ ├──────────┼────┼─────────┼─────────┼───────┼────────┼─────────┼────────┼─────┼───────────┼──────┼──────────┤ │ session │ 0 │ 1.0.0 │ cluster │ 16101 │ online │ 35 │ 0s │ 0% │ 15.4 MB │ root │ enabled │ └──────────┴────┴─────────┴─────────┴───────┴────────┴─────────┴────────┴─────┴───────────┴──────┴──────────┘ Use pm2 show <id|name> to get more details about an app [--no-daemon] Continue to stream logs [--no-daemon] Exit on target PM2 exit pid=14202 21:17:41 0|session | Error: ERR_INIT_SDK_LOST_CONFIG 21:17:41 0|session | at init (/data/release/weapp/node_modules/wafer-node-sdk/index.js:48:190) 21:17:41 0|session | at Object. (/data/release/weapp/qcloud.js:36:18) 21:17:41 0|session | at Module._compile (module.js:652:30) 21:17:41 0|session | at Object.Module._extensions..js (module.js:663:10) 21:17:41 0|session | at Module.load (module.js:565:32) 21:17:41 0|session | at tryModuleLoad (module.js:505:12) 21:17:41 0|session | at Function.Module._load (module.js:497:3) 21:17:41 0|session | at Module.require (module.js:596:17) 21:17:41 0|session | at require (internal/module.js:11:18) 21:17:41 0|session | at Object. (/data/release/weapp/controllers/message.js:1:103) 21:17:41 PM2 | App [session:0] exited with code [1] via signal [SIGINT] 21:17:41 PM2 | App [session:0] starting in -fork mode- 21:17:41 PM2 | App [session:0] online

ldc4 commented 5 years ago

// 检查配置项 const { rootPathname, useQcloudLogin, cos, serverHost, tunnelServerUrl, tunnelSignatureKey, qcloudAppId, qcloudSecretId, qcloudSecretKey, wxMessageToken } = options if ([rootPathname, useQcloudLogin, cos, serverHost, tunnelServerUrl, tunnelSignatureKey, qcloudAppId, qcloudSecretId, qcloudSecretKey, wxMessageToken].some(v => v === undefined)) throw new Error(ERRORS.ERR_INIT_SDK_LOST_CONFIG)

const { region, fileBucket, uploadFolder } = cos
if ([region, fileBucket, uploadFolder].some(v => v === undefined)) throw new Error(ERRORS.ERR_INIT_SDK_LOST_CONFIG)

if (options.mysql) {
    const { host, port, user, db, pass } = options.mysql
    if ([host, port, user, db, pass].some(v => v === undefined)) throw new Error(ERRORS.ERR_INIT_SDK_LOST_CONFIG)
}

看了一下源码,是少配置了qcloudXxxx。

但是我本地开发者工具,通过腾讯云上传到测试环境就能跑,上到自己部署的就不行了。这。。。

jas0ncn commented 5 years ago

https://cloud.tencent.com/document/product/619/11445

chimmyhuang commented 2 years ago

“自己部署”可以找到那行出错的代码行注释掉,就OK了。

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: weedust @.> 发送时间: 2018年10月27日 21:53 收件人: tencentyun/wafer2-startup @.> 抄送: Subscribed @.***> 主题: 回复:[tencentyun/wafer2-startup] 启动node后,报Error: ERR_INIT_SDK_LOST_CONFIG (#173)

// 检查配置项 const { rootPathname, useQcloudLogin, cos, serverHost, tunnelServerUrl, tunnelSignatureKey, qcloudAppId, qcloudSecretId, qcloudSecretKey, wxMessageToken } = options if ([rootPathname, useQcloudLogin, cos, serverHost, tunnelServerUrl, tunnelSignatureKey, qcloudAppId, qcloudSecretId, qcloudSecretKey, wxMessageToken].some(v => v === undefined)) throw new Error(ERRORS.ERR_INIT_SDK_LOST_CONFIG) const { region, fileBucket, uploadFolder } = cos if ([region, fileBucket, uploadFolder].some(v => v === undefined)) throw new Error(ERRORS.ERR_INIT_SDK_LOST_CONFIG) if (options.mysql) { const { host, port, user, db, pass } = options.mysql if ([host, port, user, db, pass].some(v => v === undefined)) throw new Error(ERRORS.ERR_INIT_SDK_LOST_CONFIG) }
看了一下源码,是少配置了qcloudXxxx。

但是我本地开发者工具,通过腾讯云上传到测试环境就能跑,上到自己部署的就不行了。这。。。

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.