Skip to content

[BUG] Fails to download jars #680

Closed
Closed
@ventsyv

Description

@ventsyv

⚠️ Important Notice

Please differentiate the bug


🐛 Bug Report:

Describe the bug

When we run the generator for the first time expecting to get resolved from the PATH (openapi-generator-cli version) it hangs and after a while gives the following error:

node_modules/@openapitools/openapi-generator-cli/main.js:1045
            error.response.data.on('data', data => this.logger.log(data.toString('utf8')));
                                ^
TypeError: error.response.data.on is not a function
    at VersionManagerService.printResponseError (/GMSS/node_modules/@openapitools/openapi-generator-cli/main.js:1045:33)
    at /GMSS/node_modules/@openapitools/openapi-generator-cli/main.js:924:18
    at /GMSS/node_modules/rxjs/dist/cjs/internal/operators/catchError.js:13:51
    at OperatorSubscriber._this._error (/GMSS/node_modules/rxjs/dist/cjs/internal/operators/OperatorSubscriber.js:43:21)
    at Subscriber.error (/GMSS/node_modules/rxjs/dist/cjs/internal/Subscriber.js:60:18)
    at Subscriber._error (/GMSS/node_modules/rxjs/dist/cjs/internal/Subscriber.js:84:30)
    at Subscriber.error (/GMSS/node_modules/rxjs/dist/cjs/internal/Subscriber.js:60:18)
    at Subscriber._error (/GMSS/node_modules/rxjs/dist/cjs/internal/Subscriber.js:84:30)
    at Subscriber.error (/GMSS/node_modules/rxjs/dist/cjs/internal/Subscriber.js:60:18)
    at Subscriber._error (/GMSS/node_modules/rxjs/dist/cjs/internal/Subscriber.js:84:30)

Steps to Reproduce

Install like this

cd ~
mkdir testdir
cd ~/testdir/
npm install -g npm@latest
npm install @openapitools/openapi-generator-cli

sudo ln -s /home/$USER/testdir/node_modules/@openapitools/openapi-generator-cli/main.js /usr/bin/openapi-generator-cli

sudo chmod 755 node_modules/@openapitools/openapi-generator-cli/main.js

Now try running:

~/testdir/$ which openapi-generator-cli
/usr/bin/openapi-generator-cli
~/testdir$ openapi-generator-cli version
Unable to query repository, because of: "Request failed with status code 504"

Response:
date Thu, 12 Jan 2023 17:45:56 GMT
content-type text/html
content-length 160
connection keep-alive
server nginx

/home/user/testdir/node_modules/@openapitools/openapi-generator-cli/main.js:1045
            error.response.data.on('data', data => this.logger.log(data.toString('utf8')));
                                ^

TypeError: error.response.data.on is not a function
    at VersionManagerService.printResponseError (/home/user/testdir/node_modules/@openapitools/openapi-generator-cli/main.js:1045:33)
    at /home/user/testdir/node_modules/@openapitools/openapi-generator-cli/main.js:924:18
    at /home/user/testdir/node_modules/rxjs/dist/cjs/internal/operators/catchError.js:13:51
    at OperatorSubscriber._this._error (/home/user/testdir/node_modules/rxjs/dist/cjs/internal/operators/OperatorSubscriber.js:43:21)
    at Subscriber.error (/home/user/testdir/node_modules/rxjs/dist/cjs/internal/Subscriber.js:60:18)
    at Subscriber._error (/home/user/testdir/node_modules/rxjs/dist/cjs/internal/Subscriber.js:84:30)
    at Subscriber.error (/home/user/testdir/node_modules/rxjs/dist/cjs/internal/Subscriber.js:60:18)
    at Subscriber._error (/home/user/testdir/node_modules/rxjs/dist/cjs/internal/Subscriber.js:84:30)
    at Subscriber.error (/home/user/testdir/node_modules/rxjs/dist/cjs/internal/Subscriber.js:60:18)
    at Subscriber._error (/home/user/testdir/node_modules/rxjs/dist/cjs/internal/Subscriber.js:84:30)

Strangely enough, changing the directory seems to work

cd ..
~$ openapi-generator-cli version
Download 6.2.1 ...
Downloaded 6.2.1
Did set selected version to 6.2.1
6.2.1

You can break it again:

cd testdir
rm -rf node_modules/@openapitools/openapi-generator-cli/versions/
openapi-generator-cli version

The above will give you the same error

Expected behavior

openapi-generator-cli version
Download 6.2.1 ...
Downloaded 6.2.1
Did set selected version to 6.2.1
6.2.1

Screenshots

If applicable, add screenshots to help explain your problem.

Operation System (please complete the following information):

  • OS: Ubuntu
  • Version: 22

Package System (please complete the following information):

  • Node.js v19.3.0
  • npm - 9.2.0

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions