ericallam commented on PR #282:
URL:
https://github.com/apache/pulsar-client-node/pull/282#issuecomment-1378497083
Okay I'm working on testing this now. I started with Building from source
using the steps in the README on the `master` branch without the fix to make
sure I could reproduce the issue. Here's the example I created to run the test
(with some bits sensitive details redacted):
```js
const Pulsar = require("../");
(async () => {
Pulsar.Client.setLogHandler((level, file, line, message) => {
console.log("[%s][%s:%d] %s", level, file, line, message);
});
const auth = new Pulsar.AuthenticationOauth2({
type: "sn_service_account",
client_id: "...",
client_secret: "...",
issuer_url: "https://auth.streamnative.cloud/",
audience: "...",
});
// Create a client
const client = new Pulsar.Client({
serviceUrl: "pulsar+ssl://<cluster>.<orgId>.snio.cloud:6651",
authentication: auth,
});
// Create a consumer
const consumer = await client.subscribe({
topic: "persistent://public/default/my-topic",
subscription: "sub1",
subscriptionType: "Shared",
});
const producer = await client.createProducer({
topic: "persistent://public/default/my-topic",
sendTimeoutMs: 30000,
batchingEnabled: true,
});
for (let i = 0; i < 10; i += 1) {
const msg = `my-message-${i}`;
producer.send({
data: Buffer.from(msg),
});
console.log(`Sent message: ${msg}`);
}
await producer.flush();
// Receive messages
for (let i = 0; i < 10; i += 1) {
const msg = await consumer.receive();
console.log(msg.getData().toString());
consumer.acknowledge(msg);
}
await producer.close();
await consumer.close();
await client.close();
})();
```
And here's the result of running that:
```
pulsar-client-node $ node examples/oauth.js
[1][Client:87] Subscribing on Topic :persistent://public/default/my-topic
[1][ClientConnection:189] [<none> ->
pulsar+ssl://<cluster>.<orgId>.snio.cloud:6651] Create ClientConnection,
timeout=10000
[1][ConnectionPool:97] Created connection for
pulsar+ssl://<cluster>.<orgId>.snio.cloud:6651
[1][ClientConnection:379] [192.168.1.8:61122 -> 184.72.154.254:6651]
Connected to broker
[3][ClientConnection:472] [192.168.1.8:61122 -> 184.72.154.254:6651]
Handshake failed: certificate verify failed (SSL routines,
tls_process_server_certificate)
[1][ClientConnection:1584] [192.168.1.8:61122 -> 184.72.154.254:6651]
Connection closed with ConnectError
[3][ClientImpl:407] Error Checking/Getting Partition Metadata while
Subscribing on persistent://public/default/my-topic -- ConnectError
node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^
[Error: Failed to create consumer: ConnectError]
```
Now after integrating the changes from the PR, I did the following:
```sh
$ rm -rf ./pkg/mac/build
$ ./pkg/mac/build-cpp-deps-lib.sh
$ ./pkg/mac/build-cpp-lib.sh
$ npm install
```
Then I tried running an example and I'm getting an error:
```
node examples/producer
node:internal/modules/cjs/loader:1243
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error:
dlopen(/Users/eric/code/OpenSource/pulsar-client-node/lib/binding/Pulsar.node,
0x0001): symbol not found in flat namespace (_kSecAttrLabel)
at Module._extensions..node (node:internal/modules/cjs/loader:1243:18)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Module.require (node:internal/modules/cjs/loader:1061:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous>
(/Users/eric/code/OpenSource/pulsar-client-node/src/pulsar-binding.js:24:17)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12) {
code: 'ERR_DLOPEN_FAILED'
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]