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.

Debug restart fails intermittently with Gatsby

See original GitHub issue

Describe the bug Sometimes I “Debug: Restart” and Gatsby restarts, but other times it complains Gatsby is already running and dies. It’s intermittent and I haven’t identified the pattern.

To Reproduce launch.json config:

    {
      "name": "Gatsby Develop",
      "type": "node",
      "request": "launch",
      "protocol": "inspector",
      "cwd": "${workspaceFolder}/packages/web",
      "program": "${workspaceFolder}/packages/web/node_modules/.bin/gatsby",
      "autoAttachChildProcesses": true,
      "args": ["develop", "--inspect-brk"],
      "stopOnEntry": false,
      "runtimeArgs": ["--nolazy"],
      "sourceMaps": false
    },

Steps:

  1. Start Gatsby
  2. Restart Gatsby occasionally, until failure

Log File

Killed
node@b068659a24b1:/workspace/packages/web$  cd /workspace/packages/web ; env 'NODE_OPTIONS=--require "/home/node/.vscode-server/bin/17299e413d5590b14ab0340ea477cdd86ff13daf/extensions/ms-vscode.js-debug/src/bootloader.bundle.js" ' 'VSCODE_INSPECTOR_OPTIONS={"inspectorIpc":"/tmp/node-cdp.129-78.sock","deferredMode":false,"waitForDebugger":"","execPath":"/usr/local/bin/node","onlyEntrypoint":false,"fileCallback":"/tmp/node-debug-callback-610ebce78231d810"}' /usr/local/bin/node --nolazy ./node_modules/.bin/gatsby develop --inspect-brk 
Debugger listening on ws://127.0.0.1:33469/f543f57a-583b-42c1-b6a5-ad50524899cd
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.

 ERROR 

Looks like develop for this site is already running. Try visiting http://localhost:8000/ maybe?

Debugger listening on ws://127.0.0.1:33469/f543f57a-583b-42c1-b6a5-ad50524899cd
For help, see: https://nodejs.org/en/docs/inspector

VS Code Version: 1.47.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
connor4312commented, Sep 4, 2020

Ahh, okay, interesting. I would have assumed they started up and threw that error when trying an in-use port. Oh well, this led to better code for our debugger, so I’ll call it a win 😄

0reactions
aaronadamsCAcommented, Sep 4, 2020

@connor4312 Add this issue to the list of things that turned out to be Gatsby bugs!

https://github.com/gatsbyjs/gatsby/issues/26214

That said, even when this does happen it now seems to recover a lot quicker; I can debug again within a few seconds, where I don’t believe I could previously.

Thank you for this, and for your assistance in the other thread! I am up and running with the new debugger and it’s working great.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Common Errors - Gatsby
If you see errors about not being able to find a resource in the cache it may be enough to clear your cache...
Read more >
Gatsby develop command runs but gatsby build gives error
A simple fix is to rename pages folder to templates (and also change it in the paths in gatsby-node).
Read more >
An easy fix for gatsby caching issues. - Front-End Stumbles
Gatsby is a static site generator that uses React. ... running this command and restarting the server before you start any proper debugging....
Read more >
Gatsby Changelog | 5.3.0
You might have run into an error like this while using Gatsby: ... mechanism for gatsby-node/config.ts compilation to fix intermittent bug during gatsby...
Read more >
Debug "sometimes" fails to restart Application on iOS Simulator
Attached a log while having the issue at 12:46, restarted debug a short while after (ctrl-D again) to restart app. Issue might have...
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