I have tried to implement rate limiter on server.js but it gives this error below making the website crash. Did I implement the rate limiter wrongly? I have tried changing the rate and apiLimiter line position but it didnt work. Below server.js is the error log. As this is the first time I encounter this error log issue, I am not sure where to look for the issue. This is my first time implementing rate limiter in server.js so please advice.
Application error
An error occurred in the application and your page could not be served
server.js
import express from 'express'
import path from 'path'
import mongoose from 'mongoose'
import cors from 'cors'
import rateLimit from 'express-rate-limiter'
import config from './config'
import userRoute from './routes/userRoute'
import uploadRoute from './routes/uploadRoute'
import productRoute from './routes/productRoute'
import orderRoute from './routes/orderRoute'
const mongodbUrl = config.MONGODB_URL;
mongoose.connect(mongodbUrl, {
useNewUrlParser: true,
useUnifiedTopology: true,
useCreateIndex: true,
}).catch((error) => console.log(error.reason))
const app = express()
const apiLimiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100
})
app.use(cors())
app.use(express.json())
app.use('/api/', apiLimiter)
app.use('/api/users', userRoute)
app.use('/api/uploads', uploadRoute)
app.use('/api/products', productRoute)
app.use('/api/orders', orderRoute)
app.get('/api/paypal/clientId', (req, res) => {
res.send({ clientId: config.PAYPAL_CLIENT_ID })
})
app.use('/uploads', express.static(path.join(__dirname, '/../uploads')))
app.use(express.static(path.join(__dirname, '/../frontend')))
app.get('*', (req, res) => {
res.sendFile(path.join(`${__dirname}/../frontend/index.html`))
})
// eslint-disable-next-line no-unused-vars
app.use((err, req, res, next) => {
const status = err.name && err.name === 'ValidationError' ? 400 : 500
res.status(status)
res.send({ message: err.message })
})
2021-05-29T05:11:02.707267+00:00 app[web.1]: this.__configuration = this.__buildConfiguration(options);
2021-05-29T05:11:02.707268+00:00 app[web.1]: ^
2021-05-29T05:11:02.707268+00:00 app[web.1]:
2021-05-29T05:11:02.707269+00:00 app[web.1]: TypeError: this.__buildConfiguration is not a function
2021-05-29T05:11:02.707269+00:00 app[web.1]: at module.exports (/app/node_modules/express-rate-limiter/index.js:13:33)
2021-05-29T05:11:02.707270+00:00 app[web.1]: at Object.<anonymous> (/app/dist/server.js:34:49)
2021-05-29T05:11:02.707270+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:774:30)
2021-05-29T05:11:02.707270+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
2021-05-29T05:11:02.707271+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:641:32)
2021-05-29T05:11:02.707271+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:556:12)
2021-05-29T05:11:02.707272+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:837:10)
2021-05-29T05:11:02.707272+00:00 app[web.1]: at internal/main/run_main_module.js:17:11
2021-05-29T05:11:02.778624+00:00 heroku[web.1]: Process exited with status 1
2021-05-29T05:11:02.853093+00:00 heroku[web.1]: State changed from starting to crashed
2021-05-29T05:11:59.000000+00:00 app[api]: Build started by user hillery262627#gmail.com
2021-05-29T05:13:01.344269+00:00 app[api]: Deploy c8670dff by user hillery262627#gmail.com
2021-05-29T05:13:01.344269+00:00 app[api]: Release v88 created by user hillery262627#gmail.com
2021-05-29T05:13:02.041520+00:00 heroku[web.1]: State changed from crashed to starting
2021-05-29T05:13:03.000000+00:00 app[api]: Build succeeded
2021-05-29T05:13:06.356963+00:00 heroku[web.1]: Starting process with command `node dist/server.js`
2021-05-29T05:13:10.148201+00:00 app[web.1]: /app/node_modules/express-rate-limiter/index.js:13
2021-05-29T05:13:10.148263+00:00 app[web.1]: this.__configuration = this.__buildConfiguration(options);
2021-05-29T05:13:10.148272+00:00 app[web.1]: ^
2021-05-29T05:13:10.148276+00:00 app[web.1]:
2021-05-29T05:13:10.148276+00:00 app[web.1]: TypeError: this.__buildConfiguration is not a function
2021-05-29T05:13:10.148279+00:00 app[web.1]: at module.exports (/app/node_modules/express-rate-limiter/index.js:13:33)
2021-05-29T05:13:10.148279+00:00 app[web.1]: at Object.<anonymous> (/app/dist/server.js:34:49)
2021-05-29T05:13:10.148280+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:774:30)
2021-05-29T05:13:10.148280+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
2021-05-29T05:13:10.148280+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:641:32)
2021-05-29T05:13:10.148280+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:556:12)
2021-05-29T05:13:10.148280+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:837:10)
2021-05-29T05:13:10.148281+00:00 app[web.1]: at internal/main/run_main_module.js:17:11
2021-05-29T05:13:10.200115+00:00 heroku[web.1]: Process exited with status 1
2021-05-29T05:13:10.283484+00:00 heroku[web.1]: State changed from starting to crashed
2021-05-29T05:17:48.336323+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=revivaproject.herokuapp.com request_id=3f033042-c6d3-4c4b-bdbe-d0badd2d3d34 fwd="49.245.39.161" dyno= connect= service= status=503 bytes= protocol=https
2021-05-29T05:23:09.940782+00:00 heroku[web.1]: State changed from crashed to starting
2021-05-29T05:23:13.553102+00:00 heroku[web.1]: Starting process with command `node dist/server.js`
2021-05-29T05:23:16.251662+00:00 app[web.1]: /app/node_modules/express-rate-limiter/index.js:13
2021-05-29T05:23:16.251678+00:00 app[web.1]: this.__configuration = this.__buildConfiguration(options);
2021-05-29T05:23:16.251678+00:00 app[web.1]: ^
2021-05-29T05:23:16.251679+00:00 app[web.1]:
2021-05-29T05:23:16.251679+00:00 app[web.1]: TypeError: this.__buildConfiguration is not a function
2021-05-29T05:23:16.251680+00:00 app[web.1]: at module.exports (/app/node_modules/express-rate-limiter/index.js:13:33)
2021-05-29T05:23:16.251680+00:00 app[web.1]: at Object.<anonymous> (/app/dist/server.js:34:49)
2021-05-29T05:23:16.251681+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:774:30)
2021-05-29T05:23:16.251681+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
2021-05-29T05:23:16.251682+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:641:32)
2021-05-29T05:23:16.251682+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:556:12)
2021-05-29T05:23:16.251683+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:837:10)
2021-05-29T05:23:16.251683+00:00 app[web.1]: at internal/main/run_main_module.js:17:11
2021-05-29T05:23:16.318206+00:00 heroku[web.1]: Process exited with status 1
2021-05-29T05:23:16.378564+00:00 heroku[web.1]: State changed from starting to crashed
2021-05-29T05:24:33.000000+00:00 app[api]: Build started by user hillery262627#gmail.com
2021-05-29T05:25:34.946347+00:00 app[api]: Release v89 created by user hillery262627#gmail.com
2021-05-29T05:25:34.946347+00:00 app[api]: Deploy c8670dff by user hillery262627#gmail.com
2021-05-29T05:25:35.219700+00:00 heroku[web.1]: State changed from crashed to starting
2021-05-29T05:25:37.000000+00:00 app[api]: Build succeeded
2021-05-29T05:25:38.314459+00:00 heroku[web.1]: Starting process with command `node dist/server.js`
2021-05-29T05:25:40.788755+00:00 app[web.1]: /app/node_modules/express-rate-limiter/index.js:13
2021-05-29T05:25:40.788776+00:00 app[web.1]: this.__configuration = this.__buildConfiguration(options);
2021-05-29T05:25:40.788777+00:00 app[web.1]: ^
2021-05-29T05:25:40.788778+00:00 app[web.1]:
2021-05-29T05:25:40.788778+00:00 app[web.1]: TypeError: this.__buildConfiguration is not a function
2021-05-29T05:25:40.788779+00:00 app[web.1]: at module.exports (/app/node_modules/express-rate-limiter/index.js:13:33)
2021-05-29T05:25:40.788779+00:00 app[web.1]: at Object.<anonymous> (/app/dist/server.js:34:49)
2021-05-29T05:25:40.788779+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:774:30)
2021-05-29T05:25:40.788780+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
2021-05-29T05:25:40.788780+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:641:32)
2021-05-29T05:25:40.788780+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:556:12)
2021-05-29T05:25:40.788781+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:837:10)
2021-05-29T05:25:40.788781+00:00 app[web.1]: at internal/main/run_main_module.js:17:11
2021-05-29T05:25:40.864253+00:00 heroku[web.1]: Process exited with status 1
2021-05-29T05:25:40.952164+00:00 heroku[web.1]: State changed from starting to crashed
2021-05-29T05:34:33.335208+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=revivaproject.herokuapp.com request_id=3a904ea7-930c-42e6-a9af-16e333a4064a fwd="49.245.39.161" dyno= connect= service= status=503 bytes= protocol=https
2021-05-29T05:37:25.482013+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=revivaproject.herokuapp.com request_id=ebd52cb6-bb09-481b-bdb7-91d8c8993766 fwd="49.245.39.161" dyno= connect= service= status=503 bytes= protocol=https
2021-05-29T05:37:26.504268+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=revivaproject.herokuapp.com request_id=f7f3e1ec-ea62-4ea9-8712-b1178c56abca fwd="49.245.39.161" dyno=
connect= service= status=503 bytes= protocol=https
2021-05-29T05:38:36.526750+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=revivaproject.herokuapp.com request_id=0402ac65-49cb-4b09-a44e-6aaf428c23dd fwd="49.245.39.161" dyno= connect= service= status=503 bytes= protocol=https
2021-05-29T05:38:37.438382+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=revivaproject.herokuapp.com request_id=4389454b-a233-45d8-bf60-a3f0e7349504 fwd="49.245.39.161" dyno= connect= service= status=503 bytes= protocol=https
2021-05-29T06:09:11.655622+00:00 heroku[web.1]: State changed from crashed to starting
2021-05-29T06:09:15.444774+00:00 heroku[web.1]: Starting process with command `node dist/server.js`
2021-05-29T06:09:17.936977+00:00 app[web.1]: /app/node_modules/express-rate-limiter/index.js:13
2021-05-29T06:09:17.937002+00:00 app[web.1]: this.__configuration = this.__buildConfiguration(options);
2021-05-29T06:09:17.937003+00:00 app[web.1]: ^
2021-05-29T06:09:17.937003+00:00 app[web.1]:
2021-05-29T06:09:17.937003+00:00 app[web.1]: TypeError: this.__buildConfiguration is not a function
2021-05-29T06:09:17.937004+00:00 app[web.1]: at module.exports (/app/node_modules/express-rate-limiter/index.js:13:33)
2021-05-29T06:09:17.937004+00:00 app[web.1]: at Object.<anonymous> (/app/dist/server.js:34:49)
2021-05-29T06:09:17.937005+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:774:30)
2021-05-29T06:09:17.937005+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
2021-05-29T06:09:17.937005+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:641:32)
2021-05-29T06:09:17.937006+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:556:12)
2021-05-29T06:09:17.937006+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:837:10)
2021-05-29T06:09:17.937007+00:00 app[web.1]: at internal/main/run_main_module.js:17:11
2021-05-29T06:09:17.980716+00:00 heroku[web.1]: Process exited with status 1
2021-05-29T06:09:18.047009+00:00 heroku[web.1]: State changed from starting to crashed
2021-05-29T06:48:19.910733+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=revivaproject.herokuapp.com request_id=b65d1d7c-50b2-4b63-b305-400459ed69ba fwd="49.245.39.161" dyno= connect= service= status=503 bytes= protocol=https
2021-05-29T06:48:21.301919+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=revivaproject.herokuapp.com request_id=61fe1968-f463-4c52-b3a8-8d517d0a157d fwd="49.245.39.161" dyno= connect= service= status=503 bytes= protocol=https
2021-05-29T06:48:33.577825+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=revivaproject.herokuapp.com request_id=9831ac5d-869a-4f05-a2f3-6a0422efba77 fwd="49.245.39.161" dyno= connect= service= status=503 bytes= protocol=https
2021-05-29T06:48:34.410206+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=revivaproject.herokuapp.com request_id=cd55e067-ced5-4689-a815-5725e7daa151 fwd="49.245.39.161" dyno= connect= service= status=503 bytes= protocol=https
2021-05-29T06:55:56.000000+00:00 app[api]: Build started by user hillery262627#gmail.com
2021-05-29T06:56:52.630557+00:00 heroku[web.1]: State changed from crashed to starting
2021-05-29T06:56:52.473357+00:00 app[api]: Deploy e28a52be by user hillery262627#gmail.com
2021-05-29T06:56:52.473357+00:00 app[api]: Release v90 created by user hillery262627#gmail.com
2021-05-29T06:56:54.000000+00:00 app[api]: Build succeeded
2021-05-29T06:56:55.920729+00:00 heroku[web.1]: Starting process with command `node dist/server.js`
2021-05-29T06:56:58.334876+00:00 heroku[web.1]: Process exited with status 1
2021-05-29T06:56:58.401966+00:00 heroku[web.1]: State changed from starting to crashed
2021-05-29T06:56:58.405968+00:00 heroku[web.1]: State changed from crashed to starting
2021-05-29T06:56:58.278359+00:00 app[web.1]: /app/node_modules/express-rate-limiter/index.js:13
2021-05-29T06:56:58.278373+00:00 app[web.1]: this.__configuration = this.__buildConfiguration(options);
2021-05-29T06:56:58.278374+00:00 app[web.1]: ^
2021-05-29T06:56:58.278374+00:00 app[web.1]:
2021-05-29T06:56:58.278374+00:00 app[web.1]: TypeError: this.__buildConfiguration is not a function
2021-05-29T06:56:58.278375+00:00 app[web.1]: at module.exports (/app/node_modules/express-rate-limiter/index.js:13:33)
2021-05-29T06:56:58.278375+00:00 app[web.1]: at Object.<anonymous> (/app/dist/server.js:34:52)
2021-05-29T06:56:58.278375+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:774:30)
2021-05-29T06:56:58.278376+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
2021-05-29T06:56:58.278376+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:641:32)
2021-05-29T06:56:58.278376+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:556:12)
2021-05-29T06:56:58.278377+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:837:10)
2021-05-29T06:56:58.278377+00:00 app[web.1]: at internal/main/run_main_module.js:17:11
2021-05-29T06:57:01.716901+00:00 heroku[web.1]: Starting process with command `node dist/server.js`
2021-05-29T06:57:04.120156+00:00 heroku[web.1]: Process exited with status 1
2021-05-29T06:57:04.188477+00:00 heroku[web.1]: State changed from starting to crashed
2021-05-29T06:57:04.078916+00:00 app[web.1]: /app/node_modules/express-rate-limiter/index.js:13
2021-05-29T06:57:04.078967+00:00 app[web.1]: this.__configuration = this.__buildConfiguration(options);
2021-05-29T06:57:04.078967+00:00 app[web.1]: ^
2021-05-29T06:57:04.078968+00:00 app[web.1]:
2021-05-29T06:57:04.078968+00:00 app[web.1]: TypeError: this.__buildConfiguration is not a function
2021-05-29T06:57:04.078982+00:00 app[web.1]: at module.exports (/app/node_modules/express-rate-limiter/index.js:13:33)
2021-05-29T06:57:04.078983+00:00 app[web.1]: at Object.<anonymous> (/app/dist/server.js:34:52)
2021-05-29T06:57:04.078983+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:774:30)
2021-05-29T06:57:04.078983+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
2021-05-29T06:57:04.078983+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:641:32)
2021-05-29T06:57:04.078984+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:556:12)
2021-05-29T06:57:04.078984+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:837:10)
2021-05-29T06:57:04.078984+00:00 app[web.1]: at internal/main/run_main_module.js:17:11
2021-05-29T06:57:05.387430+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=revivaproject.herokuapp.com request_id=54289191-9ec6-4ca9-ad4c-49395f5b3bf4 fwd="49.245.39.161" dyno= connect= service= status=503 bytes= protocol=https
At line 5, you need to import 'express-rate-limit' not 'express-rate-limiter'
Related
I am new to using Heroku to deploy REST api. I have coded a REST api in Node.JS now i want to deploy this to Heroku. Please is there a step by step method
i am getting this Error on Heroku
Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail
on my Desktop, testing on Postman it works perfectly. But i cannot view from a Browser
https://test-restapi2.herokuapp.com/employees
My Node.Js app looks like this :
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var mysql = require('mysql');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended:true
}));
app.get('/',function(req , res){
return res.send({error: true,message: 'hello'})
});
var dbConn = mysql.createConnection({
host: 'xxxxxxxxxxxxxxxx',
user: 'xxxxxxxxxxxxxx',
password: 'xxxxxxxxxxx',
database: 'xxxxxxxxxxxxxxxxx'
});
dbConn.connect();
app.get('/employees',function(req,res){
dbConn.query('SELECT * FROM employeedb',function(error, results, fields){
if (error) throw error;
return res.send({ error: false, data: results, message: 'users list' });
});
});
app.listen(5000,function(){
console.log('App running on port 5000');
});
module.exports = app;
Please how Can i get this resolved?
Edits
Checking the Logs, I saw this :
2021-10-09T19:28:55.666772+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-09T19:28:57.813040+00:00 heroku[web.1]: Starting process with command `npm start`
2021-10-09T19:28:59.202356+00:00 app[web.1]: npm ERR! missing script: start
2021-10-09T19:28:59.208564+00:00 app[web.1]:
2021-10-09T19:28:59.208837+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-10-09T19:28:59.208892+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-10-09T19_28_59_202Z-debug.log
2021-10-09T19:28:59.327035+00:00 heroku[web.1]: Process exited with status 1
2021-10-09T19:28:59.422562+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-09T19:29:04.931511+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=test-restapi2.herokuapp.com request_id=aafd0e0b-988e-4673-9359-f7576e340d75 fwd="154.120.87.9" dyno= connect= service= status=503 bytes= protocol=https
2021-10-09T19:29:06.103970+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=test-restapi2.herokuapp.com request_id=6b375048-c8db-4323-8484-ba60aafea022 fwd="154.120.87.9" dyno= connect= service= status=503 bytes= protocol=https
2021-10-09T19:32:15.776019+00:00 app[api]: Starting process with command `npm start` by user emeka1987ng#gmail.com
2021-10-09T19:32:17.857845+00:00 heroku[run.9636]: Awaiting client
2021-10-09T19:32:17.890327+00:00 heroku[run.9636]: Starting process with command `npm start`
2021-10-09T19:32:17.959936+00:00 heroku[run.9636]: State changed from starting to up
2021-10-09T19:32:21.444257+00:00 heroku[run.9636]: Process exited with status 1
2021-10-09T19:32:21.499239+00:00 heroku[run.9636]: State changed from up to complete
2021-10-09T19:32:28.775794+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/employees" host=test-restapi2.herokuapp.com request_id=1a03731f-41cb-438d-b877-c1e49d5dd039 fwd="107.155.108.143" dyno= connect= service= status=503 bytes= protocol=https
2021-10-09T19:32:39.195421+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/employees" host=test-restapi2.herokuapp.com request_id=c1833124-6596-4401-a765-f8a65345b5e1 fwd="52.204.27.85" dyno= connect= service= status=503 bytes= protocol=https
You can see the logs of your application and determine the problem.
At your project page, top right corner, there is a "More" button.
Click there and then "View Logs" and you should be able to see the exact problem and fix it.
This is the Heroku logs tail:
remote: https://desolate-temple-28640.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/desolate-temple-28640.git
132ab25..24b7d35 master -> master
Bilals-MacBook-Air:Eat-the-burger bilalsarimeseli$ heroku logs --tail
2020-03-05T04:29:51.676106+00:00 app[web.1]:
2020-03-05T04:29:51.676125+00:00 app[web.1]: > burger#1.0.0 start /app
2020-03-05T04:29:51.676125+00:00 app[web.1]: > node server.js
2020-03-05T04:29:51.676125+00:00 app[web.1]:
2020-03-05T04:29:51.929460+00:00 app[web.1]: Server listening on: http://localhost:5967
2020-03-05T04:29:51.932815+00:00 app[web.1]: error connecting: Error: connect ECONNREFUSED 127.0.0.1:3306
2020-03-05T04:29:51.932816+00:00 app[web.1]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1137:16)
2020-03-05T04:29:51.932817+00:00 app[web.1]: --------------------
2020-03-05T04:29:51.932817+00:00 app[web.1]: at Protocol._enqueue (/app/node_modules/mysql/lib/protocol/Protocol.js:144:48)
2020-03-05T04:29:51.932817+00:00 app[web.1]: at Protocol.handshake (/app/node_modules/mysql/lib/protocol/Protocol.js:51:23)
2020-03-05T04:29:51.932818+00:00 app[web.1]: at Connection.connect (/app/node_modules/mysql/lib/Connection.js:119:18)
2020-03-05T04:29:51.932818+00:00 app[web.1]: at Object. (/app/config/connection.js:16:12)
2020-03-05T04:29:51.932818+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1158:30)
2020-03-05T04:29:51.932819+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
2020-03-05T04:29:51.932819+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:1002:32)
2020-03-05T04:29:51.932819+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:901:14)
2020-03-05T04:29:51.932819+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:1044:19)
2020-03-05T04:29:51.932820+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:77:18)
2020-03-05T04:29:53.272983+00:00 heroku[web.1]: State changed from starting to up
2020-03-05T05:04:18.124007+00:00 heroku[web.1]: Idling
2020-03-05T05:04:18.127663+00:00 heroku[web.1]: State changed from up to down
2020-03-05T05:04:18.993332+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2020-03-05T05:04:19.070341+00:00 heroku[web.1]: Process exited with status 143
2020-03-05T11:10:26.000000+00:00 app[api]: Build started by user bilalsarimeseli#gmail.com
2020-03-05T11:10:40.838353+00:00 heroku[web.1]: State changed from down to starting
2020-03-05T11:10:40.648875+00:00 app[api]: Deploy 24b7d357 by user bilalsarimeseli#gmail.com
2020-03-05T11:10:42.830384+00:00 heroku[web.1]: Starting process with command `npm start`
2020-03-05T11:10:40.648875+00:00 app[api]: Release v10 created by user bilalsarimeseli#gmail.com
2020-03-05T11:10:41.000000+00:00 app[api]: Build succeeded
2020-03-05T11:10:44.751738+00:00 app[web.1]:
2020-03-05T11:10:44.751800+00:00 app[web.1]: > burger#1.0.0 start /app
2020-03-05T11:10:44.751801+00:00 app[web.1]: > node server.js
2020-03-05T11:10:44.751806+00:00 app[web.1]:
2020-03-05T11:10:44.985822+00:00 app[web.1]: Server listening on: http://localhost:58632
2020-03-05T11:10:44.989700+00:00 app[web.1]: error connecting: Error: connect ECONNREFUSED 127.0.0.1:3306
2020-03-05T11:10:44.989705+00:00 app[web.1]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1137:16)
2020-03-05T11:10:44.989706+00:00 app[web.1]: --------------------
2020-03-05T11:10:44.989709+00:00 app[web.1]: at Protocol._enqueue (/app/node_modules/mysql/lib/protocol/Protocol.js:144:48)
2020-03-05T11:10:44.989710+00:00 app[web.1]: at Protocol.handshake (/app/node_modules/mysql/lib/protocol/Protocol.js:51:23)
2020-03-05T11:10:44.989710+00:00 app[web.1]: at Connection.connect (/app/node_modules/mysql/lib/Connection.js:119:18)
2020-03-05T11:10:44.989710+00:00 app[web.1]: at Object. (/app/config/connection.js:16:12)
2020-03-05T11:10:44.989710+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1158:30)
2020-03-05T11:10:44.989711+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
2020-03-05T11:10:44.989711+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:1002:32)
2020-03-05T11:10:44.989711+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:901:14)
2020-03-05T11:10:44.989711+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:1044:19)
2020-03-05T11:10:44.989712+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:77:18)
2020-03-05T11:10:45.456540+00:00 heroku[web.1]: State changed from starting to up
2020-03-05T11:11:02.583806+00:00 app[web.1]: /app/config/orm.js:41
2020-03-05T11:11:02.583841+00:00 app[web.1]: throw err;
2020-03-05T11:11:02.583841+00:00 app[web.1]: ^
2020-03-05T11:11:02.583843+00:00 app[web.1]:
2020-03-05T11:11:02.583845+00:00 app[web.1]: Error: Cannot enqueue Query after fatal error.
2020-03-05T11:11:02.583846+00:00 app[web.1]: at Protocol._validateEnqueue (/app/node_modules/mysql/lib/protocol/Protocol.js:212:16)
2020-03-05T11:11:02.583846+00:00 app[web.1]: at Protocol._enqueue (/app/node_modules/mysql/lib/protocol/Protocol.js:138:13)
2020-03-05T11:11:02.583848+00:00 app[web.1]: at Connection.query (/app/node_modules/mysql/lib/Connection.js:201:25)
2020-03-05T11:11:02.583848+00:00 app[web.1]: at Object.selectAll (/app/config/orm.js:39:20)
2020-03-05T11:11:02.583849+00:00 app[web.1]: at Object.selectAll (/app/models/burger.js:7:13)
2020-03-05T11:11:02.583849+00:00 app[web.1]: at /app/controller/burgers_controller.js:10:12
2020-03-05T11:11:02.583849+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2020-03-05T11:11:02.583850+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/route.js:137:13)
2020-03-05T11:11:02.583850+00:00 app[web.1]: at Route.dispatch (/app/node_modules/express/lib/router/route.js:112:3)
2020-03-05T11:11:02.583850+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5) {
2020-03-05T11:11:02.583851+00:00 app[web.1]: code: 'PROTOCOL_ENQUEUE_AFTER_FATAL_ERROR',
2020-03-05T11:11:02.583851+00:00 app[web.1]: fatal: false
2020-03-05T11:11:02.583851+00:00 app[web.1]: }
2020-03-05T11:11:02.591344+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-03-05T11:11:02.591569+00:00 app[web.1]: npm ERR! errno 1
2020-03-05T11:11:02.592540+00:00 app[web.1]: npm ERR! burger#1.0.0 start: `node server.js`
2020-03-05T11:11:02.592651+00:00 app[web.1]: npm ERR! Exit status 1
2020-03-05T11:11:02.592779+00:00 app[web.1]: npm ERR!
2020-03-05T11:11:02.592869+00:00 app[web.1]: npm ERR! Failed at the burger#1.0.0 start script.
2020-03-05T11:11:02.592974+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-03-05T11:11:02.596948+00:00 app[web.1]:
2020-03-05T11:11:02.597121+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-03-05T11:11:02.597200+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-03-05T11_11_02_593Z-debug.log
2020-03-05T11:11:02.659995+00:00 heroku[web.1]: State changed from up to crashed
2020-03-05T11:11:02.663569+00:00 heroku[web.1]: State changed from crashed to starting
2020-03-05T11:11:02.591268+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/" host=desolate-temple-28640.herokuapp.com request_id=babd3c58-db4a-4333-8b8c-1d3b6c180144 fwd="73.170.10.17" dyno=web.1 connect=1ms service=15ms status=503 bytes=0 protocol=https
2020-03-05T11:11:02.640946+00:00 heroku[web.1]: Process exited with status 1
2020-03-05T11:11:04.780991+00:00 heroku[web.1]: Starting process with command `npm start`
2020-03-05T11:11:06.928183+00:00 app[web.1]:
2020-03-05T11:11:06.928199+00:00 app[web.1]: > burger#1.0.0 start /app
2020-03-05T11:11:06.928199+00:00 app[web.1]: > node server.js
2020-03-05T11:11:06.928200+00:00 app[web.1]:
2020-03-05T11:11:07.188672+00:00 app[web.1]: Server listening on: http://localhost:23612
2020-03-05T11:11:07.192422+00:00 app[web.1]: error connecting: Error: connect ECONNREFUSED 127.0.0.1:3306
2020-03-05T11:11:07.192422+00:00 app[web.1]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1137:16)
2020-03-05T11:11:07.192423+00:00 app[web.1]: --------------------
2020-03-05T11:11:07.192423+00:00 app[web.1]: at Protocol._enqueue (/app/node_modules/mysql/lib/protocol/Protocol.js:144:48)
2020-03-05T11:11:07.192424+00:00 app[web.1]: at Protocol.handshake (/app/node_modules/mysql/lib/protocol/Protocol.js:51:23)
2020-03-05T11:11:07.192424+00:00 app[web.1]: at Connection.connect (/app/node_modules/mysql/lib/Connection.js:119:18)
2020-03-05T11:11:07.192424+00:00 app[web.1]: at Object. (/app/config/connection.js:16:12)
2020-03-05T11:11:07.192425+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1158:30)
2020-03-05T11:11:07.192425+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
2020-03-05T11:11:07.192425+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:1002:32)
2020-03-05T11:11:07.192426+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:901:14)
2020-03-05T11:11:07.192426+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:1044:19)
2020-03-05T11:11:07.192426+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:77:18)
2020-03-05T11:11:07.594141+00:00 heroku[web.1]: State changed from starting to up
2020-03-05T11:15:26.050243+00:00 app[web.1]: /app/config/orm.js:41
2020-03-05T11:15:26.050267+00:00 app[web.1]: throw err;
2020-03-05T11:15:26.050267+00:00 app[web.1]: ^
2020-03-05T11:15:26.050268+00:00 app[web.1]:
2020-03-05T11:15:26.050270+00:00 app[web.1]: Error: Cannot enqueue Query after fatal error.
2020-03-05T11:15:26.050272+00:00 app[web.1]: at Protocol._validateEnqueue (/app/node_modules/mysql/lib/protocol/Protocol.js:212:16)
2020-03-05T11:15:26.050272+00:00 app[web.1]: at Protocol._enqueue (/app/node_modules/mysql/lib/protocol/Protocol.js:138:13)
2020-03-05T11:15:26.050273+00:00 app[web.1]: at Connection.query (/app/node_modules/mysql/lib/Connection.js:201:25)
2020-03-05T11:15:26.050274+00:00 app[web.1]: at Object.selectAll (/app/config/orm.js:39:20)
2020-03-05T11:15:26.050274+00:00 app[web.1]: at Object.selectAll (/app/models/burger.js:7:13)
2020-03-05T11:15:26.050275+00:00 app[web.1]: at /app/controller/burgers_controller.js:10:12
2020-03-05T11:15:26.050275+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2020-03-05T11:15:26.050275+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/route.js:137:13)
2020-03-05T11:15:26.050276+00:00 app[web.1]: at Route.dispatch (/app/node_modules/express/lib/router/route.js:112:3)
2020-03-05T11:15:26.050276+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5) {
2020-03-05T11:15:26.050277+00:00 app[web.1]: code: 'PROTOCOL_ENQUEUE_AFTER_FATAL_ERROR',
2020-03-05T11:15:26.050277+00:00 app[web.1]: fatal: false
2020-03-05T11:15:26.050277+00:00 app[web.1]: }
2020-03-05T11:15:26.059015+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-03-05T11:15:26.059397+00:00 app[web.1]: npm ERR! errno 1
2020-03-05T11:15:26.061003+00:00 app[web.1]: npm ERR! burger#1.0.0 start: `node server.js`
2020-03-05T11:15:26.061232+00:00 app[web.1]: npm ERR! Exit status 1
2020-03-05T11:15:26.061464+00:00 app[web.1]: npm ERR!
2020-03-05T11:15:26.061676+00:00 app[web.1]: npm ERR! Failed at the burger#1.0.0 start script.
2020-03-05T11:15:26.061857+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-03-05T11:15:26.069984+00:00 app[web.1]:
2020-03-05T11:15:26.070271+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-03-05T11:15:26.070400+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-03-05T11_15_26_062Z-debug.log
2020-03-05T11:15:26.165120+00:00 heroku[web.1]: State changed from up to crashed
2020-03-05T11:15:26.144397+00:00 heroku[web.1]: Process exited with status 1
2020-03-05T11:15:26.058348+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/" host=desolate-temple-28640.herokuapp.com request_id=bba9be1c-a0a8-4187-9854-8f1adb4aef14 fwd="73.170.10.17" dyno=web.1 connect=0ms service=18ms status=503 bytes=0 protocol=https
2020-03-05T04:29:51.929460+00:00 app[web.1]: Server listening on: http://localhost:5967
2020-03-05T04:29:51.932815+00:00 app[web.1]: error connecting: Error: connect ECONNREFUSED 127.0.0.1:3306
I assume that you did bind your port to the environment variable $PORT which was supplied by Heroku. I assume that port is the 5967. Your program is trying to access 3306. You probably defined this port somewhere. This is on Heroku not possible.
Heroku only allows you to bind to a single port with the port number decided by Heroku.
2020-03-05T04:29:51.929460+00:00 app[web.1]: Server listening on: http://localhost:5967
2020-03-05T04:29:51.932815+00:00 app[web.1]: error connecting: Error: connect ECONNREFUSED 127.0.0.1:3306
You got an Error. Because your server tries to connect a 3306 PORT
But in your server Listening to a port 5967. simple change a PORT Number in own code .env file. Define a like
E.g.HOST=5967 in the .env file
I am having a problem with deploying my app on heroku. I am stuck and cannot find the answer. I have went through the heroku troubleshooting and deployment procedures. I have been trying for 3 days. I have rewritten my env file numerous times and every time I do, it doesn't work on localhost. I have MONGOD and NODEMON running. I reverted back to the original and it is working. But still will not deploy on heroku. Thanks in advance.
Here is what my env.js looks like
module.exports = {
db: process.env.MONGODB_URI || 'mongodb://localhost/sailcast',
port: process.env.PORT || 3000
}
package.json
"scripts": {
"start": "node index.js",
"postinstall": "gulp default"
},
"dependencies": {
"bcrypt": "^2.0.1",
"bluebird": "^3.5.1",
"body-parser": "^1.18.3",
"ejs": "^2.6.1",
"express": "^4.16.3",
"express-ejs-layouts": "^2.4.0",
"express-flash": "0.0.2",
"express-session": "^1.15.6",
"express-sessions": "^1.0.6",
"express-static": "^1.2.5",
"forever": "^0.15.3",
"method-override": "^2.3.10",
"mongoose": "^5.1.5",
"morgan": "^1.9.0",
"nodemon": "^1.17.5",
"passport": "^0.4.0",
"request": "^2.87.0",
"request-promise": "^4.2.2",
"yarn": "^1.7.0",
"yarn.lock": "0.0.1-security"
},
"devDependencies": {
"babel-preset-es2015": "^6.24.1",
"gulp": "^3.9.1",
"gulp-babel": "^7.0.1",
"gulp-clean-css": "^3.9.4",
"gulp-plumber": "^1.2.0",
"gulp-sass": "^4.0.1",
"gulp-uglify": "^3.0.0"
}
Here are the heroku logs. I can't figure out the error. just keep getting application error
2018-06-16T02:00:26.831441+00:00 app[web.1]: npm ERR! sailcast#1.0.0
start: `node index.js`
2018-06-16T02:00:26.831595+00:00 app[web.1]: npm ERR! Exit status 1
2018-06-16T02:00:26.831982+00:00 app[web.1]: npm ERR! Failed at the
sailcast#1.0.0 start script.
2018-06-16T02:00:26.831821+00:00 app[web.1]: npm ERR!
2018-06-16T02:00:26.832134+00:00 app[web.1]: npm ERR! This is probably
not a problem with npm. There is likely additional logging output above.
2018-06-16T02:00:26.839530+00:00 app[web.1]:
2018-06-16T02:00:26.839805+00:00 app[web.1]: npm ERR! A complete log of
this run can be found in:
2018-06-16T02:00:26.839898+00:00 app[web.1]: npm ERR!
/app/.npm/_logs/2018-06-16T02_00_26_833Z-debug.log
2018-06-16T02:00:26.898270+00:00 heroku[web.1]: Process exited with
status 1
2018-06-16T02:00:27.233835+00:00 heroku[web.1]: State changed from
starting to crashed
2018-06-16T05:23:18.892587+00:00 heroku[web.1]: State changed from
crashed to starting
2018-06-16T05:23:22.696724+00:00 heroku[web.1]: Starting process with
command `npm start`
2018-06-16T05:23:24.791728+00:00 app[web.1]:
2018-06-16T05:23:24.791759+00:00 app[web.1]: > sailcast#1.0.0 start /app
2018-06-16T05:23:24.791761+00:00 app[web.1]: > node index.js
2018-06-16T05:23:24.791762+00:00 app[web.1]:
2018-06-16T05:23:25.449215+00:00 app[web.1]: module.js:681
2018-06-16T05:23:25.449238+00:00 app[web.1]: return
process.dlopen(module, path._makeLong(filename));
2018-06-16T05:23:25.449240+00:00 app[web.1]: ^
2018-06-16T05:23:25.449242+00:00 app[web.1]:
2018-06-16T05:23:25.449244+00:00 app[web.1]: Error:
/app/node_modules/bcrypt/lib/binding/bcrypt_lib.node: invalid ELF header
2018-06-16T05:23:25.449247+00:00 app[web.1]: at Module.load
(module.js:565:32)
2018-06-16T05:23:25.449245+00:00 app[web.1]: at
Object.Module._extensions..node (module.js:681:18)
2018-06-16T05:23:25.449249+00:00 app[web.1]: at tryModuleLoad
(module.js:505:12)
2018-06-16T05:23:25.449250+00:00 app[web.1]: at Function.Module._load
(module.js:497:3)
2018-06-16T05:23:25.449252+00:00 app[web.1]: at Module.require
(module.js:596:17)
2018-06-16T05:23:25.449253+00:00 app[web.1]: at require
(internal/module.js:11:18)
2018-06-16T05:23:25.449255+00:00 app[web.1]: at Object.<anonymous>
(/app/node_modules/bcrypt/bcrypt.js:6:16)
2018-06-16T05:23:25.449257+00:00 app[web.1]: at Module._compile
(module.js:652:30)
2018-06-16T05:23:25.449258+00:00 app[web.1]: at
Object.Module._extensions..js (module.js:663:10)
2018-06-16T05:23:25.449260+00:00 app[web.1]: at Module.load
(module.js:565:32)
2018-06-16T05:23:25.449261+00:00 app[web.1]: at tryModuleLoad
(module.js:505:12)
2018-06-16T05:23:25.449263+00:00 app[web.1]: at Function.Module._load
(module.js:497:3)
2018-06-16T05:23:25.449264+00:00 app[web.1]: at Module.require
(module.js:596:17)
2018-06-16T05:23:25.449266+00:00 app[web.1]: at require
(internal/module.js:11:18)
2018-06-16T05:23:25.449267+00:00 app[web.1]: at Object.<anonymous>
(/app/models/user.js:2:16)
2018-06-16T05:23:25.449269+00:00 app[web.1]: at Module._compile
(module.js:652:30)
2018-06-16T05:23:25.449270+00:00 app[web.1]: at
Object.Module._extensions..js (module.js:663:10)
2018-06-16T05:23:25.449271+00:00 app[web.1]: at Module.load
(module.js:565:32)
2018-06-16T05:23:25.449273+00:00 app[web.1]: at tryModuleLoad
(module.js:505:12)
2018-06-16T05:23:25.449274+00:00 app[web.1]: at Function.Module._load
(module.js:497:3)
2018-06-16T05:23:25.449276+00:00 app[web.1]: at Module.require
(module.js:596:17)
2018-06-16T05:23:25.449277+00:00 app[web.1]: at require
(internal/module.js:11:18)
2018-06-16T05:23:25.457003+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2018-06-16T05:23:25.457360+00:00 app[web.1]: npm ERR! errno 1
2018-06-16T05:23:25.458445+00:00 app[web.1]: npm ERR! sailcast#1.0.0
start: `node index.js`
2018-06-16T05:23:25.458586+00:00 app[web.1]: npm ERR! Exit status 1
2018-06-16T05:23:25.458827+00:00 app[web.1]: npm ERR!
2018-06-16T05:23:25.458989+00:00 app[web.1]: npm ERR! Failed at the
sailcast#1.0.0 start script.
2018-06-16T05:23:25.459138+00:00 app[web.1]: npm ERR! This is probably
not a problem with npm. There is likely additional logging output above.
2018-06-16T05:23:25.493154+00:00 app[web.1]:
2018-06-16T05:23:25.493346+00:00 app[web.1]: npm ERR! A complete log of
this run can be found in:
2018-06-16T05:23:25.493475+00:00 app[web.1]: npm ERR!
/app/.npm/_logs/2018-06-16T05_23_25_460Z-debug.log
2018-06-16T05:23:25.564550+00:00 heroku[web.1]: Process exited with
status 1
2018-06-16T05:23:25.653739+00:00 heroku[web.1]: State changed from
starting to crashed
2018-06-16T10:54:29.552763+00:00 heroku[web.1]: State changed from
crashed to starting
2018-06-16T10:54:35.778827+00:00 heroku[web.1]: Starting process with
command `npm start`
2018-06-16T10:54:39.194359+00:00 app[web.1]:
2018-06-16T10:54:39.194379+00:00 app[web.1]: > sailcast#1.0.0 start /app
2018-06-16T10:54:39.194381+00:00 app[web.1]: > node index.js
2018-06-16T10:54:39.194383+00:00 app[web.1]:
2018-06-16T10:54:40.337060+00:00 app[web.1]: return
process.dlopen(module, path._makeLong(filename));
2018-06-16T10:54:40.337027+00:00 app[web.1]: module.js:681
2018-06-16T10:54:40.337063+00:00 app[web.1]: ^
2018-06-16T10:54:40.337065+00:00 app[web.1]:
2018-06-16T10:54:40.337067+00:00 app[web.1]: Error:
/app/node_modules/bcrypt/lib/binding/bcrypt_lib.node: invalid ELF header
2018-06-16T10:54:40.337069+00:00 app[web.1]: at
Object.Module._extensions..node (module.js:681:18)
2018-06-16T10:54:40.337071+00:00 app[web.1]: at Module.load
(module.js:565:32)
2018-06-16T10:54:40.337073+00:00 app[web.1]: at tryModuleLoad
(module.js:505:12)
2018-06-16T10:54:40.337074+00:00 app[web.1]: at Function.Module._load
(module.js:497:3)
2018-06-16T10:54:40.337077+00:00 app[web.1]: at require
(internal/module.js:11:18)
2018-06-16T10:54:40.337076+00:00 app[web.1]: at Module.require
(module.js:596:17)
2018-06-16T10:54:40.337079+00:00 app[web.1]: at Object.<anonymous>
(/app/node_modules/bcrypt/bcrypt.js:6:16)
2018-06-16T10:54:40.337080+00:00 app[web.1]: at Module._compile
(module.js:652:30)
2018-06-16T10:54:40.337082+00:00 app[web.1]: at
Object.Module._extensions..js (module.js:663:10)
2018-06-16T10:54:40.337084+00:00 app[web.1]: at Module.load
(module.js:565:32)
2018-06-16T10:54:40.337087+00:00 app[web.1]: at Function.Module._load
(module.js:497:3)
2018-06-16T10:54:40.337085+00:00 app[web.1]: at tryModuleLoad
(module.js:505:12)
2018-06-16T10:54:40.337088+00:00 app[web.1]: at Module.require
(module.js:596:17)
2018-06-16T10:54:40.337090+00:00 app[web.1]: at require
(internal/module.js:11:18)
2018-06-16T10:54:40.337091+00:00 app[web.1]: at Object.<anonymous>
(/app/models/user.js:2:16)
2018-06-16T10:54:40.337093+00:00 app[web.1]: at Module._compile
(module.js:652:30)
2018-06-16T10:54:40.337094+00:00 app[web.1]: at
Object.Module._extensions..js (module.js:663:10)
2018-06-16T10:54:40.337096+00:00 app[web.1]: at Module.load
(module.js:565:32)
2018-06-16T10:54:40.337097+00:00 app[web.1]: at tryModuleLoad
(module.js:505:12)
2018-06-16T10:54:40.337099+00:00 app[web.1]: at Function.Module._load
(module.js:497:3)
2018-06-16T10:54:40.337100+00:00 app[web.1]: at Module.require
(module.js:596:17)
2018-06-16T10:54:40.337102+00:00 app[web.1]: at require
(internal/module.js:11:18)
2018-06-16T10:54:40.348452+00:00 app[web.1]: npm ERR! code
ELIFECYCLE
2018-06-16T10:54:40.350021+00:00 app[web.1]: npm ERR! errno 1
2018-06-16T10:54:40.355451+00:00 app[web.1]: npm ERR! sailcast#1.0.0
start: `node index.js`
2018-06-16T10:54:40.356150+00:00 app[web.1]: npm ERR! Exit status 1
2018-06-16T10:54:40.357519+00:00 app[web.1]: npm ERR!
2018-06-16T10:54:40.358261+00:00 app[web.1]: npm ERR! Failed at the
sailcast#1.0.0 start script.
2018-06-16T10:54:40.359222+00:00 app[web.1]: npm ERR! This is probably
not a problem with npm. There is likely additional logging output above.
2018-06-16T10:54:40.384205+00:00 app[web.1]:
2018-06-16T10:54:40.384792+00:00 app[web.1]: npm ERR! A complete log of
this run can be found in:
2018-06-16T10:54:40.385145+00:00 app[web.1]: npm ERR!
/app/.npm/_logs/2018-06-16T10_54_40_366Z-debug.log
2018-06-16T10:54:40.480586+00:00 heroku[web.1]: State changed from
starting to crashed
2018-06-16T10:54:40.461008+00:00 heroku[web.1]: Process exited with
status 1
That looks fine. One thing that came up to my mind is that if your file called app.js or index.js since it is an error with npm start? Maybe you made a typo.
Another thing that came up to my mind is that, if you set up the environment database value from the heroku. Since, I cannot see your whole heroku logs, it is another possibility
First time pushing this app to heroku (and first time doing a NodeJS API), and when the app tries to start, I get this error in heroku's logs. It works fine in dev - what am I missing?
I have a file: config/prod.json
And in package.json
"scripts": {
"start": "export NODE_ENV=prod && nodemon ./index.js",
"windev": "set NODE_ENV=dev && nodemon ./index.js",
"dev": "export NODE_ENV=dev && nodemon ./index.js",
"prod": "export NODE_ENV=prod && nodemon ./index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
Full output:
2018-01-05T21:40:37.628592+00:00 app[web.1]: > export NODE_ENV=prod && nodemon ./index.js
2018-01-05T21:40:37.628593+00:00 app[web.1]:
2018-01-05T21:40:39.610679+00:00 app[web.1]: [nodemon] 1.12.5
2018-01-05T21:40:39.620087+00:00 app[web.1]: [nodemon] to restart at any time, enter `rs`
2018-01-05T21:40:39.620443+00:00 app[web.1]: [nodemon] watching: *.*
2018-01-05T21:40:39.621169+00:00 app[web.1]: [nodemon] starting `node ./index.js`
2018-01-05T21:40:42.769518+00:00 app[web.1]: module.js:540
2018-01-05T21:40:42.769527+00:00 app[web.1]: throw err;
2018-01-05T21:40:42.769528+00:00 app[web.1]: ^
2018-01-05T21:40:42.769528+00:00 app[web.1]:
2018-01-05T21:40:42.769529+00:00 app[web.1]: Error: Cannot find module './prod.json'
2018-01-05T21:40:42.769555+00:00 app[web.1]: at Module.require (module.js:587:17)
2018-01-05T21:40:42.769553+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:538:15)
2018-01-05T21:40:42.769554+00:00 app[web.1]: at Function.Module._load (module.js:468:25)
2018-01-05T21:40:42.769559+00:00 app[web.1]: at Module._compile (module.js:643:30)
2018-01-05T21:40:42.769556+00:00 app[web.1]: at Object.<anonymous> (/app/config/config.js:2:18)
2018-01-05T21:40:42.769556+00:00 app[web.1]: at require (internal/module.js:11:18)
2018-01-05T21:40:42.769560+00:00 app[web.1]: at Module.load (module.js:556:32)
2018-01-05T21:40:42.769560+00:00 app[web.1]: at Object.Module._extensions..js (module.js:654:10)
2018-01-05T21:40:42.769561+00:00 app[web.1]: at Function.Module._load (module.js:491:3)
2018-01-05T21:40:42.769561+00:00 app[web.1]: at tryModuleLoad (module.js:499:12)
2018-01-05T21:40:42.769563+00:00 app[web.1]: at require (internal/module.js:11:18)
2018-01-05T21:40:42.769563+00:00 app[web.1]: at Module.require (module.js:587:17)
2018-01-05T21:40:42.769564+00:00 app[web.1]: at Object.<anonymous> (/app/index.js:6:16)
2018-01-05T21:40:42.769565+00:00 app[web.1]: at Module._compile (module.js:643:30)
2018-01-05T21:40:42.769565+00:00 app[web.1]: at Object.Module._extensions..js (module.js:654:10)
2018-01-05T21:40:42.769566+00:00 app[web.1]: at Module.load (module.js:556:32)
2018-01-05T21:40:42.769568+00:00 app[web.1]: at tryModuleLoad (module.js:499:12)
2018-01-05T21:40:42.769569+00:00 app[web.1]: at Function.Module._load (module.js:491:3)
2018-01-05T21:40:42.769570+00:00 app[web.1]: at Function.Module.runMain (module.js:684:10)
2018-01-05T21:40:42.769571+00:00 app[web.1]: at startup (bootstrap_node.js:187:16)
2018-01-05T21:40:42.769572+00:00 app[web.1]: at bootstrap_node.js:608:3
2018-01-05T21:40:42.827358+00:00 app[web.1]: [nodemon] app crashed - waiting for file changes before starting...
I'm following Michael Hartl's Rails tutorial and I'm trying to get the user to be able to upload images. It works fine on the rails server, but when I deploy to Heroku it uses S3 to handle the images. The upload fails with a 403 error. Here are the logs:
2015-01-29T10:31:39.129339+00:00 app[web.1]: (2.0ms) SELECT COUNT(*) FROM "microposts" WHERE (user_id = 101)
2015-01-29T10:31:39.125076+00:00 app[web.1]: Rendered shared/_error_messages.html.erb (0.1ms)
2015-01-29T10:31:39.138938+00:00 app[web.1]: CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 101]]
2015-01-29T10:31:39.155276+00:00 app[web.1]: Rendered shared/_feed.html.erb (28.9ms)
2015-01-29T10:31:39.169708+00:00 app[web.1]: Rendered layouts/_shim.html.erb (0.1ms)
2015-01-29T10:31:39.183946+00:00 app[web.1]: Rendered layouts/_footer.html.erb (0.1ms)
2015-01-29T10:31:39.197655+00:00 heroku[router]: at=info method=GET path="/" host=mysterious-oasis-7816.herokuapp.com request_id=4c2cbe41-3b26-4e37-9ef9-f07ec6e963a6 fwd="76.102.7.62" dyno=web.1 connect=3ms service=109ms status=200 bytes=4525
2015-01-29T10:31:39.369193+00:00 heroku[router]: at=info method=GET path="/assets/application-3ac07d30cc871c78233de32e71487cf3.js" host=mysterious-oasis-7816.herokuapp.com request_id=6cd2bfa0-424b-4456-9cfb-822b515d3bcc fwd="76.102.7.62" dyno=web.1 connect=1ms service=4ms status=304 bytes=241
2015-01-29T10:31:39.365503+00:00 heroku[router]: at=info method=GET path="/assets/application-cbf43ddf42ea7f553995264124e0cacf.css" host=mysterious-oasis-7816.herokuapp.com request_id=d7df3d86-0cf4-444b-bce8-8b164c2dbef6 fwd="76.102.7.62" dyno=web.1 connect=1ms service=3ms status=304 bytes=227
2015-01-29T10:31:39.598181+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=mysterious-oasis-7816.herokuapp.com request_id=386ad300-9cd9-43e7-8112-f918d7c3a7df fwd="76.102.7.62" dyno=web.1 connect=2ms service=2ms status=304 bytes=156
2015-01-29T10:31:46.517236+00:00 app[web.1]: Started POST "/microposts" for 76.102.7.62 at 2015-01-29 10:31:46 +0000
2015-01-29T10:31:46.519545+00:00 app[web.1]: Processing by MicropostsController#create as HTML
2015-01-29T10:31:46.519617+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"p60LlipkvgDwLSAR8oJq+efj9yM0jYixbkwxWxN2v3sojEQFzbMhTVio4pXOwZehVpGQYfgYdnKgHRQomE/txg==", "micropost"=>{"content"=>"Sup", "picture"=>#<ActionDispatch::Http::UploadedFile:0x007f77ae5d1d80 #tempfile=#<Tempfile:/tmp/RackMultipart20150129-12-b07k07.jpg>, #original_filename="10582291_709123052488481_30008247_n.jpg", #content_type="image/jpeg", #headers="Content-Disposition: form-data; name=\"micropost[picture]\"; filename=\"10582291_709123052488481_30008247_n.jpg\"\r\nContent-Type: image/jpeg\r\n">}, "commit"=>"Post"}
2015-01-29T10:31:46.521720+00:00 app[web.1]: User Load (1.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 101]]
2015-01-29T10:31:46.836156+00:00 app[web.1]: (1.5ms) BEGIN
2015-01-29T10:31:46.841095+00:00 app[web.1]: SQL (1.7ms) INSERT INTO "microposts" ("content", "picture", "user_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["content", "Sup"], ["picture", "10582291_709123052488481_30008247_n.jpg"], ["user_id", 101], ["created_at", "201
5-01-29 10:31:46.837765"], ["updated_at", "2015-01-29 10:31:46.837765"]]
2015-01-29T10:31:48.433575+00:00 heroku[router]: at=info method=POST path="/microposts" host=mysterious-oasis-7816.herokuapp.com request_id=d7e1b8ee-3e5d-45ef-9578-4f242fd160db fwd="76.102.7.62" dyno=web.1 connect=1ms service=2239ms status=500 bytes=1786
2015-01-29T10:31:48.427961+00:00 app[web.1]: (1.3ms) ROLLBACK
2015-01-29T10:31:48.431863+00:00 app[web.1]:
2015-01-29T10:31:48.431866+00:00 app[web.1]: Excon::Errors::Forbidden (Expected(200) <=> Actual(403 Forbidden)
2015-01-29T10:31:48.431868+00:00 app[web.1]: excon.error.response
2015-01-29T10:31:48.431870+00:00 app[web.1]: :body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>2E3F56207B398181</RequestId><HostId>XIDq0YLLZd8ZdGB1mTuUiofj5vh0V4lt5hb/jow79dysteI26fEr/gNMpGqF5qCv0zPmFiEYtCY=</HostId></Error>"
2015-01-29T10:31:48.431871+00:00 app[web.1]: :headers => {
2015-01-29T10:31:48.431873+00:00 app[web.1]: "Connection" => "close"
2015-01-29T10:31:48.431874+00:00 app[web.1]: "Content-Type" => "application/xml"
2015-01-29T10:31:48.431875+00:00 app[web.1]: "Date" => "Thu, 29 Jan 2015 10:31:47 GMT"
2015-01-29T10:31:48.431878+00:00 app[web.1]: "x-amz-id-2" => "XIDq0YLLZd8ZdGB1mTuUiofj5vh0V4lt5hb/jow79dysteI26fEr/gNMpGqF5qCv0zPmFiEYtCY="
2015-01-29T10:31:48.431879+00:00 app[web.1]: "x-amz-request-id" => "2E3F56207B398181"
2015-01-29T10:31:48.431881+00:00 app[web.1]: }
2015-01-29T10:31:48.431882+00:00 app[web.1]: :local_address => "172.17.38.98"
2015-01-29T10:31:48.431883+00:00 app[web.1]: :local_port => 34183
2015-01-29T10:31:48.431885+00:00 app[web.1]: :reason_phrase => "Forbidden"
2015-01-29T10:31:48.431877+00:00 app[web.1]: "Server" => "AmazonS3"
2015-01-29T10:31:48.431890+00:00 app[web.1]: app/controllers/microposts_controller.rb:7:in `create'
2015-01-29T10:31:48.431891+00:00 app[web.1]:
2015-01-29T10:31:48.431892+00:00 app[web.1]:
2015-01-29T10:31:48.431886+00:00 app[web.1]: :remote_ip => "54.231.160.162"
2015-01-29T10:31:48.431887+00:00 app[web.1]: :status => 403
2015-01-29T10:31:48.431889+00:00 app[web.1]: ):
2015-01-29T10:31:48.429838+00:00 app[web.1]: Completed 500 Internal Server Error in 1910ms
2015-01-29T10:46:55.496986+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=mysterious-oasis-7816.herokuapp.com request_id=2a227f3f-20da-405f-b150-f4e4cbc62c0c fwd="76.102.7.62" dyno=web.1 connect=1ms service=1ms status=304 bytes=156
2015-01-29T10:46:57.592699+00:00 app[web.1]: Processing by MicropostsController#create as HTML
2015-01-29T10:46:57.592801+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"p60LlipkvgDwLSAR8oJq+efj9yM0jYixbkwxWxN2v3sojEQFzbMhTVio4pXOwZehVpGQYfgYdnKgHRQomE/txg==", "micropost"=>{"content"=>"Sup", "picture"=>#<ActionDispatch::Http::UploadedFile:0x007f77b148e678 #tempfile=#<Tempfile:/tmp/RackMultipart20150129-6-kbjdeu.jpg>, #original_filename="10582291_709123052488481_30008247_n.jpg", #content_type="image/jpeg", #headers="Content-Disposition: form-data; name=\"micropost[picture]\"; filename=\"10582291_709123052488481_30008247_n.jpg\"\r\nContent-Type: image/jpeg\r\n">}, "commit"=>"Post"}
2015-01-29T10:46:57.595260+00:00 app[web.1]: User Load (1.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 101]]
2015-01-29T10:46:57.589391+00:00 app[web.1]: Started POST "/microposts" for 76.102.7.62 at 2015-01-29 10:46:57 +0000
2015-01-29T10:46:57.898731+00:00 app[web.1]: (1.4ms) BEGIN
2015-01-29T10:46:57.906703+00:00 app[web.1]: SQL (2.1ms) INSERT INTO "microposts" ("content", "picture", "user_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["content", "Sup"], ["picture", "10582291_709123052488481_30008247_n.jpg"], ["user_id", 101], ["created_at", "2015-01-29 10:46:57.900611"], ["updated_at", "2015-01-29 10:46:57.900611"]]
2015-01-29T10:46:59.548010+00:00 heroku[router]: at=info method=POST path="/microposts" host=mysterious-oasis-7816.herokuapp.com request_id=e7867249-ff62-4fa0-bf0e-9dadd9134640 fwd="76.102.7.62" dyno=web.1 connect=1ms service=2273ms status=500 bytes=1786
2015-01-29T10:46:59.542346+00:00 app[web.1]: (1.4ms) ROLLBACK
2015-01-29T10:46:59.546576+00:00 app[web.1]:
2015-01-29T10:46:59.546579+00:00 app[web.1]: Excon::Errors::Forbidden (Expected(200) <=> Actual(403 Forbidden)
2015-01-29T10:46:59.546581+00:00 app[web.1]: excon.error.response
2015-01-29T10:46:59.546583+00:00 app[web.1]: :body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>6B6A73213C176F40</RequestId><HostId>QDnWZ627/2/Wuf7z4nuQnS/u+ysezUG/o2IqDnO9hgAJBJF+H3h4uexFerBeON2V</HostId></Error>"
2015-01-29T10:46:59.546584+00:00 app[web.1]: :headers => {
2015-01-29T10:46:59.546586+00:00 app[web.1]: "Connection" => "close"
2015-01-29T10:46:59.546587+00:00 app[web.1]: "Content-Type" => "application/xml"
2015-01-29T10:46:59.546589+00:00 app[web.1]: "Date" => "Thu, 29 Jan 2015 10:46:58 GMT"
2015-01-29T10:46:59.546591+00:00 app[web.1]: "Server" => "AmazonS3"
2015-01-29T10:46:59.546593+00:00 app[web.1]: "x-amz-id-2" => "QDnWZ627/2/Wuf7z4nuQnS/u+ysezUG/o2IqDnO9hgAJBJF+H3h4uexFerBeON2V"
2015-01-29T10:46:59.546594+00:00 app[web.1]: "x-amz-request-id" => "6B6A73213C176F40"
2015-01-29T10:46:59.546595+00:00 app[web.1]: }
2015-01-29T10:46:59.546597+00:00 app[web.1]: :local_address => "172.17.38.98"
2015-01-29T10:46:59.546598+00:00 app[web.1]: :local_port => 47100
2015-01-29T10:46:59.546601+00:00 app[web.1]: :remote_ip => "54.231.164.162"
2015-01-29T10:46:59.546600+00:00 app[web.1]: :reason_phrase => "Forbidden"
2015-01-29T10:46:59.546603+00:00 app[web.1]: :status => 403
2015-01-29T10:46:59.546604+00:00 app[web.1]: ):
2015-01-29T10:46:59.546606+00:00 app[web.1]: app/controllers/microposts_controller.rb:7:in `create'
2015-01-29T10:46:59.546607+00:00 app[web.1]:
2015-01-29T10:46:59.546608+00:00 app[web.1]:
2015-01-29T10:46:59.544420+00:00 app[web.1]: Completed 500 Internal Server Error in 1951ms
2015-01-29T10:47:51.464274+00:00 app[web.1]: Started POST "/microposts" for 76.102.7.62 at 2015-01-29 10:47:51 +0000
2015-01-29T10:47:51.468398+00:00 app[web.1]: Processing by MicropostsController#create as HTML
2015-01-29T10:47:51.473171+00:00 app[web.1]: User Load (1.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 101]]
2015-01-29T10:47:51.468507+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"p60LlipkvgDwLSAR8oJq+efj9yM0jYixbkwxWxN2v3sojEQFzbMhTVio4pXOwZehVpGQYfgYdnKgHRQomE/txg==", "micropost"=>{"content"=>"Sup", "picture"=>#<ActionDispatch::Http::UploadedFile:0x007f77ae6c1358 #tempfile=#<Tempfile:/tmp/RackMultipart20150129-9-6wmavu.jpg>, #original_filename="10582291_709123052488481_30008247_n.jpg", #content_type="image/jpeg", #headers="Content-Disposition: form-data; name=\"micropost[picture]\"; filename=\"10582291_709123052488481_30008247_n.jpg\"\r\nContent-Type: image/jpeg\r\n">}, "commit"=>"Post"}
2015-01-29T10:47:51.786456+00:00 app[web.1]: (1.4ms) BEGIN
2015-01-29T10:47:51.794299+00:00 app[web.1]: SQL (2.0ms) INSERT INTO "microposts" ("content", "picture", "user_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["content", "Sup"], ["picture", "10582291_709123052488481_30008247_n.jpg"], ["user_id", 101], ["created_at", "2015-01-29 10:47:51.788551"], ["updated_at", "2015-01-29 10:47:51.788551"]]
2015-01-29T10:47:53.555368+00:00 heroku[router]: at=info method=POST path="/microposts" host=mysterious-oasis-7816.herokuapp.com request_id=86847ddb-74ec-4800-a18f-a07f2431cef9 fwd="76.102.7.62" dyno=web.1 connect=1ms service=2197ms status=500 bytes=1786
2015-01-29T10:47:53.550620+00:00 app[web.1]: (1.3ms) ROLLBACK
2015-01-29T10:47:53.554579+00:00 app[web.1]:
2015-01-29T10:47:53.554582+00:00 app[web.1]: Excon::Errors::Forbidden (Expected(200) <=> Actual(403 Forbidden)
2015-01-29T10:47:53.554584+00:00 app[web.1]: excon.error.response
2015-01-29T10:47:53.554587+00:00 app[web.1]: :headers => {
2015-01-29T10:47:53.554586+00:00 app[web.1]: :body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>6A39B8D8600F9D09</RequestId><HostId>cRac47ERlbGbSfrsTNt/fF+zt5CvM7Io8HZXU5A27l207MleOMCsGIRdmElP0Kk4</HostId></Error>"
2015-01-29T10:47:53.554589+00:00 app[web.1]: "Connection" => "close"
2015-01-29T10:47:53.554590+00:00 app[web.1]: "Content-Type" => "application/xml"
2015-01-29T10:47:53.554593+00:00 app[web.1]: "Server" => "AmazonS3"
2015-01-29T10:47:53.554592+00:00 app[web.1]: "Date" => "Thu, 29 Jan 2015 10:47:53 GMT"
2015-01-29T10:47:53.554595+00:00 app[web.1]: "x-amz-id-2" => "cRac47ERlbGbSfrsTNt/fF+zt5CvM7Io8HZXU5A27l207MleOMCsGIRdmElP0Kk4"
2015-01-29T10:47:53.554612+00:00 app[web.1]: "x-amz-request-id" => "6A39B8D8600F9D09"
2015-01-29T10:47:53.554613+00:00 app[web.1]: }
2015-01-29T10:47:53.554619+00:00 app[web.1]: :remote_ip => "54.231.165.74"
2015-01-29T10:47:53.554620+00:00 app[web.1]: :status => 403
2015-01-29T10:47:53.554623+00:00 app[web.1]: app/controllers/microposts_controller.rb:7:in `create'
2015-01-29T10:47:53.554622+00:00 app[web.1]: ):
2015-01-29T10:47:53.554615+00:00 app[web.1]: :local_address => "172.17.38.98"
2015-01-29T10:47:53.554616+00:00 app[web.1]: :local_port => 40757
2015-01-29T10:47:53.554618+00:00 app[web.1]: :reason_phrase => "Forbidden"
2015-01-29T10:47:53.554625+00:00 app[web.1]:
2015-01-29T10:47:53.554626+00:00 app[web.1]:
2015-01-29T10:47:53.552507+00:00 app[web.1]: Completed 500 Internal Server Error in 2084ms
Please help :(
I had a similar problem, it was a matter of formatting the url differently depending on the region you create your bucket in.
You can sometimes use this:
https://s3-us-west-2.amazonaws.com/
and some times you have to use this:
https://bucket-name.s3-us-west-2.amazonaws.com/
I do not know which format you are using, but try the other one :)
For more info on the urls to access diffrent regions look at this:
http://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteEndpoints.html
Thanks for the help guys, I figured it out. It turns out it was something really silly, I didn't set the allowed users to registered users.