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

MFE host cannot generate root ngrx state for app - broken #28970

Closed
1 of 4 tasks
nhhockeyplayer opened this issue Nov 16, 2024 · 3 comments · Fixed by #29068
Closed
1 of 4 tasks

MFE host cannot generate root ngrx state for app - broken #28970

nhhockeyplayer opened this issue Nov 16, 2024 · 3 comments · Fixed by #29068

Comments

@nhhockeyplayer
Copy link

nhhockeyplayer commented Nov 16, 2024

Current Behavior

SUBJECT: MFE host cannot generate root ngrx state for app - broken

causes error

 NX  Generating @nx/angular:ngrx-root-store
 NX   Cannot read properties of null (reading 'length')

Expected Behavior

should generate root ngrx state for MFE host app

GitHub Repo

https://github.com/nhhockeyplayer/meanstacknh

Steps to Reproduce

nx g @nx/angular:ngrx-root-store --project=host --minimal=false --name=root --addDevTools=true --facade=true --no-interactive --dry-run

Nx Report

nx report

 NX   Report complete - copy this into the issue template

Node           : 22.9.0
OS             : darwin-x64
Native Target  : x86_64-macos
npm            : 10.9.0

nx (global)        : 20.0.0
nx                 : 20.1.2
@nx/js             : 20.1.2
@nx/jest           : 20.1.2
@nx/eslint         : 20.1.2
@nx/workspace      : 20.1.2
@nx/angular        : 20.1.2
@nx/cypress        : 20.1.2
@nx/devkit         : 20.1.2
@nx/esbuild        : 20.1.2
@nx/eslint-plugin  : 20.1.2
@nx/express        : 20.1.2
@nx/nest           : 20.1.2
@nx/node           : 20.1.2
@nx/playwright     : 20.1.2
@nx/vite           : 20.1.2
@nx/web            : 20.1.2
@nx/webpack        : 20.1.2
nx-cloud           : 19.1.0
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/cypress/plugin
@nx/eslint/plugin
@nx/playwright/plugin
---------------------------------------
Community plugins:
@compodoc/compodoc               : 1.1.26
@fortawesome/angular-fontawesome : 0.15.0
@ionic/angular                   : 6.7.5
@jsverse/transloco               : 7.5.0
@ngrx/component                  : 18.0.2
@ngrx/component-store            : 18.0.2
@ngrx/effects                    : 18.0.2
@ngrx/entity                     : 18.0.2
@ngrx/operators                  : 18.0.2
@ngrx/router-store               : 18.0.2
@ngrx/schematics                 : 18.0.2
@ngrx/store                      : 18.0.2
@ngrx/store-devtools             : 18.0.2
apollo-angular                   : 7.2.1

Failure Logs

nx g @nx/angular:ngrx-root-store --project=host --minimal=false --name=root --addDevTools=true --facade=true --no-interactive --dry-run

 NX  Generating @nx/angular:ngrx-root-store


 NX   Cannot read properties of null (reading 'length')

TypeError: Cannot read properties of null (reading 'length')
    at createSourceFile2 (/Users/meanstack02/meanstacknh/node_modules/typescript/lib/typescript.js:32816:52)
    at parseSourceFileWorker (/Users/meanstack02/meanstacknh/node_modules/typescript/lib/typescript.js:32690:24)
    at Object.parseSourceFile (/Users/meanstack02/meanstacknh/node_modules/typescript/lib/typescript.js:32514:20)
    at Object.createSourceFile (/Users/meanstack02/meanstacknh/node_modules/typescript/lib/typescript.js:32348:21)
    at addImportsToModule (/Users/meanstack02/meanstacknh/node_modules/@nx/angular/src/generators/ngrx-root-store/lib/add-imports.js:65:31)
    at ngrxRootStoreGenerator (/Users/meanstack02/meanstacknh/node_modules/@nx/angular/src/generators/ngrx-root-store/ngrx-root-store.js:12:38)
    at /Users/meanstack02/meanstacknh/node_modules/nx/src/command-line/generate/generate.js:240:32
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async handleErrors (/Users/meanstack02/meanstacknh/node_modules/nx/src/utils/handle-errors.js:8:24)
    at async Object.handler (/Users/meanstack02/meanstacknh/node_modules/nx/src/command-line/generate/command-object.js:13:22)

Package Manager Version

npm --version 10.9.0

Operating System

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

Additional Information

this is a show stopper I cannot get NgRX on the map for my hosts/apps

@nhhockeyplayer
Copy link
Author

nhhockeyplayer commented Nov 16, 2024

Hi
If this can be prioritized, that would be appropriate theres no way at all now to get NgRX on the map

the nx-console UI is failing with this error in the webstorm terminal
the mac terminal shows the failure too when executing the command manually

The other main issue we rely on its the ngrx-store-freeze, ngrx-store-logger & store-devtools debug logging it was simple prior to new Actions design but now with the react javascript type changes its mysterious when rigging up NgRX, so far its nutz'o to try and get the devtools logger setup to see complete route serializer and routes unfolding at runtime in the chrome console. This needs to be simplified and redone because I been using NgRX ever since its inception and NOW every time I try to get that devtools logger setup now its like pulling teeth takes days or not at all and thats not a good sign of good craftsman work it should be simple automated and even manually. Currently it remains a mystery and unable to setup. If someone can code review that and simplify it we really need that feature for debugging in the field. Currently I think its some secret flag somewhere that needs to be set but I have yet to get that darned devtools logging going for years now.

thanks for an awesome product

@nhhockeyplayer
Copy link
Author

does anyone have a workaround for this issue?
How can I generate a rootState for my MFR host?
Thanks for any assist

FrozenPandaz pushed a commit that referenced this issue Nov 28, 2024
<!-- 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` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
When we run the ngrx-root-store generator on a MFe host app it assumes
`app.module.ts` is created.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
We should check if `app.module.ts` exists first, then fall back if not.

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

Fixes #28970

(cherry picked from commit beded4e)
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant