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

Creating a reactive microservices architecture doesn't work #16173

Closed
mraible opened this issue Sep 5, 2021 · 3 comments
Closed

Creating a reactive microservices architecture doesn't work #16173

mraible opened this issue Sep 5, 2021 · 3 comments

Comments

@mraible
Copy link
Contributor

mraible commented Sep 5, 2021

Overview of the issue

Install the latest release and create a reactive microservices project:

npm install -g generator-jhipster
take reactive-stack
jhipster jdl reactive-ms

Then, build the Gateway's Docker container:

cd gateway
./gradlew bootJar -Pprod jibDockerBuild

It will fail:

> Task :npm_install

up to date, audited 3327 packages in 7s

184 packages are looking for funding
  run `npm fund` for details

12 moderate severity vulnerabilities

To address issues that do not require attention, run:
  npm audit fix

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.

> Task :webapp

> [email protected] webapp:prod
> npm run clean-www && npm run webapp:build:prod


> [email protected] clean-www
> rimraf build/resources/main/static/app/{src,build/}


> [email protected] webapp:build:prod
> npm run webpack -- --config webpack/webpack.prod.js --progress=profile --env stats=minimal


> [email protected] webpack
> node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js "--config" "webpack/webpack.prod.js" "--progress=profile" "--env" "stats=minimal"

[webpack-cli] Failed to load '/Users/mraible/Downloads/anothertest/gateway/webpack/webpack.prod.js' config
[webpack-cli] Error: Cannot find module 'workbox-build/build/options/schema/webpack-generate-sw'
Require stack:
- /Users/mraible/Downloads/anothertest/gateway/node_modules/workbox-webpack-plugin/build/generate-sw.js
- /Users/mraible/Downloads/anothertest/gateway/node_modules/workbox-webpack-plugin/build/index.js
- /Users/mraible/Downloads/anothertest/gateway/webpack/webpack.prod.js
- /Users/mraible/Downloads/anothertest/gateway/node_modules/webpack-cli/lib/webpack-cli.js
- /Users/mraible/Downloads/anothertest/gateway/node_modules/webpack-cli/lib/bootstrap.js
- /Users/mraible/Downloads/anothertest/gateway/node_modules/webpack-cli/bin/cli.js
- /Users/mraible/Downloads/anothertest/gateway/node_modules/webpack/bin/webpack.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (/Users/mraible/Downloads/anothertest/gateway/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/Users/mraible/Downloads/anothertest/gateway/node_modules/workbox-webpack-plugin/build/generate-sw.js:20:33)
    at Module._compile (/Users/mraible/Downloads/anothertest/gateway/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:14)
    at Module.require (internal/modules/cjs/loader.js:974:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/mraible/Downloads/anothertest/gateway/node_modules/workbox-webpack-plugin/build/generate-sw.js',
    '/Users/mraible/Downloads/anothertest/gateway/node_modules/workbox-webpack-plugin/build/index.js',
    '/Users/mraible/Downloads/anothertest/gateway/webpack/webpack.prod.js',
    '/Users/mraible/Downloads/anothertest/gateway/node_modules/webpack-cli/lib/webpack-cli.js',
    '/Users/mraible/Downloads/anothertest/gateway/node_modules/webpack-cli/lib/bootstrap.js',
    '/Users/mraible/Downloads/anothertest/gateway/node_modules/webpack-cli/bin/cli.js',
    '/Users/mraible/Downloads/anothertest/gateway/node_modules/webpack/bin/webpack.js'
  ]
}

> Task :webapp FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':webapp'.
> Process 'command '/Users/mraible/Downloads/anothertest/gateway/.gradle/npm/npm-v7.18.1/bin/npm'' finished with non-zero exit value 2

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 10s

Node: v14.17.0
npm: 7.21.0

I tried with npm 6 and the same error happens.

Motivation for or Use Case

It worked with 7.0.1 in this blog post. For some reason, it doesn't work with 7.1.0 or 7.0.1 now. I'm not sure why.

It'd be nice if I could use the latest release for my demo on Tuesday (Sept 7), but it doesn't look good. I can probably use the main branch if #16172 is fixed.

Reproduce the error

See the steps above.

JHipster Version(s)

7.1.0

JHipster configuration

https://github.com/jhipster/jdl-samples/blob/main/reactive-ms.jdl

@mraible
Copy link
Contributor Author

mraible commented Sep 5, 2021

If I use 7.0.1 and npm 6, it fails too. I don't think it's something on my local system, but it sure seems like it could be.

@mraible
Copy link
Contributor Author

mraible commented Sep 5, 2021

Seems to be related to GoogleChrome/workbox#2904.

Changing workbox to:

"workbox-webpack-plugin": "6.2.4"

Almost fixes it. Now there's another issue:

ERROR in src/main/webapp/app/shared/data/data-utils.service.ts:29:46
TS2339: Property 'msSaveOrOpenBlob' does not exist on type 'Navigator'.
    27 |    */
    28 |   openFile(contentType, data) {
  > 29 |     if (window.navigator && window.navigator.msSaveOrOpenBlob) {
       |                                              ^^^^^^^^^^^^^^^^
    30 |       // To support IE and Edge
    31 |       const byteCharacters = atob(data);
    32 |       const byteNumbers = new Array(byteCharacters.length);

ERROR in src/main/webapp/app/shared/data/data-utils.service.ts:40:24
TS2339: Property 'msSaveOrOpenBlob' does not exist on type 'Navigator'.
    38 |         type: contentType,
    39 |       });
  > 40 |       window.navigator.msSaveOrOpenBlob(blob);
       |                        ^^^^^^^^^^^^^^^^
    41 |     } else {
    42 |       // Other browsers
    43 |       const fileURL = `data:${contentType};base64,${data}`;

1 ERROR in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
webpack 5.52.0 compiled with 4 errors and 1 warning in 18233 ms

> Task :webapp FAILED

@mraible
Copy link
Contributor Author

mraible commented Sep 5, 2021

Closing because it's a duplicate of #15884.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants