graphile / starter

Opinionated SaaS quick-start with pre-built user account and organization system for full-stack application development in React, Node.js, GraphQL and PostgreSQL. Powered by PostGraphile, TypeScript, Apollo Client, Graphile Worker, Graphile Migrate, GraphQL Code Generator, Ant Design and Next.js
https://graphile-starter.herokuapp.com
Other
1.74k stars 219 forks source link

Starting inspector on *:9757 failed: address already in use #245

Closed makoncline closed 3 years ago

makoncline commented 3 years ago

Summary

I'm upgrading the starter and keep getting the error Starting inspector on *:9757 failed: address already in use running yarn worker dev after pulling in https://github.com/graphile/starter/pull/238

Steps to reproduce

have a previous working version of starter pull in commit https://github.com/graphile/starter/pull/238 try to run worker in dev mode error

Expected results

Worker starts running in dev mode

Actual results

$ yarn workspace @app/worker dev
$ cross-env NODE_OPTIONS="$NODE_OPTIONS --inspect=9757" yarn gw --watch
Debugger listening on ws://127.0.0.1:9757/970fc70d-aeb4-4403-970d-6ccc9ca59af9
For help, see: https://nodejs.org/en/docs/inspector
$ cd dist && cross-env NODE_OPTIONS="$NODE_OPTIONS -r @app/config/env" graphile-worker --watch
Starting inspector on 127.0.0.1:9757 failed: address already in use

Additional context

mac 10.14.6 node v12.17.0 all package versions same as starter up to the pr in question

Possible Solution

The node options may be influencing the process that spawns the worker.

rriski commented 3 years ago

I was running into this also. I resolved it by killing VS Code through Activity Monitor and my tmux server with tmux kill-server.

zacherkkila commented 3 years ago

I get this same bug trying to use anything from this commit on e6ff48b1a0cd0eb11c406ec907954be370fa0f96, let me know if there is any more info you need to help debug it

benjie commented 3 years ago

It's specifically this change causing it, I think:

-    "dev": "cd dist && cross-env NODE_OPTIONS=\"$NODE_OPTIONS -r @app/config/env --inspect=9757\" graphile-worker --watch",
+    "dev": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --inspect=9757\" yarn gw --watch",

Previously it only passed the NODE_OPTIONS to graphile-worker directly; whereas no because it does yarn gw it actually executes yarn which then executes graphile-worker; both yarn and graphile-worker are receiving these NODE_OPTIONS and both are attempting to use --inspect=9757.