Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 服务器上的节点JS 504错误,但在本地主机上工作_Node.js_Express_Nginx - Fatal编程技术网

Node.js 服务器上的节点JS 504错误,但在本地主机上工作

Node.js 服务器上的节点JS 504错误,但在本地主机上工作,node.js,express,nginx,Node.js,Express,Nginx,我试图简单地获取路线中照片的位置并渲染product.ejs文件: //Show individual product info router.get('/product/:id', async function(req, res, next) { let filesFromFolder; Promise.all([ database.retreaveImage(req.params.id) ]).then(resultArr => { filesFromF

我试图简单地获取路线中照片的位置并渲染product.ejs文件:

 //Show individual product info
router.get('/product/:id', async function(req, res, next) {
  let filesFromFolder;

  Promise.all([
    database.retreaveImage(req.params.id)
  ]).then(resultArr => {
    filesFromFolder = resultArr[0];


    res.render('product.ejs', {
      productName: req.params.id,
      data: filesFromFolder

    });
  });
});
它在本地主机上工作,现在我将route.js文件导入real server,当我尝试打开产品时,它抛出504错误

尝试按照此说明操作,但没有帮助

grep-i“504”/var/log/nginx/access.log

82.135.208.60--[16/Sep/2019:07:52:25+0000]“GET/product/line_fan_pool HTTP/1.1”504 594““Mozilla/5.0(Windows NT 10.0;Win64;x64)AppleWebKit/537.36(KHTML,如Gecko)Chrome/76.0.3809.132 Safari/537.36” 82.135.208.60--[16/Sep/2019:08:03:15+0000]“GET/product/line_pool HTTP/1.1“504 594”“”Mozilla/5.0(Windows NT 10.0;Win64;x64)AppleWebKit/537.36(KHTML,如Gecko)Chrome/76.0.3809.132 Safari/537.36”
82.135.208.60---[16/Sep/2019:08:10:19+0000]“GET/product/line_pool HTTP/1.1“504 594”“”Mozilla/5.0(Linux;Android 6.0;Nexus 5Build/MRA58N)AppleWebKit/537.36(KHTML,如Gecko)Chrome/76.0.3809.132 Mobile Safari/537.36”

问题是,amazon web服务器不支持旧版本的MYsql,所以我不得不更新它。这解决了我的问题。不得不在pm2监视器中观察错误。

当我的
http代理中间件
内部出现故障时,我在节点
expressjs
应用程序中遇到了
504

这是一个未捕获到的承诺错误,因此服务器以静默方式超时进入
504
,而不是报告错误

所以,当你的承诺落空时,千万别忘了兑现。 (这就是这里发生的事吗?)


这是nginx代理的背后吗?代理怎么说?你在日志里看到什么了吗?另外,你能测试一些不需要数据库访问的站点来缩小可能的原因吗?其他站点运行良好,只有这一个抛出504。我用更多信息更新了这个问题
 //Show individual product info
router.get('/product/:id', async function(req, res, next) {
  let filesFromFolder;

  Promise.all([
    database.retreaveImage(req.params.id)
  ]).then(resultArr => {
     //...
  }).catch(err => next); // catch and burn.
});