@darmie commented on Wed Apr 25 2018
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.
Any news ? This bug can be annoying especially for testing.
I don't have any problem with yoga 1.8.5, strange :o .
@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
Awesome ! Thanks for the trick.
Seems like this is solved now. Thanks @KATT for explaining!
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
Most helpful comment
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