hazelcast / hazelcast-nodejs-client

Hazelcast Node.js Client
https://hazelcast.com/clients/node-js/
Apache License 2.0
150 stars 58 forks source link

'getDistributedObjects()' failure [API-1906] #1474

Closed neilstevenson closed 1 year ago

neilstevenson commented 1 year ago

Describe the bug This is thrown

Error: TypeError: this.service[serviceName] is not a constructor
    at ProxyManager.initializeLocalProxy (/node_modules/hazelcast-client/lib/proxy/ProxyManager.js:163:26)
    at ProxyManager.getOrCreateProxy (/node_modules/hazelcast-client/lib/proxy/ProxyManager.js:86:39)
    at /node_modules/hazelcast-client/lib/HazelcastClient.js:160:42
    at Array.map (<anonymous>)
    at /node_modules/hazelcast-client/lib/HazelcastClient.js:159:73
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async listDistributedObjects (/client.js:78:32)
    at async /client.js:125:9

Expected behavior No exception

Screenshots N/a

Environment (please complete the following information):

  1. Exact Node.js client version that you use (e.g. 4.1.0): 5.2.0

  2. Exact Hazelcast version that you use (e.g. 4.0.1, also whether it is a minor release, or the latest snapshot): Hazelcast Platform 5.3.0-SNAPSHOT (20230227 - fb61178)

  3. Cluster size, i.e. the number of Hazelcast cluster members. 3

  4. Number of clients: 1

  5. Java version. It is also helpful to mention the JVM parameters: Java 17

  6. Node.js version. It is also useful to mention node command line arguments if there are any: node:18.14, npm@9.5.0

  7. Operating system. If it is Linux, kernel version is helpful: library/node:18.14 Docker image

  8. Logs and stack traces, if available: As above

To Reproduce Using

async function listDistributedObjects(hazelcastClient) {
    console.log('--------------------------------------');
    console.log('Distributed Objects (excluding system objects)');
    const distributedObjects = await hazelcastClient.getDistributedObjects();
    var count = 0;
    for (var i = 0; i < distributedObjects.length; i++){
        const name = distributedObjects[i].getName();
        if (!(name.startsWith("__"))) {
            const serviceName = distributedObjects[i].getServiceName();
            console.log(serviceName, "=>", "'" + name + "'");
            count++;
        }
    }
    console.log('[' + count + ' rows]');
}

Additional context This does not occur testing on localhost against a 1 or 2 node cluster, but does on Kubernetes

github-actions[bot] commented 1 year ago

Internal Jira issue: API-1906

srknzl commented 1 year ago

Will close this one because this is a known issue and tracked at https://github.com/hazelcast/hazelcast-nodejs-client/issues/982. We want to add UnknownProxy type that we will return when we encounter with a proxy that is not supported in the Node.js client.