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

Request with no callback results in error #189

Closed
JacobReynolds opened this issue Feb 10, 2018 · 1 comment
Closed

Request with no callback results in error #189

JacobReynolds opened this issue Feb 10, 2018 · 1 comment

Comments

@JacobReynolds
Copy link

The following request will cause an error, because there is no callback defined:

const Api = require('kubernetes-client');
const core = new Api.Core(Api.config.getInCluster());
core.namespaces(process.env.POD_NAMESPACE).pod(process.env.POD_NAME).patch({
  body: {
    metadata: {
      labels: {
        app: 'working'
      }
    }
  }
})
/usr/src/app/node_modules/kubernetes-client/lib/base.js:15
    cb(null, result.body);
    ^

TypeError: cb is not a function
    at /usr/src/app/node_modules/kubernetes-client/lib/base.js:15:5
    at Request.request [as _callback] (/usr/src/app/node_modules/kubernetes-client/lib/request.js:65:7)
    at Request.self.callback (/usr/src/app/node_modules/request/request.js:186:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (/usr/src/app/node_modules/request/request.js:1163:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (/usr/src/app/node_modules/request/request.js:1085:12)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1055:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

Would it be possible to just add a check here to see if a callback exists?

silasbw pushed a commit that referenced this issue Feb 11, 2018
Resolves #189

BREAKING CHANGE: This removes the (deprecated) `request`-like behavior of
returning a stream when the caller omits a callback. Use `.getStream` (instead
of `.get` without a callback) to get a stream.
silasbw pushed a commit that referenced this issue Feb 11, 2018
Resolves #189

BREAKING CHANGE: This removes the (deprecated) `request`-like behavior of
returning a stream when the caller omits a callback. Use `.getStream` (instead
of `.get` without a callback) to get a stream.
@silasbw
Copy link
Contributor

silasbw commented Feb 11, 2018

Thanks @JacobReynolds. I implemented support in #193. It should get merged and published with a new major version in a couple of days.

silasbw pushed a commit that referenced this issue Feb 11, 2018
Resolves #189

BREAKING CHANGE: This removes the (deprecated) `request`-like behavior of
returning a stream when the caller omits a callback. Use `.getStream` (instead
of `.get` without a callback) to get a stream.
silasbw added a commit that referenced this issue Feb 11, 2018
#193)

Resolves #189

BREAKING CHANGE: This removes the (deprecated) `request`-like behavior of
returning a stream when the caller omits a callback. Use `.getStream` (instead
of `.get` without a callback) to get a stream.
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