Luke
Luke

Reputation: 73

Heroku error Web process failed to bind to $PORT within 60 seconds of launch

Trying to deploy my yoga server to heroku. Currently getting Web process failed to bind to $PORT within 60 seconds of launch. Saw earlier to use process.env.PORT and have included it but something is still going wrong.

my index.js

import { GraphQLServer, PubSub } from "graphql-yoga";
import Query from "./resolvers/Query";
import Mutation from "./resolvers/Mutation";
import prisma from "./prisma";

const pubsub = new PubSub();

const server = new GraphQLServer({
  typeDefs: "./src/schema.graphql",
  resolvers: {
    Query,
    Mutation
  },

  context(request) {
    return {
      pubsub,
      prisma,
      request
    };
  }
});



server.start(
  {
    port: process.env.PORT || 4000
  },

  () => {
    console.log(`Server is now running `);
  }
);

log

2019-10-12T22:14:29.407209+00:00 app[web.1]: > [email protected] start /app
2019-10-12T22:14:29.407211+00:00 app[web.1]: > nodemon -e js,graphql -x node src/index.js
2019-10-12T22:14:29.407213+00:00 app[web.1]:
2019-10-12T23:56:14.043378+00:00 heroku[web.1]: source=web.1 dyno=heroku.149428446.70e65f6a-6921-48b8-8b81-e79278c9b2a0 sample#memory_total=39.93MB sample#memory_rss=39.92MB sample#memory_cache=0.01MB sample#memory_swap=0.00MB sample#memory_pgpgin=13211pages sample#memory_pgpgout=2989pages sample#memory_quota=512.00MB
2019-10-12T23:56:36.178695+00:00 heroku[web.1]: source=web.1 dyno=heroku.149428446.70e65f6a-6921-48b8-8b81-e79278c9b2a0 sample#memory_total=39.93MB sample#memory_rss=39.92MB sample#memory_cache=0.01MB sample#memory_swap=0.00MB sample#memory_pgpgin=13211pages sample#memory_pgpgout=2989pages sample#memory_quota=512.00MB
2019-10-12T23:56:58.275696+00:00 heroku[web.1]: source=web.1 dyno=heroku.149428446.70e65f6a-6921-48b8-8b81-e79278c9b2a0 sample#load_avg_1m=0.00
2019-10-12T23:56:58.3031+00:00 heroku[web.1]: source=web.1 dyno=heroku.149428446.70e65f6a-6921-48b8-8b81-e79278c9b2a0 sample#memory_total=39.93MB sample#memory_rss=39.92MB sample#memory_cache=0.01MB sample#memory_swap=0.00MB sample#memory_pgpgin=13211pages sample#memory_pgpgout=2989pages sample#memory_quota=512.00MB
2019-10-12T23:57:01.207399+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2019-10-12T23:57:01.231953+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-10-12T23:57:01.324764+00:00 heroku[web.1]: Process exited with status 137
2019-10-12T23:57:01.373874+00:00 heroku[web.1]: State changed from starting to crashed
2019-10-12T23:57:03.564778+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=gpj-yoga-prod-1.herokuapp.com request_id=6deb0c4d-07f9-45a4-b8e0-63fb05cc95fd fwd="74.192.238.100" dyno= connect= service= status=503 bytes= protocol=https
2019-10-12T23:57:09.487835+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=gpj-yoga-prod-1.herokuapp.com request_id=d4f2a729-8a6f-470f-afd3-64dc472d775a fwd="74.192.238.100" dyno= connect= service= status=503 bytes= protocol=https

Upvotes: 0

Views: 685

Answers (1)

JRichardsz
JRichardsz

Reputation: 16495

When this appear in heroku log:

 sample#memory...

It is because your application needs more ram than heroku offers and it is close to exit.

This message

Web process failed to bind to $PORT

It does not indicate a fault related to the port, just tell you that your app was not starting due to previous errors.

Try to run your app in a heroku payed dyno or research why your app needs more than 512 mb of ram.

Upvotes: 1

Related Questions