apache/pulsar-client-node

Error in Running Pulser in frontend side

Closed this issue · 4 comments

So i have been trying to send a simple request as a demo on the frontend on react js but am getting

image

 const Pulasrclient = new PulsarClient.Client({
    serviceUrl:"pulsar://192.168.100.38:6650",
    operationTimeoutSeconds: 10,
    connectionTimeoutSeconds: 5
  }); 
async function connectToPulsar() {
  try {
    // Attempt to create a producer as a test for connection
    const producer = await client.createProducer({
      topic: 'persistent://public/default/test-topic'
    });
    await producer.close(); // Close the producer immediately after creation

    console.log("Connected to Pulsar!");
  } catch (error) {
    console.error("Failed to connect to Pulsar:", error.message);
  }
} ```
shibd commented

How did you install the Pulsar node.js client?

i used
npm i pulsar-client

Hi, how's it going? @shibd @its0beno

shibd commented

@its0beno @milobluebell I don't know what special environment is used on the frontend side. Can you provide more context? e.g., the version of Node.js, the specific reproduction steps, etc