Error after (seemingly) following the Heroku instructions for Node.js - node.js

ANSWER: Don't put a Gemfile into the root of your Node.js project. Heroku get's confused and treats it like a Ruby app.
I am trying to follow the instructions from the Heroku documentation but am receiving an error: "No such file or directory - node web.js".
My Procfile is...
web: node web.js
Foreman runs locally as expected.
Here's a logging snapshot...
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 heroku[web.1]: Process exited
And my heroku ps output...
Process State Command
------------ ------------------ ------------------------------
web.1 crashed for 8m node web.js
Source is https://github.com/just3ws/hellode
If it didn't run locally I'd move forward and just assume it was only me.
Thanks in advance.

My guess is it's the Gemfile or .rvmrc ;)
http://twitter.com/ryanbriones/status/94212379654631424

Related

How can I fix Error R10 (Boot timeout) on Gatsby JS?

I want to set up Gatsby on Heroku. I have followed the steps from https://www.gatsbyjs.org/docs/deploying-to-heroku/ and created a Procfile as described here https://devcenter.heroku.com/articles/procfile, but I'm still getting a timeout error on deploy. It seems like the port is starting to work, but for some reason it stops.
I've tried different lines to put in Procfile, but none of them worked. Currently I have web: gatsby serve --port $PORT - this is the last thing that I've tried putting in this file. Also I tried with web: npm start -- --port $PORT and other options that can be googled easily.
2019-10-24T23:06:52.707649+00:00 app[web.1]:
2019-10-24T23:07:49.930330+00:00 heroku[web.1]: State changed from starting to crashed
2019-10-24T23:07:49.832843+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2019-10-24T23:07:49.832843+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-10-24T23:07:49.910127+00:00 heroku[web.1]: Process exited with status 137
Disconnected from log stream. There may be events happening that you do not see here! Attempting to reconnect...
2019-10-24T23:06:52.444262+00:00 app[web.1]: ║ To learn more, checkout https://gatsby.dev/telemetry ║
2019-10-24T23:06:52.444263+00:00 app[web.1]: ║ ║
2019-10-24T23:06:52.444264+00:00 app[web.1]: ╚════════════════════════════════════════════════════════════════════════╝
2019-10-24T23:06:52.445563+00:00 app[web.1]:
2019-10-24T23:06:52.707515+00:00 app[web.1]: [2K[1A[2K[Ginfo gatsby serve running at: http://localhost:4563/
2019-10-24T23:06:52.707649+00:00 app[web.1]:
2019-10-24T23:07:49.930330+00:00 heroku[web.1]: State changed from starting to crashed
2019-10-24T23:07:49.832843+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2019-10-24T23:07:49.832843+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-10-24T23:07:49.910127+00:00 heroku[web.1]: Process exited with status 137
Any ideas how can I get it working?
You would want to use gatsby build and not gatsby serve as the latter is meant for testing locally. gatsby build will give you static assets and speed optimizations. Try to remove the Procfile and then Heroku should catch the build command in package.json.

heroku application crashing everytime

i tried to deploy a telegram bot using heroku but its throwing some errors
tried rebuilding the app multiple times even rechecked the code and changed some stuff in the settings but nothing worked
2019-04-28T20:00:06.366752+00:00 app[api]:`enter code here` Release v9 created by user testpaypal580#gmail.com
2019-04-28T20:00:06.366752+00:00 app[api]: Deploy 0ac91a7b by user testpaypal580#gmail.com
2019-04-28T20:00:06.892646+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-28T20:00:10.782109+00:00 heroku[web.1]: Starting process with command `python3 dwsongs-normal.py`
2019-04-28T20:00:12.946054+00:00 app[web.1]: /app/.heroku/python/lib/python3.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.25.1) or chardet (3.0.4) doesn't match a supported version!
2019-04-28T20:00:12.946075+00:00 app[web.1]: RequestsDependencyWarning)
2019-04-28T20:00:15.000000+00:00 app[api]: Build succeeded
2019-04-28T20:00:17.102728+00:00 app[web.1]: 1):Free
2019-04-28T20:00:17.102853+00:00 app[web.1]: 2):Strict
2019-04-28T20:00:17.103267+00:00 app[web.1]: :ChooseTraceback (most recent call last):
2019-04-28T20:00:17.103306+00:00 app[web.1]: File "dwsongs-normal.py", line 787, in <module>
2019-04-28T20:00:17.104544+00:00 app[web.1]: ans = input(":Choose")
2019-04-28T20:00:17.104735+00:00 app[web.1]: EOFError: EOF when reading a line
2019-04-28T20:00:17.279581+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-28T20:00:17.263327+00:00 heroku[web.1]: Process exited with status 1
this is the log i get
any help would be appreciated
code:
try:
print("1):Free")
print("2):Strict")
ans = input("Choose:")
if ans == "1":
bot.message_loop({
"chat": start,
"callback_query": download,
"inline_query": search,
"chosen_inline_result": up
})
Try removing your input and print statements. Your program will crash if it's printing to stdout without there being one. You can instead redirect your output to /dev/null by ending your script with > /dev/null e.g. python3 dwsongs-normal.py > /dev/null

heroku is giving me Method not allowed [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 10 months ago.
The community reviewed whether to reopen this question 10 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
Okay, so I've been on this problem for hours now with no idea how to solve this, since I'm just a newbie. I was following a UDEMY course titled WEBDEVBOOTCAMP by Colt Steele. On the deployment section, every time I deploy using Heroku, this gives me a "Method not allowed". I've been following Colt's ways from scratch and that's why I wonder how come it's like this.
These are the Heroku logs that I've been receiving:
2017-08-07T21:45:10.990742+00:00 heroku[web.1]: Starting process with command `npm start`
2017-08-07T21:45:14.881336+00:00 app[web.1]:
2017-08-07T21:45:14.881350+00:00 app[web.1]: > v1#1.0.0 start /app
2017-08-07T21:45:14.881352+00:00 app[web.1]:
2017-08-07T21:45:14.881351+00:00 app[web.1]: > node app.js
2017-08-07T21:45:16.594550+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2017-08-07T21:45:16.594555+00:00 app[web.1]: designed for a production
environment, as it will leak
2017-08-07T21:45:16.594556+00:00 app[web.1]: memory, and will not scale past a single process.
2017-08-07T21:45:16.610398+00:00 app[web.1]: (node:17) DeprecationWarning: `open()` is deprecated in mongoose >= 4.11.0, use `openUri()` instead, or set the `useMongoClient` option if using `connect()` or `createConnection()`. See http://mongoosejs.com/docs/connections.html#use-mongo-client
2017-08-07T21:45:16.612243+00:00 app[web.1]: The Yelp Camp Server is up!
2017-08-07T21:45:16.665653+00:00 app[web.1]: Db.prototype.authenticate method will no longer be available in the next major release 3.x as MongoDB 3.6 will only allow auth against users in the admin db and will no longer allow multiple credentials on a socket. Please authenticate using MongoClient.connect with auth credentials.
2017-08-07T21:45:16.914410+00:00 heroku[web.1]: State changed from starting to up
2017-08-07T21:54:00.075655+00:00 app[api]: Starting process with command `ls` by user lao_tabudlong#yahoo.com
2017-08-07T21:54:03.051279+00:00 heroku[run.4055]: Awaiting client
2017-08-07T21:54:03.090885+00:00 heroku[run.4055]: Starting process with command `ls`
2017-08-07T21:54:03.268924+00:00 heroku[run.4055]: State changed from starting to up
2017-08-07T21:54:08.289699+00:00 heroku[run.4055]: Process exited with status 0
2017-08-07T21:54:08.303853+00:00 heroku[run.4055]: State changed from up to complete
2017-08-07T22:16:51.093190+00:00 heroku[web.1]: Idling
2017-08-07T22:16:51.093810+00:00 heroku[web.1]: State changed from up to down
2017-08-07T22:16:52.026960+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2017-08-07T22:16:52.187881+00:00 heroku[web.1]: Process exited with status 143
2017-08-07T22:38:33.000000+00:00 app[api]: Build started by user lao_tabudlong#yahoo.com
2017-08-07T22:38:44.152229+00:00 heroku[web.1]: State changed from down to starting
2017-08-07T22:38:43.802847+00:00 app[api]: Deploy 8174904f by user lao_tabudlong#yahoo.com
2017-08-07T22:38:43.802847+00:00 app[api]: Release v5 created by user lao_tabudlong#yahoo.com
2017-08-07T22:38:33.000000+00:00 app[api]: Build succeeded
2017-08-07T22:38:45.764651+00:00 heroku[web.1]: Starting process with command `npm start`
2017-08-07T22:38:48.251552+00:00 app[web.1]:
2017-08-07T22:38:48.251586+00:00 app[web.1]: > yelpcamp#1.0.0 start /app
2017-08-07T22:38:48.251586+00:00 app[web.1]: > node app.js
2017-08-07T22:38:48.251587+00:00 app[web.1]:
2017-08-07T22:38:49.001981+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2017-08-07T22:38:49.001994+00:00 app[web.1]: designed for a production environment, as it will leak
2017-08-07T22:38:49.001995+00:00 app[web.1]: memory, and will not scale past a single process.
2017-08-07T22:38:49.018239+00:00 app[web.1]: (node:17) DeprecationWarning: `open()` is deprecated in mongoose >= 4.11.0, use `openUri()` instead, or set the `useMongoClient` option if using `connect()` or `createConnection()`. See http://mongoosejs.com/docs/connections.html#use-mongo-client
2017-08-07T22:38:49.020061+00:00 app[web.1]: The Yelp Camp Server is up!
2017-08-07T22:38:49.043200+00:00 app[web.1]: Db.prototype.authenticate method will no longer be available in the next major release 3.x as MongoDB 3.6 will only allow auth against users in the admin db and will no longer allow multiple credentials on a socket. Please authenticate using MongoClient.connect with auth credentials.
2017-08-07T22:38:49.214038+00:00 heroku[web.1]: State changed from starting to up
2017-08-07T23:10:56.925104+00:00 heroku[web.1]: Idling
2017-08-07T23:10:56.925706+00:00 heroku[web.1]: State changed from up to down
2017-08-07T23:10:58.007504+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2017-08-07T23:10:58.359969+00:00 heroku[web.1]: Process exited with status 143
2017-08-08T04:47:35.000000+00:00 app[api]: Build started by user lao_tabudlong#yahoo.com
2017-08-08T04:47:45.285929+00:00 heroku[web.1]: State changed from down to starting
2017-08-08T04:47:35.000000+00:00 app[api]: Build succeeded
2017-08-08T04:47:45.069248+00:00 app[api]: Release v6 created by user lao_tabudlong#yahoo.com
2017-08-08T04:47:45.069248+00:00 app[api]: Deploy f14ef4fc by user lao_tabudlong#yahoo.com
2017-08-08T04:47:46.628278+00:00 heroku[web.1]: Starting process with command `npm start`
2017-08-08T04:47:48.774464+00:00 app[web.1]:
2017-08-08T04:47:48.774484+00:00 app[web.1]: > yelpcamp#1.0.0 start /app
2017-08-08T04:47:48.774485+00:00 app[web.1]: > node app.js
2017-08-08T04:47:48.774486+00:00 app[web.1]:
2017-08-08T04:47:49.444240+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2017-08-08T04:47:49.444256+00:00 app[web.1]: designed for a production environment, as it will leak
2017-08-08T04:47:49.444256+00:00 app[web.1]: memory, and will not scale past a single process.
2017-08-08T04:47:49.454406+00:00 app[web.1]: (node:17) DeprecationWarning: `open()` is deprecated in mongoose >= 4.11.0, use `openUri()` instead, or set the `useMongoClient` option if using `connect()` or `createConnection()`. See http://mongoosejs.com/docs/connections.html#use-mongo-client
2017-08-08T04:47:49.455893+00:00 app[web.1]: The Yelp Camp Server is up!
2017-08-08T04:47:49.472576+00:00 app[web.1]: Db.prototype.authenticate method will no longer be available in the next major release 3.x as MongoDB 3.6 will only allow auth against users in the admin db and will no longer allow multiple credentials on a socket. Please authenticate using MongoClient.connect with auth credentials.
2017-08-08T04:47:49.919585+00:00 heroku[web.1]: State changed from starting to up
2017-08-08T05:21:42.640479+00:00 heroku[web.1]: Idling
2017-08-08T05:21:42.641117+00:00 heroku[web.1]: State changed from up to down
2017-08-08T05:21:43.112034+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2017-08-08T05:21:43.397138+00:00 heroku[web.1]: Process exited with status 143
2017-08-08T05:35:24.000000+00:00 app[api]: Build started by user lao_tabudlong#yahoo.com
2017-08-08T05:35:34.046061+00:00 app[api]: Release v7 created by user lao_tabudlong#yahoo.com
2017-08-08T05:35:34.046061+00:00 app[api]: Deploy 52579a31 by user lao_tabudlong#yahoo.com
2017-08-08T05:35:34.347211+00:00 heroku[web.1]: State changed from down to starting
2017-08-08T05:35:24.000000+00:00 app[api]: Build succeeded
2017-08-08T05:35:36.040512+00:00 heroku[web.1]: Starting process with command `npm start`
2017-08-08T05:35:38.881422+00:00 app[web.1]:
2017-08-08T05:35:38.881446+00:00 app[web.1]: > yelpcamp#1.0.0 start /app
2017-08-08T05:35:38.881447+00:00 app[web.1]: > node app.js
2017-08-08T05:35:38.881448+00:00 app[web.1]:
2017-08-08T05:35:39.981312+00:00 heroku[web.1]: State changed from starting to up
2017-08-08T05:35:39.914694+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2017-08-08T05:35:39.914717+00:00 app[web.1]: designed for a production environment, as it will leak
2017-08-08T05:35:39.914718+00:00 app[web.1]: memory, and will not scale past a single process.
2017-08-08T05:35:39.932988+00:00 app[web.1]: (node:17) DeprecationWarning: `open()` is deprecated in mongoose >= 4.11.0, use `openUri()` instead, or set the `useMongoClient` option if using `connect()` or `createConnection()`. See http://mongoosejs.com/docs/connections.html#use-mongo-client
2017-08-08T05:35:39.935319+00:00 app[web.1]: The Yelp Camp Server is up!
2017-08-08T05:35:39.967512+00:00 app[web.1]: Db.prototype.authenticate method will no longer be available in the next major release 3.x as MongoDB 3.6 will only allow auth against users in the admin db and will no longer allow multiple credentials on a socket. Please authenticate using MongoClient.connect with auth credentials.
2017-08-08T05:49:20.000000+00:00 app[api]: Build started by user lao_tabudlong#yahoo.com
2017-08-08T05:49:31.423119+00:00 heroku[web.1]: Restarting
2017-08-08T05:49:31.425641+00:00 heroku[web.1]: State changed from up to starting
2017-08-08T05:49:31.128129+00:00 app[api]: Deploy 98890a0e by user lao_tabudlong#yahoo.com
2017-08-08T05:49:31.128129+00:00 app[api]: Release v8 created by user lao_tabudlong#yahoo.com
2017-08-08T05:49:32.024642+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2017-08-08T05:49:32.234319+00:00 heroku[web.1]: Process exited with status 143
2017-08-08T05:49:20.000000+00:00 app[api]: Build succeeded
2017-08-08T05:49:33.865572+00:00 heroku[web.1]: Starting process with command `npm start`
2017-08-08T05:49:36.912525+00:00 app[web.1]:
2017-08-08T05:49:36.912549+00:00 app[web.1]: > yelpcamp#1.0.0 start /app
2017-08-08T05:49:36.912550+00:00 app[web.1]: > node app.js
2017-08-08T05:49:36.912550+00:00 app[web.1]: `enter code here`
2017-08-08T05:49:38.250325+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2017-08-08T05:49:38.250352+00:00 app[web.1]: designed for a production environment, as it will leak
2017-08-08T05:49:38.250353+00:00 app[web.1]: memory, and will not scale past a single process.
2017-08-08T05:49:38.270747+00:00 app[web.1]: (node:17) DeprecationWarning: `open()` is deprecated in mongoose >= 4.11.0, use `openUri()` instead, or set the `useMongoClient` option if using `connect()` or `createConnection()`. See http://mongoosejs.com/docs/connections.html#use-mongo-client
2017-08-08T05:49:38.273329+00:00 app[web.1]: The Yelp Camp Server is up!
2017-08-08T05:49:38.314596+00:00 app[web.1]: Db.prototype.authenticate method will no longer be available in the next major release 3.x as MongoDB 3.6 will only allow auth against users in the admin db and will no longer allow multiple credentials on a socket. Please authenticate using MongoClient.connect with auth credentials.
2017-08-08T05:49:38.342241+00:00 heroku[web.1]: State changed from starting to up
From the Q&A on the webdevbootcamp video:
"Make sure you are trying to access the correct link that gets printed to the console. You shouldn't try to load the link which ends with .git since that is just the repository location.
Your link should look like https://your-app-name.herokuapp.com/"
I faced the same problem. Check your url, you might be opening the one which ends in .git. Instead go to your heroku dashboard and open the app from there using the correct url.
This Problem Bacicaly comes when you are using wrong link
Your link should be like https://test-name.herokuapp.com/
With reference to Matt's answer: -
Even if the deployment is successful, but you have not defined a html as to how the webpage should look like, then you get 'Method not allowed', meaning,
"https://your-app-name.herokuapp.com/" will have "Method not allowed".
But there is a way you can test if the deployment is done okay and you are getting Response 200.
Open jupyter notebook and run:
Reference: https://towardsdatascience.com/create-an-api-to-deploy-machine-learning-models-using-flask-and-heroku-67a011800c50
In short :
import requests
import json
# local url
url = 'https://your-app.herokuapp.com/'
# sample data
data = {'Pclass': 3
, 'Age': 2
, 'SibSp': 1
, 'Fare': 50}
data = json.dumps(data)
send_request = requests.post(url, data) #should get : Response 200
print(send_request.json())# should get predicted result
I faced the same issue while deploying a golang web app on heroku. The root cause of the issue was with how i frame the url. The url generated by heroku consisted of a trailing "/" and i was constructing the url as "heroku_url" + "/login" which resulted in heroku_url//login, try removing a / from heroku_url or from your route and give a try.
Before deploying your app make sure your project is on the main branch.
Refer: Git Branches.

Heroku Logs - open log referred to in error message

I'm deploying a node.js app to heroku (cedar stack)
I've set the NODE_ENV like this:
heroku config:add NODE_ENV=production
I then do:
git push heroku
However, after starting (i've got a console.log generating the first log entry) the app crashes.
I run:
heroku logs
and get the below error.
How can I open the /app/log/production.log that it's referring to?
app[web.1]: listening on port 32168 within production environment
app[web.1]:
app[web.1]: events.js:48
app[web.1]: throw arguments[1]; // Unhandled 'error' event
app[web.1]: ^
app[web.1]: Error: ENOENT, open '/app/log/production.log'
heroku[web.1]: Process exited with status 1
heroku[web.1]: State changed from starting to crashed
The error you're getting means that it's trying to open '/app/log/production.log' and is unable to do so. So find out where this logging is being attempted and disable or change it.
According to Heroku you should just be sending your application logs to STDOUT:
https://devcenter.heroku.com/articles/logging
So a console.log should be sufficient.

App works locally, crashes on Heroku - Node.JS

I'm running a simple express app, it is pulling static files from S3, and runs fine locally, but on Heroku it crashes constantly on a warning about permission denied but with no further info.
Is there a way I could find out what is causing the permission error?
Heroku log from deploy to crash:
2011-12-26T22:41:14+00:00 heroku[slugc]: Slug compilation started
2011-12-26T22:41:19+00:00 heroku[api]: Deploy 20d0578 by jeffandersen#gmail.com
2011-12-26T22:41:19+00:00 heroku[api]: Release v20 created by jeffandersen#gmail.com
2011-12-26T22:41:20+00:00 heroku[web.1]: State changed from crashed to created
2011-12-26T22:41:20+00:00 heroku[web.1]: State changed from created to starting
2011-12-26T22:41:21+00:00 heroku[slugc]: Slug compilation finished
2011-12-26T22:41:22+00:00 heroku[web.1]: Starting process with command `node server.js`
2011-12-26T22:41:23+00:00 app[web.1]: info - socket.io started
2011-12-26T22:41:23+00:00 app[web.1]: warn - error raised: Error: EACCES, Permission denied
2011-12-26T22:41:24+00:00 heroku[web.1]: State changed from starting to crashed
2011-12-26T22:41:25+00:00 heroku[web.1]: Process exited
Are you binding the server port to the environment variable injected by Heroku, $PORT?

Resources