godaddy / godaddy/kubernetes-client
Typescript Help: Client is not a constructor
- Dominant language
- JavaScript
- Stars
- 963
- Forks
- 189
- PR merge metrics
- No merged PRs in 30d
Description
I pulled the code directly from the typescript example in the README:
```
import * as ApiClient from 'kubernetes-client';
const Client = ApiClient.Client1_13;
const client = new Client({ version: '1.13' });
```
My only difference is loading the kubeconfig from the cluster:
```
const kubeconfig = new KubeConfig();
kubeconfig.loadFromCluster();
const backend = new Request({ kubeconfig });
return new ApiClient.Client1_13({ backend, version: '1.13' });
```
When I run this typescript gives me an error:
`Error initializing client: TypeError: Client is not a constructor`
I tried everything I could think of and searched the googles and couldn't come up with anything, any help would be greatly appreciated!
node: 16.15.0
typescript: 4.6.2
Contributor guide
Research direction
Start with the TypeScript example in the README and reproduce the `Client is not a constructor` error using the reported Node.js and TypeScript versions. Compare the README import and `Client1_13` construction with the `KubeConfig`, `Request`, and cluster-loading path shown in the issue. Done means the client initializes without this runtime error using the cluster kubeconfig.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kubernetes, nodejs, typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100