Tag: heroku

禁用Heroku Node.js / Express App上的HTTPS

上传到Heroku后,所有的url都是https 。 我想他们是http 。 有一个简单的方法来实现这个?

Firebase 3 – 无法从数据库检索数据(Web)

我正在使用第一次使用Firebase 3 (最新版本)的Firebase 3应用程序,但是在retrieving data页面上的retrieving data时遇到麻烦。 我已经从Heroku创build了一个NodeJStesting应用程序,然后我试图检索我的Firebase realtime database保存的JSON格式的数据(ref的path到我的数据数组)。 我按照文档 ,但没有结果。 这是我的代码: <script src="https://www.gstatic.com/firebasejs/live/3.0/firebase.js"></script> <script> // Initialize Firebase var config = { apiKey: "*******", authDomain: "*******", databaseURL: "*******", storageBucket: "*******", }; firebase.initializeApp(config); firebase.database().ref('my/path/to/data').on('value', function(snapshot) { console.log('kk'); //no log in the console }); </script> 控制台中没有错误,但也没有结果。 这似乎很简单,但我不知道我失踪。

带有Node Js的Heroku调度器

我已经在这里跟着这个答案,它的工作原理,但是当我试图打电话给我的应用程序没有任何反应 我有我的主要functionapp.js调用 function start() { … } 这是我的任务存储在bin,我知道它的工作时,我打电话: #! /app/.heroku/node/bin/node function mytask() { start(); } initScrape(); process.exit(); 之后: heroku run init mytask λ heroku run init_scrape Running mytask on dyno1… up, run.5157 /app/bin/mytask:3 start(); ^ ReferenceError: start is not defined at mytask (/app/bin/mytask:3:3) at Object.<anonymous> (/app/bin/mytask:5:1) at Module._compile (module.js:413:34) at Object.Module._extensions..js (module.js:422:10) at Module.load (module.js:357:32) […]

到Heroku的NodeJS中,MongoDB的MongoDB连接超时

首先一切正常,我可以通过发布到/上传路线成功地存储数据。 但在120秒不活动之后,超时事件触发,并且将来尝试存储数据失败。 但是callback没有被调用,所以在日志中没有"Unable to insert…"消息。 var express = require('express'); var bodyParser = require('body-parser'); var winston = require('winston'); var config = require('./config'); var MongoClient = require('mongodb').MongoClient; var app = express(); app.use(bodyParser.json()); app.post('/upload', function (req, res) { req.json({status: 'recieved'}); req.app.locals.db.collection('data').insertOne(req.body, function(err, result) { if (err === null) { winston.info('Successfully inserted', {data: req.body}); } else { winston.warn('Unable to […]

Heroku localhost卡在Node.js App的“ No ENV File Found”上

我有一个Node.js应用程序,它可以在部署到Heroku时正常工作,但每当我尝试使用“heroku local”或“heroku local web -f Procfile”在本地进行testing时,它都会显示“[WARN]find”。

运行`npm install`时可以重写一个本地.npmrc吗?

我的项目有一个位于其根目录的.npmrc文件,其中包含臭名昭着的$ {NPM_TOKEN} hack,并且对于CI,Staging,Production等是必需的。 为了解决这个问题,我希望开发人员在安装依赖关系时能够告诉npm使用包含_authToken的替代.npmrc。 像npm install . –npmrc=~/.npmrc npm install . –npmrc=~/.npmrc 。 这将防止他们不得不污染他们的系统的环境variables,.bash_profile等。 目前这是可能的吗? (似乎不那么…)如果不是这样,那么为什么这样的方法要么不可能(极不可能),或者不被NPM团队考虑,是否有任何理由?

CI使用Gitlab和Heroku

我正在使用react-starter-kit来开发我的web应用程序,并使用Gitlab作为我的远程git存储库。 我想configuration一个连续的部署,以便在每次向主服务器推送时,都会执行npm run deploy脚本。 从我的本地电脑执行npm run deploy构build节点应用程序并将其推送到远程的heroku git存储库。 它使用我的电脑本地凭据。 我已经configuration了gitlab runner(在.yml文件中)来执行相同的npm run deploy ,但是失败并显示Error: fatal: could not read Username for 'https://git.heroku.com': No such device or address 。 我需要find一种方法来validationgitlab亚军heroku。 我试图设置variablesHEROKU_API_KEY ,但它也没有工作。 我怎么能从我的gitlab亚军推到我的heroku git回购?

Node.js – events.js抛出呃

在发布这个问题之前,我经历了几个相同标题的SOpost。 他们都build议我重新启动我的应用程序..我试过,但我仍然得到错误。 抛出错误的代码是 app.post('/insert', function(request, response) { var connection = mySequel.createConnection(ConnectionParams); connection.connect(); var UserName = request.body.UserName; // insert into userrecords values ("123456",DEFAULT,DEFAULT,DEFAULT,10); var InsertQuery = "insert into userrecords values (" + UserName + ",DEFAULT,DEFAULT,DEFAULT,-10);"; connection.query(InsertQuery, function(error, result, fields) { if (error) { response.send("error"); console.log(error); throw error; } else { // response.send("success"); console.log(result.insertId); response.send(result.insertId); } }); […]

共享Node.js应用程序和Rails应用程序之间的会话

我正在Heroku上运行一个Rails应用程序,而且我试图将所有的内联Twitter请求(即oauthauthentication)移植到Node.js应用程序中,因为当Twitter缓慢时,由于Ruby服务器阻塞,Twitter请求堵塞我的应用程序。 (我的平均请求需要大约50ms,但是我的平均Twitter Oauth请求需要大约1500ms!) node.js应用程序和rails应用程序可以访问同一个数据库。 但是我不明白的是如何使用node.js启动会话,然后在rails应用程序中使用该会话。 现在我正在使用默认的Rails cookie会话存储。 我希望它能像… 1)用户到达登陆页面http://railsapp.com 2)用户使用http://nodeapp.com/login或http://nodeapplogin.railsapp.com启动login 3)用户做twitter oauth跳舞与node.js 4)成功login后,用户将被redirect到http://railsapp.com/dashboard ,并且可以在整个rails应用程序中使用有效的rails会话 任何想法/build议?

(遵循Heroku的Node.js指令)之后出现错误

解答:不要把Gemfile放到Node.js项目的根目录下。 Heroku得到了困惑,并把它看作是一个Ruby应用程序。 我试图按照Heroku文档中的说明进行操作,但是收到一个错误:“没有这样的文件或目录 – 节点web.js”。 我的Procfile是… web: node web.js 工头按预期在本地运行。 这是一个logging快照 2011-07-21T23:28:49+00:00 heroku[web.1]: State changed from starting to crashed 2011-07-21T23:37:50+00:00 heroku[web.1]: State changed from crashed to created 2011-07-21T23:37:50+00:00 heroku[web.1]: State changed from created to starting 2011-07-21T23:37:51+00:00 heroku[web.1]: Starting process with command: `node web.js` 2011-07-21T23:37:51+00:00 app[web.1]: Error: No such file or directory – node web.js 2011-07-21T23:37:52+00:00 […]