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.

Unable to execute openapi-generator-cli version[BUG]

See original GitHub issue

Using version 2.3.5 of openapi-generator-cli in the Node environment, I am getting the error shown below. Googling, I found bug #130 in this issue database. This issue states that a solution was put in place, but does not provide any guidance on how to implement the solution.

[rflatau@localhost server]$ npx @openapitools/openapi-generator-cli version
Unable to query repository, because of: "Request failed with status code 501"

Response:
server squid/3.4.8
mime-version 1.0
date Tue, 22 Jun 2021 13:39:33 GMT
content-type text/html
content-length 3484
x-squid-error ERR_UNSUP_REQ 0
vary Accept-Language
content-language en
x-cache MISS from intergate2
x-cache-lookup NONE from intergate2:3132
via 1.1 intergate2 (squid/3.4.8)
connection close

(node:35812) UnhandledPromiseRejectionWarning: TypeError: error.response.data.on is not a function
    at VersionManagerService.printResponseError (/home/rflatau/devel/learning_center-main/api/node_modules/@openapitools/openapi-generator-cli/main.js:922:33)
    at /home/rflatau/devel/learning_center-main/api/node_modules/@openapitools/openapi-generator-cli/main.js:828:18
    at /home/rflatau/devel/learning_center-main/api/node_modules/rxjs/dist/cjs/internal/operators/catchError.js:13:46
    at OperatorSubscriber._this._error (/home/rflatau/devel/learning_center-main/api/node_modules/rxjs/dist/cjs/internal/operators/OperatorSubscriber.js:38:21)
    at OperatorSubscriber.Subscriber.error (/home/rflatau/devel/learning_center-main/api/node_modules/rxjs/dist/cjs/internal/Subscriber.js:80:18)
    at OperatorSubscriber.Subscriber._error (/home/rflatau/devel/learning_center-main/api/node_modules/rxjs/dist/cjs/internal/Subscriber.js:104:30)
    at OperatorSubscriber.Subscriber.error (/home/rflatau/devel/learning_center-main/api/node_modules/rxjs/dist/cjs/internal/Subscriber.js:80:18)
    at OperatorSubscriber.Subscriber._error (/home/rflatau/devel/learning_center-main/api/node_modules/rxjs/dist/cjs/internal/Subscriber.js:104:30)
    at OperatorSubscriber.Subscriber.error (/home/rflatau/devel/learning_center-main/api/node_modules/rxjs/dist/cjs/internal/Subscriber.js:80:18)
    at OperatorSubscriber.Subscriber._error (/home/rflatau/devel/learning_center-main/api/node_modules/rxjs/dist/cjs/internal/Subscriber.js:104:30)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:35812) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:35812) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The referenced bug report seems to imply that proxy settings might be the problem. Investigating now how to deal with specifying the proxies. We are behind a corporate proxy. I have tried setting http_proxy and https_proxy environment parameters without success. I believe that there is a way to configure the openapi-generator-cli to deal with proxies, but I have not been able to find this.

I found two configurations within the referenced bug report: here and here. But no details on the structure of the configuration file.

What is the configuration needed to get the command below work? How do I augment the command to use the configuration file:

npx @openapitools/openapi-generator-cli version

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:21 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
rdelhommercommented, Oct 4, 2021

I was also able to find a workaround for this by manually setting the version in my openapitools.json file. The issue is happening when the npm wrapper tries to query the lastest available version of openapi-generator from maven. If you’ve set your version in openapitools.json, it wont run the query and will just download the jar file corresponding to the version you’ve chosen. So far I haven’t had any issues with downloading the jar. Really only the query seems to be having issues

Example

{
    "generator-cli": {
      "version": "5.2.1"
    }
}
1reaction
pstanoevcommented, Jul 7, 2021

I am having similar issue. It is most likely that the NO_PROXY environment variable is not respected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

@openapitools/openapi-generator-cli - npm
A npm package wrapper for OpenAPI Generator (https://github.com/OpenAPITools/openapi-generator), generates which API client libraries (SDK ...
Read more >
openapitools/openapi-generator - Docker Image - Docker Hub
Automated builds of openapi-generator images. ... OPENAPI_GENERATOR_VERSION=3.1.0-SNAPSHOT openapi-generator-cli version # Execute version 3.0.2 for every ...
Read more >
OpenAPI Generator fails to launch with generator version 6.2.0
OpenAPI Generator fails to launch with generator version 6.2.0 · 1. Create or import an OpenAPI specification · 2. Configure the generator to...
Read more >
openapitools/openapi-generator-cli - NPM Package Overview
Bug Fixes. run docker with ... You need to execute openapi-generator-cli instead of ... That version is saved in the file openapitools.json.
Read more >
How to force OpenAPI Generator CLI to use pre-downloaded ...
WSL-exclusive bug? corporate proxy having an edge case?) ... every single run of sudo openapi-generator-cli help resulted in an immediate ...
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