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 load @kubernetes/client-node since 0.17.1 due to missing openid-client dependency

See original GitHub issue

Since upgrading to 0.17.1 we’re no longer able to load the @kubernetes/client-node module as we don’t install optional dependencies and openid-client has been changed to be optional, yet it still seems to be required by the code. All you need to do is require the module with:

const k8s = require('@kubernetes/client-node')

and then you see this require error:

internal/modules/cjs/loader.js:905
  throw err;
  ^

Error: Cannot find module 'openid-client'
Require stack:
- /test/node_modules/@kubernetes/client-node/dist/oidc_auth.js
- /test/node_modules/@kubernetes/client-node/dist/config.js
- /test/node_modules/@kubernetes/client-node/dist/index.js
- /test/go.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at Object.<anonymous> (/test/node_modules/@kubernetes/client-node/dist/oidc_auth.js:4:25)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/test/node_modules/@kubernetes/client-node/dist/oidc_auth.js',
    '/test/node_modules/@kubernetes/client-node/dist/config.js',
    '/test/node_modules/@kubernetes/client-node/dist/index.js',
    '/test/go.js'
  ]
}

It seems like if the dependency is really optional then you should have to opt into the function that requires the optional dependency. Just requiring the module should not require optional dependencies be installed.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
brendandburnscommented, Sep 15, 2022

Yeah, this is a bug, thanks for reporting. We should handle this correctly. I will work on a fix.

4reactions
felix-gohlacommented, Nov 1, 2022

Hi 😃 Thank you very much for the fix! Can we expect a new release including that fix in the near future or did I miss something?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Installation failed with error message · Issue #832 - GitHub
Describe the bug Installation failed with error message: error openid-client@5.1.7: The engine "node" is incompatible with this module.
Read more >
@kubernetes/client-node - npm package | Snyk
We found a way for you to contribute to the project! Looks like @kubernetes/client-node is missing a security policy. You can connect your...
Read more >
@kubernetes/client-node - npm
Credentials are cached based on the kubeconfig username and these can collide across configs. Here is the related issue. The client wasn't ...
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