我有一个使用快递的node.js网络应用程序,我设法使用git上传到谷歌云平台。我使用mongoose从mLab连接到远程数据库。我有用户凭据,URI肯定是正确的,因为如果我尝试在本地运行应用程序(使用远程mLab mongoDB)它工作正常,但如果我尝试从gcloud shell启动应用程序,它会给我以下内容:
Express app listening on port 8080
(node:845) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): MongoNetworkError: failed to connect to server [ds123658.mlab.com:23658] on first
connect [MongoNetworkError: connection 0 to ds123658.mlab.com:23658 timed out]
(node:845) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js proce
ss with a non-zero exit code.
这是我使用mongoose连接数据库的方式:
var mongoose = require('mongoose');
//mongodb connection
mongoose.connect("mongodb://*****:*****@ds123658.mlab.com:23658/englishfiles");
我已经审查了用户名和密码,但我确信这些都不是问题 这是我第一次部署应用程序,所以我错过了什么?