oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
71.08k stars 2.47k forks source link

Azure Service Bus package not working with Bun #10854

Closed henrikstorck closed 4 days ago

henrikstorck commented 1 week ago

What version of Bun is running?

1.1.7

What platform is your computer?

Microsoft Windows NT 10.0.22621.0 x64

What steps can reproduce the bug?

Prerequisites

bun install @azure/service-bus

Code

import { ServiceBusClient } from '@azure/service-bus';

// Replace `<Connection String>` with your connectionstring
const connectionString ='<Connection String>';

const sbClient = new ServiceBusClient(connectionString);

// createSender() can also be used to create a sender for a topic.
const sender = sbClient.createSender('test');

try {
  await sender.sendMessages({ body: 'Hello, world!' });

  console.log(`Message sent`);

  await sender.close();
} finally {
  await sbClient.close();
}

Node (works)

PS C:\Projects\test-project> node .\index.js     
Message sent

Bun (doesn't work)

PS C:\Projects\test-project> bun --bun .\index.js
148 |                 };
149 |                 const actionAfterTimeout = () => {
150 |                     removeListeners();
151 |                     const msg = `Unable to open the amqp connection "${this.id}" due to operation timeout.`;
152 |                     log.error("[%s] %s", this.id, msg);
153 |                     return reject(new Error(msg));
                                        ^
error: Unable to open the amqp connection "connection-1" due to operation timeout.
      at actionAfterTimeout (C:\Projects\test-project\node_modules\rhea-promise\dist\lib\connection.js:153:35)

What is the expected behavior?

The messages are sent to the Service Bus

What do you see instead?

The requests timeout after a few seconds

Additional information

Might be caused by the AMQP protocol used by Azure Service Bus