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

HTTP errors using 2.2.1 #162

Closed
evanshortiss opened this issue Sep 11, 2019 · 8 comments
Closed

HTTP errors using 2.2.1 #162

evanshortiss opened this issue Sep 11, 2019 · 8 comments
Labels

Comments

@evanshortiss
Copy link
Contributor

We noticed that since openshift-rest-client v2.2.1 was released nodeshift has stopped working for some of us.

I have a project setup on my machine using nodeshift to deploy and test on OpenShift and it was working great (thank you 🙏)

A colleague cloned the project and tried to use nodeshift, but the deploy failed with this error:

2019-09-10T18:59:12.897Z INFO loading configuration
kubernetes-client deprecated fromKubeconfig see https://github.com/godaddy/kubernetes-client/blob/master/merging-with-kubernetes.md#request-kubeconfig- node_modules/nodeshift/lib/nodeshift-config.js:35:32
2019-09-10T18:59:12.955Z INFO using namespace city-of-losangeles at https://master.hackfest-3ace.open.redhat.com:443
2019-09-10T18:59:12.990Z WARNING a file property was not found in your package.json, archiving the current directory.
2019-09-10T18:59:12.990Z INFO creating archive of .gitignore, Dockerfile, README.md, data, generate.js, lib, package-lock.json, package.json
2019-09-10T18:59:13.013Z ERROR this.backend.http is not a function

Looking at the dependency tree it seems like a new release of the openshift-rest-client was made, so it's possibly the culprit.

The original dep setup for me was:

  • nodeshift 3.1.1
    • openshift-rest-client 2.2.0
      • kubernetes-client 7.0.1

I rm'ed my lockfile and did a reinstall and ended up with:

  • nodeshift 3.1.1
    • openshift-rest-client 2.2.1
      • kubernetes-client 8.3.4

Adding a log in the nodeshift source allows me to get this stacktrace:

TypeError: this.backend.http is not a function
    at Root._requestAsync (/Users/eshortis/workspaces/work/rhte-2019/rhte-2019-hackathon-on-rhmi/content/iot-data-generator/node_modules/swagger-fluent/lib/loader.js:239:25)
    at Root._get (/Users/eshortis/workspaces/work/rhte-2019/rhte-2019-hackathon-on-rhmi/content/iot-data-generator/node_modules/swagger-fluent/lib/loader.js:266:17)
    at Object.createOrUpdateBuildConfig (/Users/eshortis/workspaces/work/rhte-2019/rhte-2019-hackathon-on-rhmi/content/iot-data-generator/node_modules/nodeshift/lib/build-config.js:84:133)
    at build (/Users/eshortis/workspaces/work/rhte-2019/rhte-2019-hackathon-on-rhmi/content/iot-data-generator/node_modules/nodeshift/lib/goals/build.js:34:27)

The get() call in build-config.js:84:133 triggers the error.

I'm not familiar with how the swagger module and openshift-rest-client work together, but hopefully this is helpful. Maybe it's just some

@evanshortiss
Copy link
Contributor Author

Opening in nodeshift repo.

@evanshortiss
Copy link
Contributor Author

evanshortiss commented Sep 11, 2019

Actually I think I've found a fix. In openshift-rest-client.js add:

const Request = require('kubernetes-client/backends/request')

and make this change:

// Current code. Doesn't work
// const client = new Client({ backend: kubeconfig || kbconfig.loadFromDefault(), spec, getNames: getNames });

// Fix per https://github.com/godaddy/kubernetes-client/blob/master/merging-with-kubernetes.md#preparing-to-upgrade-to-900
const client = new Client({ backend: new Request(kubeconfig) || kbconfig.loadFromDefault(), spec, getNames: getNames });

I'm happy to PR this.

@evanshortiss evanshortiss reopened this Sep 11, 2019
@lholmquist lholmquist added the bug label Sep 11, 2019
@helio-frota
Copy link
Member

That's weird on how the tests passed before.

I'm happy to PR this.

Sounds great thanks!

@lholmquist
Copy link
Member

A PR would be good, thanks.

are you specifying your own configuration? How are you setting up the client, i guess is what i'm asking

@evanshortiss
Copy link
Contributor Author

@lholmquist no config besides the namespace.name CLI flag like so nodeshift --namespace.name my-ns

PR opened.

@lholmquist
Copy link
Member

lholmquist commented Sep 11, 2019

I put this in your PR, but this comment should go here

@evanshortiss i reverted the changes from that other PR #160 and released a new 2.2.2 version. you should be able to get this new updated version if you remove your package-lock and do an install again

This will give us more time to figure this out

@lholmquist
Copy link
Member

Going to close this since 2.2.2 should fix this

@evanshortiss
Copy link
Contributor Author

Thanks!

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

No branches or pull requests

3 participants