I managed to get sockets to work on my LocalHost, however when uploading to Heroku I get the following errors.
Heroku logs:
2020-02-26T19:18:12.223451+00:00 heroku[router]: at=info method=GET path="/socket.io/?EIO=3&transport=polling&t=N22xsN8" host=evening-beach-84352.herokuapp.com request_id=9e085385-d06d-42f8-a02b-741ebdb50139 fwd="99.239.140.92" dyno=web.1 connect=1ms service=7ms status=200 bytes=1156 protocol=https
2020-02-26T19:18:16.268249+00:00 heroku[router]: at=info method=GET path="/socket.io/?EIO=3&transport=polling&t=N22xtMN" host=evening-beach-84352.herokuapp.com request_id=560a1283-e9ad-4f98-b65d-c98e3af0d989 fwd="99.239.140.92" dyno=web.1 connect=1ms service=7ms status=200 bytes=1156 protocol=https
2020-02-26T19:18:16.340518+00:00 heroku[router]: at=info method=POST path="/socket.io/?EIO=3&transport=polling&t=N22xtNI" host=evening-beach-84352.herokuapp.com request_id=0747c99f-bfa7-4a48-9dc9-396237ea4afd fwd="99.239.140.92" dyno=web.1 connect=1ms service=17ms status=404 bytes=417 protocol=https
2020-02-26T19:18:16.345722+00:00 heroku[router]: at=info method=GET path="/socket.io/?EIO=3&transport=polling&t=N22xtNd" host=evening-beach-84352.herokuapp.com request_id=c28aa30e-c33f-4d2b-809d-7f723c9ad2f8 fwd="99.239.140.92" dyno=web.1 connect=1ms service=11ms status=200 bytes=1156 protocol=https
2020-02-26T19:18:16.394512+00:00 heroku[router]: at=info method=POST path="/socket.io/?EIO=3&transport=polling&t=N22xtOS" host=evening-beach-84352.herokuapp.com request_id=93635a58-6c21-4d1a-81b4-ba67c712bc4a fwd="99.239.140.92" dyno=web.1 connect=1ms service=3ms status=404 bytes=417 protocol=https
2020-02-26T19:18:18.146871+00:00 heroku[router]: at=info method=GET path="/socket.io/?EIO=3&transport=polling&t=N22xtpq" host=evening-beach-84352.herokuapp.com request_id=8dc8077a-5719-4f97-bd60-dc2f9585efea fwd="99.239.140.92" dyno=web.1 connect=1ms service=5ms status=200 bytes=1156 protocol=https
2020-02-26T19:18:18.104971+00:00 heroku[router]: at=info method=GET path="/socket.io/?EIO=3&transport=polling&t=N22xtp6" host=evening-beach-84352.herokuapp.com request_id=1a135498-5911-4757-90a6-52f22188b3ae fwd="99.239.140.92" dyno=web.1 connect=1ms service=8ms status=200 bytes=1156 protocol=https
2020-02-26T19:18:18.174618+00:00 heroku[router]: at=info method=POST path="/socket.io/?EIO=3&transport=polling&t=N22xtqB" host=evening-beach-84352.herokuapp.com request_id=dce824bb-5243-45be-bd9b-5be3026412ac fwd="99.239.140.92" dyno=web.1 connect=1ms service=3ms status=404 bytes=417 protocol=https
2020-02-26T19:18:18.235090+00:00 heroku[router]: at=info method=POST path="/socket.io/?EIO=3&transport=polling&t=N22xtr2" host=evening-beach-84352.herokuapp.com request_id=44dbc61d-5e40-4283-b602-77107c20bdcd fwd="99.239.140.92" dyno=web.1 connect=1ms service=7ms status=404 bytes=417 protocol=https
Browser console logs:
polling-xhr.js:271 POST https://evening-beach-84352.herokuapp.com/socket.io/?EIO=3&transport=polling&t=N22yWHd 404 (Not Found)
I have this set up on my client side code:
import socketIOClient from "socket.io-client";
const socket = socketIOClient("https://evening-beach-84352.herokuapp.com/")
And this one my server side code:
const server = require('http').Server(app);
const socketIO = require('socket.io')
const io = socketIO(server, { origin: "*:*" });
const PORT = process.env.PORT || 8080;
Have you enabled session affinity in your app? From the support article:
Apps using Socket.io should enable session affinity. If you plan to
use Node’s Cluster module or to scale your app to multiple dynos, you
should also follow Socket.io’s multiple-nodes instructions.
heroku features:enable http-session-affinity
I just started using Heroku recently and just added socket.io to my application and am seeing similar errors. Yesterday they went away, today they are back. I have two tabs in my browser 1 works the other doesn't...
The difference: http vs https
When you click the link in Heroku to take you to your app it navigates to https://myapp.herokuapp.com but if I manually navigate to http://myapp.herokuapp.com suddenly all the errors go away.
Now I'd like to know the reason why one works and the other doesn't...
Related
I have my application working perfectly when I run it locally. However, once it was deployed to Heroku, the server stopped returning the data and returns a 500 code. All of my code can be found here and the live application (not functioning) is here.
EDIT:
Here are the heroku logs:
2021-03-06T04:00:59.416851+00:00 heroku[router]: at=info method=GET path="/" host=fast-shore-66611.herokuapp.com request_id=0a279e6e-c6d0-4bf8-ac4d-45d85c914e4a fwd="174.45.175.167"
dyno=web.1 connect=1ms service=50ms status=200 bytes=1401 protocol=https
2021-03-06T04:00:59.672729+00:00 heroku[router]: at=info method=GET path="/js/app.71b734f2.js" host=fast-shore-66611.herokuapp.com request_id=68509950-00e2-4f0d-84ea-3a96cf0dcbc1 fwd="174.45.175.167" dyno=web.1 connect=1ms service=21ms status=200 bytes=62457 protocol=https2021-03-06T04:01:00.023258+00:00 heroku[router]: at=info method=GET path="/css/app.badeae52.css" host=fast-shore-66611.herokuapp.com request_id=603ee68a-bc30-4c7e-8177-3e3c0f3fa712 fwd="174.45.175.167" dyno=web.1 connect=0ms service=22ms status=200 bytes=3523 protocol=https
2021-03-06T04:01:00.035863+00:00 heroku[router]: at=info method=GET path="/js/chunk-vendors.e9c4f783.js" host=fast-shore-66611.herokuapp.com request_id=8e857b3a-b40d-4ad8-a1aa-cb8dc6d3b15a fwd="174.45.175.167" dyno=web.1 connect=0ms service=39ms status=200 bytes=501256 protocol=https
2021-03-06T04:01:04.003747+00:00 heroku[router]: at=info method=GET path="/result/tyler" host=fast-shore-66611.herokuapp.com request_id=45020e4f-61d5-419d-9a51-f61ccb06b257 fwd="174.45.175.167" dyno=web.1 connect=0ms service=21ms status=500 bytes=284 protocol=https
2021-03-06T04:01:08.110920+00:00 heroku[router]: at=info method=GET path="/result/henderson" host=fast-shore-66611.herokuapp.com request_id=e9f739c3-36cb-4d3e-a480-e93d0784ea66 fwd="174.45.175.167" dyno=web.1 connect=0ms service=17ms status=500 bytes=284 protocol=https
2021-03-06T04:01:33.000000+00:00 app[api]: Build started by user reaganclayton1995#gmail.com
2021-03-06T04:01:38.112111+00:00 heroku[router]: at=info method=GET path="/result/tyler" host=fast-shore-66611.herokuapp.com request_id=f8a0dd9a-a033-430a-8249-6f433b6066a5 fwd="174.45.175.167" dyno=web.1 connect=0ms service=45ms status=500 bytes=284 protocol=https
2021-03-06T04:01:40.977816+00:00 heroku[router]: at=info method=GET path="/result/tyler" host=fast-shore-66611.herokuapp.com request_id=305a750b-8ca6-486c-9cee-a7b9b3e64891 fwd="174.45.175.167" dyno=web.1 connect=0ms service=9ms status=500 bytes=284 protocol=https
2021-03-06T04:01:46.859981+00:00 heroku[router]: at=info method=GET path="/" host=fast-shore-66611.herokuapp.com request_id=738c1e2e-ed83-4fef-86e3-52813667b798 fwd="174.45.175.167"
dyno=web.1 connect=0ms service=3ms status=304 bytes=269 protocol=https
2021-03-06T04:01:47.095156+00:00 heroku[router]: at=info method=GET path="/js/app.71b734f2.js" host=fast-shore-66611.herokuapp.com request_id=aa992042-2411-439d-b982-e180501f2e07 fwd="174.45.175.167" dyno=web.1 connect=1ms service=8ms status=304 bytes=270 protocol=https
2021-03-06T04:01:47.101684+00:00 heroku[router]: at=info method=GET path="/css/app.badeae52.css" host=fast-shore-66611.herokuapp.com request_id=aad26a97-869d-450b-9d14-b1deac43a470 fwd="174.45.175.167" dyno=web.1 connect=0ms service=30ms status=200 bytes=3523 protocol=https
2021-03-06T04:01:47.157018+00:00 heroku[router]: at=info method=GET path="/js/chunk-vendors.e9c4f783.js" host=fast-shore-66611.herokuapp.com request_id=4eb14331-e0c3-4127-b691-0f036cca30a4 fwd="174.45.175.167" dyno=web.1 connect=0ms service=59ms status=304 bytes=271 protocol=https
2021-03-06T04:02:07.327105+00:00 app[api]: Deploy 36a0a5b6 by user reaganclayton1995#gmail.com
2021-03-06T04:02:07.327105+00:00 app[api]: Release v10 created by user reaganclayton1995#gmail.com
2021-03-06T04:02:07.516033+00:00 heroku[web.1]: Restarting
2021-03-06T04:02:07.541614+00:00 heroku[web.1]: State changed from up to starting
2021-03-06T04:02:08.000000+00:00 app[api]: Build succeeded
2021-03-06T04:02:09.003004+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-03-06T04:02:09.247345+00:00 heroku[web.1]: Process exited with status 143
2021-03-06T04:02:09.633378+00:00 heroku[web.1]: Starting process with command `npm start`
2021-03-06T04:02:12.908565+00:00 app[web.1]:
2021-03-06T04:02:12.908594+00:00 app[web.1]: > weatherup#1.0.0 start
2021-03-06T04:02:12.908594+00:00 app[web.1]: > node server
2021-03-06T04:02:12.908595+00:00 app[web.1]:
2021-03-06T04:02:13.113839+00:00 app[web.1]: Server running in production mode on port 39626
2021-03-06T04:02:13.917299+00:00 heroku[web.1]: State changed from starting to up
2021-03-06T04:09:34.447563+00:00 heroku[router]: at=info method=GET path="/" host=fast-shore-66611.herokuapp.com request_id=b591ded0-7f1a-4c14-a1e2-7f856a2e45aa fwd="54.164.83.156" dyno=web.1 connect=1ms service=24ms status=200 bytes=1401 protocol=https
2021-03-06T04:10:06.594714+00:00 heroku[router]: at=info method=HEAD path="/" host=fast-shore-66611.herokuapp.com request_id=b063d8b0-d361-40a2-a0e8-85b2ac937292 fwd="217.182.175.162" dyno=web.1 connect=0ms service=2ms status=200 bytes=321 protocol=https
2021-03-06T04:11:00.259797+00:00 heroku[router]: at=info method=GET path="/result/tyler" host=fast-shore-66611.herokuapp.com request_id=216b9449-8ad7-4bf4-8780-99d3db9ea0c0 fwd="174.45.175.167" dyno=web.1 connect=1ms service=7ms status=500 bytes=284 protocol=https
2021-03-06T04:11:03.661150+00:00 heroku[router]: at=info method=GET path="/result/henderson" host=fast-shore-66611.herokuapp.com request_id=9b656dd6-dccc-4271-a507-2181e358193d fwd="174.45.175.167" dyno=web.1 connect=1ms service=3ms status=500 bytes=284 protocol=https
EDIT 2:
It turns out that I had my config.env added to my .gitignore, so my server didn't have access to my environment variables to make the API call. Now I am wondering if taking it out of the .gitignore is going to allow users to access the file, which is what I don't want.
Follows these steps which is given in image, That's a right way to deploy app on Heroku
I have recently tried to deploy my ecommerce store to Heroku.
The app is appearing however none of the information is displaying. I can't use the sign in function either I'm getting a status code 401.
Everything appears fine in the localhost.
Im using MongoDB Atlas to host the database.
I've posted the config var to heroku using the following command heroku config:set MONGODB_URL="mongodb+srv://yourUsername:yourPassword#yourClusterName.n9z04.mongodb.net/sample_mflix?retryWrites=true&w=majority" with the relevant information with the relevant information.
Is there a step that I am missing. Should I put the config var somewhere in my source code?
I've also attached the heroku log incase it has some relevant information in it.
2021-01-01T10:24:18.348137+00:00 app[web.1]: Server started at
http://localhost:5000
2021-01-01T10:24:18.896898+00:00 heroku[web.1]: State changed from starting
to up
2021-01-01T10:24:30.623315+00:00 heroku[router]: at=info method=GET path="/"
host=honeyman-designs.herokuapp.com request_id=7a2539dc-bb3e-4b8d-b77
5-4544b2977c8a fwd="79.97.31.121" dyno=web.1 connect=0ms service=30ms
status=200 bytes=2506 protocol=https
2021-01-01T10:24:30.791922+00:00 heroku[router]: at=info method=GET
path="/static/css/main.5ec8a089.chunk.css" host=honeyman-
designs.herokuapp.com
request_id=af0fde90-8dbb-4102-ad96-f5e05c44fced fwd="79.97.31.121" dyno=web.1
connect=0ms service=8ms status=200 bytes=6148 protocol=https
2021-01-01T10:24:30.796204+00:00 heroku[router]: at=info method=GET
path="/static/js/main.8623e411.chunk.js" host=honeyman-designs.herokuapp.com
r
equest_id=f4bc8514-2dde-479b-8934-8f59056ef1cd fwd="79.97.31.121" dyno=web.1
connect=1ms service=9ms status=200 bytes=43300 protocol=https
2021-01-01T10:24:30.918639+00:00 heroku[router]: at=info method=GET
path="/static/js/2.8114b5af.chunk.js" host=honeyman-designs.herokuapp.com
requ
est_id=bcc9933f-20a5-4f55-855d-6f3d5ed38886 fwd="79.97.31.121" dyno=web.1
connect=0ms service=13ms status=200 bytes=198152 protocol=https
2021-01-01T10:24:18.348137+00:00 app[web.1]: Server started at
http://localhost:5000
2021-01-01T10:24:18.896898+00:00 heroku[web.1]: State changed from starting
to up
2021-01-01T10:24:30.623315+00:00 heroku[router]: at=info method=GET path="/"
host=honeyman-designs.herokuapp.com request_id=7a2539dc-bb3e-4b8d-b77
5-4544b2977c8a fwd="79.97.31.121" dyno=web.1 connect=0ms service=30ms
status=200 bytes=2506 protocol=https
2021-01-01T10:24:30.791922+00:00 heroku[router]: at=info method=GET
path="/static/css/main.5ec8a089.chunk.css" host=honeyman-
designs.herokuapp.com
request_id=af0fde90-8dbb-4102-ad96-f5e05c44fced fwd="79.97.31.121" dyno=web.1
connect=0ms service=8ms status=200 bytes=6148 protocol=https
2021-01-01T10:24:30.796204+00:00 heroku[router]: at=info method=GET
path="/static/js/main.8623e411.chunk.js" host=honeyman-designs.herokuapp.com
r
equest_id=f4bc8514-2dde-479b-8934-8f59056ef1cd fwd="79.97.31.121" dyno=web.1
connect=1ms service=9ms status=200 bytes=43300 protocol=https
2021-01-01T10:24:30.918639+00:00 heroku[router]: at=info method=GET
path="/static/js/2.8114b5af.chunk.js" host=honeyman-designs.herokuapp.com
requ
est_id=bcc9933f-20a5-4f55-855d-6f3d5ed38886 fwd="79.97.31.121" dyno=web.1
connect=0ms service=13ms status=200 bytes=198152 protocol=https
I've used heroku ps:scale web=1 to check if any dyno's are working and they are I get this message: Scaling dynos... done, now running web at 1:Free
config.js
import dotenv from 'dotenv';
dotenv.config();
export default {
PORT: process.env.PORT || 5000,
MONGODB_URL: process.env.MONGODB_URL || 'mongodb://localhost/honeymandesigns',
}
.env file
MONGODB_URL=mongodb://localhost/honeymandesigns
server.js
const mongodbUrl = config.MONGODB_URL;
mongoose.connect(mongodbUrl, {
useNewUrlParser: true,
useUnifiedTopology: true,
useCreateIndex: true
}).catch(error => console.log(error.reason));
Just posting as I found the solution to my problem.
The MongoDb Atlas was connected however the data was not migrated to MongoDB atlas.
Once I migrated the data using MongoDB compass to MongoDB Atlas the data then displayed.
I followed along this youtube video to do this:
https://www.youtube.com/watch?v=tpz-6Trd1UI&t=12s
Yes,you should have an .env(https://ibb.co/j5kJznb), inside the .env file use
DB_CONNECT = mongodb+srv://username:password#cluster0.n0n6r.mongodb.net/test?retryWrites=true&w=majority
In your index.js require dotenv(https://ibb.co/C2gxk36)
const dotenv = require("dotenv");
dotenv.config();
Also,connect your database in heroku aswell https://dev.to/cpclark360/how-to-host-a-restful-node-js-server-with-mongodb-atlas-database-on-heroku-1opl
I did the http://learnforge.autodesk.io tutorial and locally the apps work fine. But when I try to deploy the forge.tutorial.viewhubmodels.nodejs app to Heroku I get the following error when I try to log in:
GET https://forgebcsample.herokuapp.com/api/forge/oauth/token 401 (Unauthorized)
The Config Vars are correct in the Heroku dashboard and I updated the values at the Forge Developer Portal as it is described in the tutorial under deployment. I even tried hardcoding the FORGE_CLIENT_ID, FORGE_CLIENT_SECRET and FORGE_CALLBACK_URL into the app but the error still persists.
Heroku Log:
2018-09-07T06:59:41.950470+00:00 heroku[router]: at=info method=GET path="/" host=forgebcsample.herokuapp.com request_id=6ef8e0d2-d814-478a-bbe2-e624789aceee fwd="202.148.226.254" dyno=web.1 connect=1ms service=2ms status=304 bytes=237 protocol=https
2018-09-07T06:59:42.215849+00:00 heroku[router]: at=info method=GET path="/js/ForgeTree.js" host=forgebcsample.herokuapp.com request_id=6d58c9c0-afce-4c44-b1e0-f9d40326c607 fwd="202.148.226.254" dyno=web.1 connect=1ms service=2ms status=304 bytes=238 protocol=https
2018-09-07T06:59:42.214891+00:00 heroku[router]: at=info method=GET path="/css/main.css" host=forgebcsample.herokuapp.com request_id=66be297d-0707-4e5d-8c6a-c4fb269c11f0 fwd="202.148.226.254" dyno=web.1 connect=1ms service=2ms status=304 bytes=237 protocol=https
2018-09-07T06:59:42.453624+00:00 heroku[router]: at=info method=GET path="/js/ForgeViewer.js" host=forgebcsample.herokuapp.com request_id=bc8f0050-1ca2-46b9-84be-d1e36c8afcf4 fwd="202.148.226.254" dyno=web.1 connect=1ms service=4ms status=304 bytes=237 protocol=https
2018-09-07T06:59:43.486820+00:00 heroku[router]: at=info method=GET path="/api/forge/oauth/token" host=forgebcsample.herokuapp.com request_id=d6acdca3-1424-48b9-9480-d0497af58179 fwd="202.148.226.254" dyno=web.1 connect=1ms service=2ms status=401 bytes=127 protocol=https
2018-09-07T07:00:51.391643+00:00 heroku[router]: at=info method=GET path="/api/forge/oauth/url" host=forgebcsample.herokuapp.com request_id=ab185f67-7288-43ce-bdf7-9551b8771bba fwd="202.148.226.254" dyno=web.1 connect=1ms service=2ms status=200 bytes=382 protocol=https
2018-09-07T07:00:58.551942+00:00 heroku[router]: at=info method=GET path="/api/forge/callback/oauth?code=46TAvefGUSv_xZ6cTJKzyx-t-HT6Y2FzvDyzZQIS" host=forgebcsample.herokuapp.com request_id=b67abc9f-419e-47d3-892a-3fcc6fbf7f7d fwd="202.148.226.254" dyno=web.1 connect=1ms service=227ms status=302 bytes=234 protocol=https
2018-09-07T07:00:58.808686+00:00 heroku[router]: at=info method=GET path="/" host=forgebcsample.herokuapp.com request_id=1a2ff1de-513e-40e2-a73a-0b48781a06bc fwd="202.148.226.254" dyno=web.1 connect=1ms service=17ms status=304 bytes=237 protocol=https
2018-09-07T07:00:59.082869+00:00 heroku[router]: at=info method=GET path="/css/main.css" host=forgebcsample.herokuapp.com request_id=428a5759-895f-45e5-a9db-48d8721889c0 fwd="202.148.226.254" dyno=web.1 connect=1ms service=5ms status=304 bytes=237 protocol=https
2018-09-07T07:00:59.325093+00:00 heroku[router]: at=info method=GET path="/js/ForgeTree.js" host=forgebcsample.herokuapp.com request_id=04a300dc-8697-4097-8c06-1788e21db69d fwd="202.148.226.254" dyno=web.1 connect=1ms service=3ms status=304 bytes=238 protocol=https
2018-09-07T07:00:59.822084+00:00 heroku[router]: at=info method=GET path="/js/ForgeViewer.js" host=forgebcsample.herokuapp.com request_id=c601f61e-cfea-4738-8837-540941adaf96 fwd="202.148.226.254" dyno=web.1 connect=1ms service=11ms status=304 bytes=237 protocol=https
2018-09-07T07:01:00.157419+00:00 heroku[router]: at=info method=GET path="/api/forge/oauth/token" host=forgebcsample.herokuapp.com request_id=77b86dc0-50c7-429e-ade9-82e1b8fa56db fwd="202.148.226.254" dyno=web.1 connect=1ms service=2ms status=401 bytes=127 protocol=https
The 401 is expected until you sign in, then it should return 200
I tried run your herokuapp, but could not sign in as the callback url is not properly set. Please make sure it uses the exact same value as on your Forge app.
EDIT
Can try comment the following line on start.js
secure: (process.env.NODE_ENV === 'production'),
I had created an empty application with Sails.js ver. 1.0.2. I used a 'Web App' option of 'sails new' command. It works fine, when started at localhost, both in development and production environments.
Next, I want to put this application into Heroku.
What I've done:
created new app in Heroku with "heroku create";
initialized new git repo in my application root;
created Procfile in my app root with text: "web: npm start"
changed production environment config (in \config\env\production.js):
Changed sockets.onlyAllowOrigins and custom.baseUrl values to "http://myappname.herokuapp.com"
Changed http.trustProxy value to "true"
set heroku remote for my repo with "heroku git:remote -a myappname"
added, committed and pushed my repo to Heroku with "git push heroku master"
It builds successfully with some warnings, but the worst thing is that app is not working. Each requests causes redirect loop with heroku[router] to the same address.
Here is a part of Heroku log:
2018-05-16T12:52:25.991036+00:00 app[web.1]: debug: -------------------------------------------------------
2018-05-16T12:52:25.991290+00:00 app[web.1]: debug: :: Wed May 16 2018 12:52:25 GMT+0000 (UTC)
2018-05-16T12:52:25.991366+00:00 app[web.1]: debug: Environment : production
2018-05-16T12:52:25.991441+00:00 app[web.1]: debug: Port : 37749
2018-05-16T12:52:25.991589+00:00 app[web.1]: debug: -------------------------------------------------------
2018-05-16T12:52:26.645022+00:00 heroku[web.1]: State changed from starting to up
2018-05-16T12:52:27.762757+00:00 heroku[router]: at=info method=GET path="/" host=myappname.herokuapp.com request_id=ee575a91-305f-4518-af9f-537ceccbc3cf fwd="83.45.25.57" dyno=web.1 connect=2ms service=48ms status=302 bytes=523 protocol=https
2018-05-16T12:52:28.039174+00:00 heroku[router]: at=info method=GET path="/" host=myappname.herokuapp.com request_id=980d6e72-b03c-4704-af97-56c7f9debc8b fwd="83.45.25.57" dyno=web.1 connect=0ms service=9ms status=302 bytes=360 protocol=http
2018-05-16T12:52:28.185571+00:00 heroku[router]: at=info method=GET path="/" host=myappname.herokuapp.com request_id=b46a235f-fbf7-4404-a4b7-0a95bb1a0254 fwd="83.45.25.57" dyno=web.1 connect=1ms service=5ms status=302 bytes=360 protocol=http
2018-05-16T12:52:28.339593+00:00 heroku[router]: at=info method=GET path="/" host=myappname.herokuapp.com request_id=03bbd460-3200-4158-a555-33c20262a212 fwd="83.45.25.57" dyno=web.1 connect=2ms service=7ms status=302 bytes=360 protocol=http
2018-05-16T12:52:28.484756+00:00 heroku[router]: at=info method=GET path="/" host=myappname.herokuapp.com request_id=af7303b1-f04c-431b-93b5-9e8b148a6721 fwd="83.45.25.57" dyno=web.1 connect=1ms service=4ms status=302 bytes=360 protocol=http
2018-05-16T12:52:28.637541+00:00 heroku[router]: at=info method=GET path="/" host=myappname.herokuapp.com request_id=1535454e-58b0-41d2-821d-317d7ebabeeb fwd="83.45.25.57" dyno=web.1 connect=4ms service=8ms status=302 bytes=360 protocol=http
2018-05-16T12:52:28.788965+00:00 heroku[router]: at=info method=GET path="/" host=myappname.herokuapp.com request_id=559d3426-78b9-4b65-8063-c44eb728d825 fwd="83.45.25.57" dyno=web.1 connect=1ms service=6ms status=302 bytes=360 protocol=http
2018-05-16T12:52:28.936187+00:00 heroku[router]: at=info method=GET path="/" host=myappname.herokuapp.com request_id=e4ad129d-746b-490c-9d0d-c77966b98d46 fwd="83.45.25.57" dyno=web.1 connect=1ms service=7ms status=302 bytes=360 protocol=http
2018-05-16T12:52:29.082496+00:00 heroku[router]: at=info method=GET path="/" host=myappname.herokuapp.com request_id=92a66cab-344e-410d-9ebf-8c8bddec80bd fwd="83.45.25.57" dyno=web.1 connect=2ms service=5ms status=302 bytes=360 protocol=http
2018-05-16T12:52:29.233773+00:00 heroku[router]: at=info method=GET path="/" host=myappname.herokuapp.com request_id=92f3734c-6e37-48d6-9849-807b53f1e1f7 fwd="83.45.25.57" dyno=web.1 connect=1ms service=5ms status=302 bytes=360 protocol=http
Tried to set custom.baseUrl as HTTP and HTTPS with no difference.
Where did things go wrong?
#marvin, you don't need to create a Procfile in heroku.
just when you deploy your app it will run automatically and set environment production.
//This is my server.js node file
var express=require('express')
var path=require('path')
var app=express()
var alfa=express.Router()
var port= (process.env.PORT || 5000)
app.use(express.static(__dirname+'/'))
alfa.get('/',function(req,res){
res.sendFile(path.join(__dirname+'index.html'))
});
alfa.get('/movies',function(req,res){
res.sendFile(path.join(__dirname+'movies.html'))
})
alfa.get('/shows',function(req,res){
res.sendFile(path.join(__dirname+'tvshows.html'))
})
app.use('/',alfa)
app.listen(port);
console.log('Go to the port : ' + port);
The index.html has a href to movies.html file.
Findout More...<span class="fa fa-chevron-circle-right">
After deploying to heroku cloud when running the application, the first page loads(without proper css;linked to an external css file, which is expected to be of a similar issue).
On click of the movies href link the error appears in the browser saying internal server error or page not found.
Later I checked the Heroku logs for the application and it says as below:
/app is appended before the href path movies.html
2016-01-30T00:27:06.417098+00:00 heroku[router]: at=info method=GET path="/scrol
l.js" host=alfapalakoti.herokuapp.com request_id=6b078679-71a4-436e-9b22-ab87de6
7c534 fwd="50.156.90.248" dyno=web.1 connect=1ms service=47ms status=200 bytes=6
70
2016-01-30T00:27:06.527645+00:00 heroku[router]: at=info method=GET path="/tv.pn
g" host=alfapalakoti.herokuapp.com request_id=05d76121-4af2-4d65-8425-ff4df7684a
6f fwd="50.156.90.248" dyno=web.1 connect=1ms service=14ms status=200 bytes=1499
9
2016-01-30T00:27:06.532690+00:00 heroku[router]: at=info method=GET path="/timer
.png" host=alfapalakoti.herokuapp.com request_id=5438c650-65e2-4f21-8c10-346f71c
60182 fwd="50.156.90.248" dyno=web.1 connect=1ms service=11ms status=200 bytes=2
5665
2016-01-30T00:27:06.540491+00:00 heroku[router]: at=info method=GET path="/shows
.jpg" host=alfapalakoti.herokuapp.com request_id=7afbf80b-071d-4ab1-9c18-cb36c71
f444b fwd="50.156.90.248" dyno=web.1 connect=1ms service=33ms status=200 bytes=3
69678
2016-01-30T00:27:06.625994+00:00 heroku[router]: at=info method=GET path="/carou
selbg.jpg" host=alfapalakoti.herokuapp.com request_id=2c371ea0-d47b-46e2-b9a1-51
28fbfaba4a fwd="50.156.90.248" dyno=web.1 connect=1ms service=112ms status=200 b
ytes=2069053
2016-01-30T00:27:06.781953+00:00 heroku[router]: at=info method=GET path="/mainb
g.jpg" host=alfapalakoti.herokuapp.com request_id=e43a6ac3-0b68-40f6-95ba-edc988
a57a91 fwd="50.156.90.248" dyno=web.1 connect=1ms service=6ms status=200 bytes=1
1178
2016-01-30T00:27:06.623717+00:00 heroku[router]: at=info method=GET path="/movie
s.jpg" host=alfapalakoti.herokuapp.com request_id=61d32aa0-0158-4962-8f8c-5f1a30
2e8654 fwd="50.156.90.248" dyno=web.1 connect=1ms service=259ms status=200 bytes
=4974518
2016-01-30T00:27:16.482080+00:00 heroku[router]: at=info method=GET path="/movie
s" host=alfapalakoti.herokuapp.com request_id=efc2a66c-6ec0-4e76-9afb-39384b8513
52 fwd="50.156.90.248" dyno=web.1 connect=1ms service=14ms status=404 bytes=208
2016-01-30T00:27:16.492630+00:00 app[web.1]: Error: ENOENT: no such file or dire
ctory, stat '**/appmovies.html'**
2016-01-30T00:27:16.492634+00:00 app[web.1]: at Error (native)
2016-01-30T01:00:47.163686+00:00 heroku[web.1]: State changed from up to down
2016-01-30T01:00:47.162812+00:00 heroku[web.1]: Idling
2016-01-30T01:00:54.049172+00:00 heroku[web.1]: Stopping all processes with SIGT
ERM
2016-01-30T01:00:57.704556+00:00 heroku[web.1]: Process exited with status 143
//can someone please help me with this?
//why is that being added? How to get rid of it?