Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nx console plugin for Webstorm not considering NX_DAEMON_SOCKET_DIR #2114

Closed
1 of 4 tasks
MarcusElevait opened this issue Apr 25, 2024 · 4 comments · Fixed by nrwl/nx#23348
Closed
1 of 4 tasks

Nx console plugin for Webstorm not considering NX_DAEMON_SOCKET_DIR #2114

MarcusElevait opened this issue Apr 25, 2024 · 4 comments · Fixed by nrwl/nx#23348
Assignees
Labels
type: bug Something isn't working

Comments

@MarcusElevait
Copy link

Current Behavior

I've set the NX_DAEMON_SOCKET_DIR env variable and i started the nx daemon with nx daemon --start.
Following things are happening:

  • socket file is created, but directly deleted again
  • those logs are showing of:
    [NX Daemon Server] - 2024-04-25T08:20:46.858Z - Started listening on: /home/marcus/Projects/aicosy/.nx/d.sock [NX Daemon Server] - 2024-04-25T08:20:46.861Z - [WATCHER]: Subscribed to changes within: /home/marcus/Projects/aicosy (native) [NX Daemon Server] - 2024-04-25T08:20:46.863Z - Established a connection. Number of open connections: 1 [NX Daemon Server] - 2024-04-25T08:20:46.865Z - Closed a connection. Number of open connections: 0 [NX Daemon Server] - 2024-04-25T08:20:46.908Z - [WATCHER]: .nx/cache/d/server-process.json was modified [NX Daemon Server] - 2024-04-25T08:20:46.913Z - [REQUEST]: Responding to the client. File watch changed [NX Daemon Server] - 2024-04-25T08:20:46.914Z - Done responding to the client File watch changed [NX Daemon Server] - 2024-04-25T08:20:46.914Z - Handled FILE-WATCH-CHANGED. Handling time: 0. Response time: 1. [NX Daemon Server] - 2024-04-25T08:20:46.914Z - Time taken for 'changed-projects' 3.9091689999986556ms [NX Daemon Server] - 2024-04-25T08:20:46.914Z - [WATCHER]: Stopping the watcher for /home/marcus/Projects/aicosy (sources) [NX Daemon Server] - 2024-04-25T08:20:46.914Z - [WATCHER]: Stopping the watcher for /home/marcus/Projects/aicosy (outputs) [NX Daemon Server] - 2024-04-25T08:20:46.914Z - Server stopped because: "this process is no longer the current daemon (native)" [NX Daemon Server] - 2024-04-25T08:20:48.059Z - Started listening on: /tmp/c3fb6aaef5aa7fc7fef2/d.sock
  • running nx daemon gives the output: Nx Daemon is not running.

When disabling the nx console plugin in webstorm, everything works fine. Here is the output of the daemon log after disabling the plugin and restarting the daemon:
[NX Daemon Server] - 2024-04-25T09:18:16.541Z - Started listening on: /home/marcus/Projects/aicosy/.nx/d.sock [NX Daemon Server] - 2024-04-25T09:18:16.554Z - [WATCHER]: Subscribed to changes within: /home/marcus/Projects/aicosy (native) [NX Daemon Server] - 2024-04-25T09:18:16.557Z - Established a connection. Number of open connections: 1 [NX Daemon Server] - 2024-04-25T09:18:16.564Z - Closed a connection. Number of open connections: 0 [NX Daemon Server] - 2024-04-25T09:18:41.303Z - Established a connection. Number of open connections: 1 [NX Daemon Server] - 2024-04-25T09:18:41.312Z - Closed a connection. Number of open connections: 0 [NX Daemon Server] - 2024-04-25T09:18:41.313Z - Established a connection. Number of open connections: 1 [NX Daemon Server] - 2024-04-25T09:18:41.317Z - [REQUEST]: Client Request for Project Graph Received [NX Daemon Server] - 2024-04-25T09:18:41.323Z - [REQUEST]: Updated workspace context based on watched changes, recomputing project graph... [NX Daemon Server] - 2024-04-25T09:18:41.324Z - [REQUEST]: [NX Daemon Server] - 2024-04-25T09:18:41.324Z - [REQUEST]: [NX Daemon Server] - 2024-04-25T09:18:41.757Z - [REQUEST]: Responding to the client. project-graph [NX Daemon Server] - 2024-04-25T09:18:41.761Z - Time taken for 'total for creating and serializing project graph' 439.9179899999981ms [NX Daemon Server] - 2024-04-25T09:18:41.783Z - Done responding to the client project-graph [NX Daemon Server] - 2024-04-25T09:18:41.784Z - Handled REQUEST_PROJECT_GRAPH. Handling time: 440. Response time: 27. [NX Daemon Server] - 2024-04-25T09:18:41.886Z - [REQUEST]: Responding to the client. handleHashTasks [NX Daemon Server] - 2024-04-25T09:18:41.888Z - Done responding to the client handleHashTasks [NX Daemon Server] - 2024-04-25T09:18:41.888Z - Handled HASH_TASKS. Handling time: 58. Response time: 2. [NX Daemon Server] - 2024-04-25T09:18:42.344Z - Established a connection. Number of open connections: 2 [NX Daemon Server] - 2024-04-25T09:18:42.345Z - Closed a connection. Number of open connections: 1 [NX Daemon Server] - 2024-04-25T09:18:42.346Z - Established a connection. Number of open connections: 2 [NX Daemon Server] - 2024-04-25T09:18:42.349Z - [REQUEST]: Client Request for Project Graph Received [NX Daemon Server] - 2024-04-25T09:18:42.349Z - [REQUEST]: Responding to the client. project-graph [NX Daemon Server] - 2024-04-25T09:18:42.352Z - Time taken for 'total for creating and serializing project graph' 0.19312899999931687ms [NX Daemon Server] - 2024-04-25T09:18:42.356Z - Done responding to the client project-graph [NX Daemon Server] - 2024-04-25T09:18:42.356Z - Handled REQUEST_PROJECT_GRAPH. Handling time: 0. Response time: 7. [NX Daemon Server] - 2024-04-25T09:19:28.389Z - [WATCHER]: Processing file changes in outputs

Expected Behavior

I'd expect that this does not happen :-D

GitHub Repo

No response

Steps to Reproduce

Nx Report

NX   Report complete - copy this into the issue template

Node   : 20.11.0
OS     : linux-x64
npm    : 10.2.4

nx (global)        : 18.0.8
nx                 : 18.2.1
@nx/js             : 18.2.1
@nx/jest           : 18.2.1
@nx/linter         : 18.2.1
@nx/eslint         : 18.2.1
@nx/workspace      : 18.2.1
@nx/angular        : 18.2.1
@nx/cypress        : 18.2.1
@nx/devkit         : 18.2.1
@nx/esbuild        : 18.2.1
@nx/eslint-plugin  : 18.2.1
@nx/nest           : 18.2.1
@nx/node           : 18.2.1
@nx/playwright     : 18.2.1
@nx/plugin         : 18.2.1
@nx/storybook      : 18.2.1
@nrwl/tao          : 18.2.1
@nx/web            : 18.2.1
@nx/webpack        : 18.2.1
typescript         : 5.4.3
---------------------------------------
Community plugins:
@datorama/akita       : 2.2.4
@ngrx/component-store : 17.0.1
@ngrx/effects         : 17.0.1
@ngrx/entity          : 17.0.1
@ngrx/router-store    : 17.0.1
@ngrx/schematics      : 17.0.1
@ngrx/store           : 17.0.1
@ngrx/store-devtools  : 17.0.1
@rx-angular/cdk       : 16.0.0
@rx-angular/template  : 16.1.2
@storybook/angular    : 7.6.17
ng-mocks              : 14.12.2
---------------------------------------
Local workspace plugins:
         @aicosy/nx-tools

Failure Logs

No response

Package Manager Version

npm

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@MarcusElevait MarcusElevait added the type: bug Something isn't working label Apr 25, 2024
@AgentEnder AgentEnder transferred this issue from nrwl/nx Apr 29, 2024
@MaxKless
Copy link
Collaborator

Hey @MarcusElevait thanks for the report.
Are you setting the NX_DAEMON_SOCKET_DIR directly in the terminal?
If yes, there's no way for Nx Console to know what this inline env variable is set to. You should use a root .env file to set the env variable in a way that Nx Console can pick up as well. https://nx.dev/recipes/tips-n-tricks/define-environment-variables

Can you confirm that this issue persists even if you define it in this way?

@MaxKless MaxKless added the blocked: more info needed more info needed label May 10, 2024
@MaxKless MaxKless self-assigned this May 10, 2024
@MarcusElevait
Copy link
Author

Yes the issue still persists. And it was again pretty clear, that as soon as i deactivate the nx console plugin the issue is not there anymore.
Here is again the beginning of the daemon.log file:
[NX Daemon Server] - 2024-05-13T12:11:09.750Z - Started listening on: /home/marcus/Projects/aicosy/.nx/d.sock [NX Daemon Server] - 2024-05-13T12:11:09.753Z - [WATCHER]: Subscribed to changes within: /home/marcus/Projects/aicosy (native) [NX Daemon Server] - 2024-05-13T12:11:09.758Z - Established a connection. Number of open connections: 1 [NX Daemon Server] - 2024-05-13T12:11:09.760Z - Closed a connection. Number of open connections: 0 [NX Daemon Server] - 2024-05-13T12:11:19.609Z - [WATCHER]: package-lock.json was modified [NX Daemon Server] - 2024-05-13T12:11:19.609Z - [WATCHER]: Processing file changes in outputs [NX Daemon Server] - 2024-05-13T12:11:19.745Z - [REQUEST]: Updated workspace context based on watched changes, recomputing project graph... [NX Daemon Server] - 2024-05-13T12:11:19.745Z - [REQUEST]: package-lock.json [NX Daemon Server] - 2024-05-13T12:11:19.745Z - [REQUEST]: [NX Daemon Server] - 2024-05-13T12:11:20.324Z - Time taken for 'Load Nx Plugin: /home/marcus/Projects/aicosy/node_modules/nx/src/plugins/project-json/build-nodes/package-json-next-to-project-json' 28.765384000000267ms [NX Daemon Server] - 2024-05-13T12:11:20.694Z - Started listening on: /tmp/c3fb6aaef5aa7fc7fef2/d.sock

And i haven't done much. I've just run nx daemon --stop and then nx daemon --start and run npm i and that's it.

@MaxKless
Copy link
Collaborator

Thanks for confirming @MarcusElevait!
I was able to repro this and have a PR open to fix it in the nx repo. It requires some changes to environment variable loading so I sadly can't fix it from the console side. You'll have to migrate to the latest Nx version once it's merged & released.
Keep your eyes on this issue if you want to track its progress
nrwl/nx#23348

@MarcusElevait
Copy link
Author

Thank you very much :-)

@MaxKless MaxKless removed the blocked: more info needed more info needed label May 14, 2024
FrozenPandaz pushed a commit to nrwl/nx that referenced this issue May 14, 2024
…tup (#23348)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
The daemon doesn't correctly read the `NX_DAEMON_SOCKET_DIR` env
variable if it's set in `.env`.
Also, the `.env` files aren't loaded if the daemon client is imported &
used directly (like it is in Nx Console).


## Expected Behavior
The daemon should correctly read the `NX_DAEMON_SOCKET_DIR` variable
regardless of where it's specified and setting it shouldn't cause any
issues with Nx Console.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes nrwl/nx-console#2114
FrozenPandaz pushed a commit to nrwl/nx that referenced this issue May 14, 2024
…tup (#23348)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
The daemon doesn't correctly read the `NX_DAEMON_SOCKET_DIR` env
variable if it's set in `.env`.
Also, the `.env` files aren't loaded if the daemon client is imported &
used directly (like it is in Nx Console).

## Expected Behavior
The daemon should correctly read the `NX_DAEMON_SOCKET_DIR` variable
regardless of where it's specified and setting it shouldn't cause any
issues with Nx Console.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes nrwl/nx-console#2114

(cherry picked from commit 6c36bef)
Coly010 pushed a commit to nrwl/nx that referenced this issue May 15, 2024
…tup (#23348)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
The daemon doesn't correctly read the `NX_DAEMON_SOCKET_DIR` env
variable if it's set in `.env`.
Also, the `.env` files aren't loaded if the daemon client is imported &
used directly (like it is in Nx Console).


## Expected Behavior
The daemon should correctly read the `NX_DAEMON_SOCKET_DIR` variable
regardless of where it's specified and setting it shouldn't cause any
issues with Nx Console.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes nrwl/nx-console#2114
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants