question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't change default port for server

See original GitHub issue

@darmie commented on Wed Apr 25 2018

Bug Report

Current behavior Prisma app server not running on set port Reproduction Simply change NODE_PORT value in .env file Expected behavior? Server should run on set port


@marktani commented on Thu Apr 26 2018

Hey @darmie, thanks for bringing this up.

With “Prisma app server”, do you refer to graphql-yoga? Can you show a code snippet that show cases the wrong behaviour?


@darmie commented on Thu Apr 26 2018

@marktani yes the issue is with graphql-yoga

port is set in .env

...
NODE_PORT= 4000
...

And the index.ts code is the default

const server = new GraphQLServer({
  typeDefs: './src/schema.graphql',
  resolvers,
  context: req => ({
    ...req,
    db: new Prisma({
      endpoint: process.env.PRISMA_ENDPOINT, // the endpoint of the Prisma DB service (value is set in .env)
      secret: process.env.PRISMA_SECRET, // taken from database/prisma.yml (value is set in .env)
      debug: true, // log all GraphQL queries & mutations
    }),
  }),
})

server.start({port: process.env.NODE_PORT})
console.log("Prisma app is now running on http://localhost"+process.env.NODE_PORT)

if I change the value of NODE_PORT, Playground will launch but server is not working.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
JensMadsencommented, Oct 31, 2018

still problem emerged for me today. yoga version 1.16.7. setting port to whatever value but only runs on port 4000.

EDIT: I passed port to the constructor and not the start method. Perhaps throwing an error or a warning when unknown args are passed to constructor

1reaction
KATTcommented, Apr 30, 2018

@kMeillet for testing, use port: 0! 😃

It gives you a random available port, allows you to parallelise your tests too - example in src/index.test.ts

Read more comments on GitHub >

github_iconTop Results From Across the Web

Windows server 2019 / Remote Desktop Gateway
Here you will have the opportunity to change the gateway port. Look for "HttpsPort" double click, and select Decimal and change port to...
Read more >
Minecraft works on default port, but won't work at all when I ...
I am trying to set up a few minecraft servers to play on with my friends, and my plan is to use different...
Read more >
Changing the default apache port doesn't work - Server Fault
I want that apache should listen to port 8080 and nginx should listen to 80. For that, I have modified the ports. conf...
Read more >
Can't change the default port. - Linux - Emby Community
Hello,I'm trying to change the default port of emby server (3.5.2.0) on ... i save and restart the server, emby is still on...
Read more >
Can't change default port? · Issue #6 · itzg/docker-minecraft ...
Since Docker containers allow port mapping to arbitrary external ports, I purposely left out the server-port configuration option.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found