Tag: 弹性beanstalk

在AWS上使用弹性beanstalk部署Nodejs REST API – 错误找不到自定义模块

我写了我的第一个nodejs应用程序。 它在我的MacBook上工作正常,但是当我尝试在AWS弹性beanstalk上部署它时,出现以下错误。 /var/log/nodejs/nodejs.log at Function.Module._load (module.js:310:12) at Module.require (module.js:365:17) module.js:338 throw err; ^ Error: Cannot find module '**./routes/userprofile**' at Function.Module._resolveFilename (module.js:336:15) at Function.Module._load (module.js:278:25) at Module.require (module.js:365:17) at require (module.js:384:17) at Object.<anonymous> (/var/app/current/main.js:7:18) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Module.require (module.js:365:17) 看来nodejs不能解决我的自定义模块userprofile位于Routes目录下的path。我已经尝试将userprofile.js移动到根,但它仍然不能解决这个问题。 这是加载所有模块的main.js中的代码 /加载我们的模块 var express = require('express'); […]

parsing服务器云代码afterSave不工作在Elastic Beanstalk上

我为我的Parse服务器创build了Cloud代码afterSave和beforeSave函数,当我在本地运行我的服务器时,它运行完美。 但是,当我部署到Elastic Beanstalk时, afterSavefunction根本不起作用。 beforeSave 我试着按照这里的build议,以及其他多个随机尝试没有成功。 示例afterSave在Elastic Beanstalk上不起作用: Parse.Cloud.afterSave("Entry", function(request) { var entry = request.object; var user = request.user; user.increment("totalDistance", entry.get("totalDistance")); user.save(); }); 注:我不知道如何find/访问我的Elastic Beanstalk NodeJS日志任何地方或以任何方式?

AWS Elastic Beanstalk自定义静态文件夹403错误页面

我用: AWS Elastic Beanstalk并具有我的资源的静态public文件夹,在弹性beanstalk .ebextensions定义 nodejs并处理那里的错误 当我打开我的网站,并去example.com/public我看到丑陋的403页面,似乎不由nodejs服务器处理。 我想服务器以某种方式处理这个请求,看到没有权限,并扔到nodejs服务器之前403。 我怀疑,如果我决定从.ebextensionsconfiguration中删除这个方法,并将其定义为nodejs静态文件夹,它将按我的预期工作。 但有没有一些方法来使用我的自定义403页面是我使用.ebextensionsconfiguration?

如何从部署在AWS Elastic Beanstalk上的node.js express应用程序获取客户端ip?

我正在使用ngnix代理服务器的弹性beanstalk 。 我的应用程序代码是在node.jsexpression式框架上。 我想通过下面的代码访问客户端IP var ip = event.headers['x-forwarded-for'] || event.connection.remoteAddress || event.socket.remoteAddress || event.connection.socket.remoteAddress; 但我总是得到相同的客户端IP所有传入的请求。 我认为这将是代理服务器的IP地址。 如何从我的应用程序访问真正的客户端地址?

Elastic Beanstalk和Private GitHub回购

build议使用Elastic Beanstalk作为节点Web应用程序(express)的方式,它依赖于来自GitHub的私有节点模块? 我知道如何生成可用作GitHub的部署密钥的ssh密钥,但这需要我login到EB框架,因为它需要增加能够自动调整的目标。 我已经尝试使用已经包含的节点模块来上传整个Web应用程序,但似乎仍然尝试运行npm安装,并在这种情况下失败。

AWS EB部署Node应用程序:无法运行npm install

我正在尝试将我的节点应用程序部署到AWS。 它甚至不会让我部署应用程序(保持为Sample Application )使用eb部署。 版本 :64位Amazon Linux 2016.09 v4.0.1运行Node.js 日志说 无法运行npm install 但是我不太清楚他们要求我怎样解决这个问题。 我可以在本地安装npm: ————————————- /var/log/eb-activity.log ————————————- Failed to run npm install. Snapshot logs for more details. Traceback (most recent call last): File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 695, in <module> main() File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 677, in main node_version_manager.run_npm_install(options.app_path) File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 136, in run_npm_install self.npm_install(bin_path, self.config_manager.get_container_config('app_staging_dir')) File […]

在AWS弹性beanstalk上产生casperjs ENOENT错误

我正在试图使用SPOOKY在nodejs上运行casper scraper。 当我在本地主机上运行时,scrapper工作正常,但是当我在AWS elastic beanstalk服务器上部署项目时,出现以下错误。 Error: spawn casperjs ENOENT at exports._errnoException (util.js:1018:11) at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32) at onErrorNT (internal/child_process.js:367:16) at _combinedTickCallback (internal/process/next_tick.js:80:11) at process._tickCallback (internal/process/next_tick.js:104:9) [nodemon] app crashed – waiting for file changes before starting… 我已经尝试设置binPath: './node_modules/casperjs/bin/casperjs'"并试图在全球范围内安装Casper,但无法执行此操作,还添加了command: /^win/.test(process.platform) ? 'casperjs.cmd' : 'casperjs',给孩子,但是也没有成功。 我一直在寻找这一个多星期,但没有成功。 请帮我解决这个问题。

编译更less的文件并缩小AWS Elastic Beanstalk上的node.js项目中的js文件

我正在使用Eb命令行界面将一个node.js项目部署到AWS Elastic Beanstalk。 我使用git进行版本控制。 所以我运行的命令就是“git aws.push”。 本地,我正在使用grunt从less文件编译css文件,还缩小和cmobine js文件。 我不希望在我的git存储库中包含* .min.css文件或* .min.js文件,而是希望在部署后在AWS上重新编译这些文件。 有没有办法做到这一点? 也许与.ebextensions钩或东西?

Node.js错误:Elastic Beanstalk主机上的EADDRINUSE

我有以下错误消息node.js: events.js:72 throw er; // Unhandled 'error' event ^ Error: listen EADDRINUSE at errnoException (net.js:904:11) at Server._listen2 (net.js:1042:14) at Server.wrappedListen2 [as _listen2] (/Users/rakutza/Documents/ParcelPuppy/PP/node_modules/newrelic/lib/instrumentation/core/net.js:16:46) at listen (net.js:1064:10) at Server.listen (net.js:1138:5) at EventEmitter.app.listen (/Users/rakutza/Documents/ParcelPuppy/PP/node_modules/express/lib/application.js:559:24) at Object.<anonymous> (/Users/rakutza/Documents/ParcelPuppy/PP/app.js:109:18) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) 显然listen()试图绑定服务器的端口号已经在使用中了。 我怎样才能尝试另一个端口或使用此端口closures程序? 该应用程序在生产模式下工作,但是一旦我将其部署到服务器上,AWS BeanStalk就会崩溃。 var slice = Array.prototype.slice; /** * EventEmitter […]

AWS Beanstalk Worker – Node.js消息格式

我在一个经常使用AWS的地方。 我正在搞清楚如何在Elastic Beanstalk中使用worker应用程序。 我有一个快速的应用程序设置听一个职位。 我把一条消息放入我的SQL队列中。 我得到了一些节点,因为我可以触发一个消息。 但我不知道如何获得有效载荷。 像往常一样,我似乎仍然抓住了AWS试图从文档中收集最基本的细节。 如果有人能给我任何指点,我将非常感激。 我基本上是在这个时候在AWS SQS控制台的消息主体上粘贴一些JSON。 我已经在Node端尝试request.body和request.payload – 什么也没有。 这是数据到来时的要求 – 很简单。 应该记入日志。 我试过request.body,request.params,我得到'undefined'。 我在这里抛出了整个请求对象,而我没有看到它。 因为我不知道它应该在哪里,所以我甚至不知道它是我的代码,还是不在那里。 var stringify = require('json-stringify-safe'); function test(request, response, next) { mainLog.log("info",stringify(request)); respond_to_HTTP_request(response, null, null);; } exports.test = test;