silasbw / swagger-fluent

A fluent client for OpenAPI and Swagger
MIT License
8 stars 8 forks source link

Error: Failed to get /openapi/v2 and /swagger.json: Created Component, but require templated one. #103

Closed allen-servedio closed 3 years ago

allen-servedio commented 3 years ago

This issue is cropping up in a couple of nodejs apps (these are just two examples):

https://github.com/external-secrets/kubernetes-external-secrets/issues/576

npm info it worked if it ends with ok
npm info using npm@6.14.6
npm info using node@v12.18.4
npm info lifecycle kubernetes-external-secrets@6.0.0~prestart: kubernetes-external-secrets@6.0.0npm info lifecycle kubernetes-external-secrets@6.0.0~start: kubernetes-external-secrets@6.0.0
> kubernetes-external-secrets@6.0.0 start /app
> ./bin/daemon.js

{"level":30,"time":1607551661639,"pid":17,"hostname":"external-secrets-559966b9bf-jkck9","msg":"loading kube specs"}
Error: Failed to get /openapi/v2 and /swagger.json: Created Component, but require templated one. This is a bug. Please report: https://github.com/silasbw/fluent-openapi/issues    
    at /app/node_modules/kubernetes-client/lib/swagger-client.js:58:15
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async main (/app/bin/daemon.js:33:3)
npm info lifecycle kubernetes-external-secrets@6.0.0~start: Failed to exec start script
npm ERR! code ELIFECYCLEnpm ERR! errno 1npm ERR! kubernetes-external-secrets@6.0.0 start: `./bin/daemon.js`npm ERR! Exit status 1npm ERR! 
npm ERR! Failed at the kubernetes-external-secrets@6.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm timing npm Completed in 1392msnpm ERR! A complete log of this run can be found in:
npm ERR!     /home/node/.npm/_logs/2020-12-09T22_07_41_808Z-debug.log

And

> ibmcloud-iks-debug@1.0.0 start /ibmcloud-iks-debug
> node server.js

(node:18) UnhandledPromiseRejectionWarning: Error: Failed to get /openapi/v2 and /swagger.json: Created Component, but require templated one. This is a bug. Please report: https://github.com/silasbw/fluent-openapi/issues
    at /ibmcloud-iks-debug/node_modules/kubernetes-client/lib/swagger-client.js:58:15
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async start (/ibmcloud-iks-debug/server.js:44:3)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:18) 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: 1)
(node:18) [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.

In our case, it appears to be coming from the apiserver that the Prometheus Adapter is creating (https://github.com/kubernetes-sigs/prometheus-adapter and https://github.com/prometheus-community/helm-charts/tree/main/charts/prometheus-adapter). When we remove that API server or downgrade the prometheus adapter to 0.7 (which is before it created the API server) we do not see the kinds of errors above.

allen-servedio commented 3 years ago

Duplicate of #55