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

Pretty much broken for CRDs with 8.3.7 #620

Closed
Stono opened this issue Apr 29, 2020 · 3 comments
Closed

Pretty much broken for CRDs with 8.3.7 #620

Stono opened this issue Apr 29, 2020 · 3 comments

Comments

@Stono
Copy link

Stono commented Apr 29, 2020

Hey,
We bumped to the latest patch version and anything which attempts to load CRDs is broken:

(node:47387) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '0' of undefined
    at /Users/karl.stoney/git/autotrader/solr-overwatch/node_modules/swagger-fluent/lib/loader.js:118:35
    at Array.reduce (<anonymous>)
    at Root.getPathnameParameters (/Users/karl.stoney/git/autotrader/solr-overwatch/node_modules/swagger-fluent/lib/loader.js:117:35)
    at Root._requestAsync (/Users/karl.stoney/git/autotrader/solr-overwatch/node_modules/swagger-fluent/lib/loader.js:243:32)
    at Root._get (/Users/karl.stoney/git/autotrader/solr-overwatch/node_modules/swagger-fluent/lib/loader.js:266:17)
    at Kubernetes.<anonymous> (/Users/karl.stoney/git/autotrader/solr-overwatch/node_modules/@at/kubernetes/client.js:72:66)
    at Generator.next (<anonymous>)
    at /Users/karl.stoney/git/autotrader/solr-overwatch/node_modules/@at/kubernetes/client.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/karl.stoney/git/autotrader/solr-overwatch/node_modules/@at/kubernetes/client.js:4:12)

This is doing:

        const crd = await client.apis['apiextensions.k8s.io']
          .v1beta1.customresourcedefinitions(name).get();

Digging into the code it looks like a scoping issue:

  /**
   * Return an object of pathname parameters.
   * @returns {object} object mapping each parameter name to its value.
   */
  getPathnameParameters() {
    const pathnameParameterNames = this.swaggerName
      .split('/')
      .filter(component => component.startsWith('{'))
      .map(component => component.slice(1, -1))
    return pathnameParameterNames.reduce((acc, value, index) => {
      acc[value] = this.parameters[index]
      return acc
    }, {})
  }

this.parameters is undefined at this point.

Rolling back to 8.3.6 fixed it.

@Flydiverny
Copy link

Sorry about that, its fixed already but explanation here silasbw/swagger-fluent#72

Please reinstall them node modules or update to kubernetes-client v9

@Stono
Copy link
Author

Stono commented May 2, 2020

No worries man, Thanks for the quick fix.

I’ll upgrade over the next few days and test all is Ok!

@Stono
Copy link
Author

Stono commented May 4, 2020

I upgraded today and all seems well, thanks for the fix

@Stono Stono closed this as completed May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants