question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting error from service bus on sending message of size greater then 1 MB for premium tier.

See original GitHub issue
  • Package Name: azsdk-js-azureservicebus
  • Package Version: 7.7.1
  • Operating system: Mac OS BigSur version 11.2.3
  • nodejs
    • version: 12.16.3
  • browser
    • name/version:
  • typescript
    • version: 4.6.3
  • Is the bug related to documentation in

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Deploy a Premium SB namespace and topic (with maxMessageSizeInKB = 102400).
  2. create a function app and replace code in index file with following code

import { AzureFunction, Context, HttpRequest } from '@azure/functions'; import { ServiceBusMessage, ServiceBusClient } from '@azure/service-bus'; import * as config from './function.json'; const httpTrigger: AzureFunction = async function (context: Context, req: HttpRequest): Promise<void> { const serviceBusMessage: ServiceBusMessage = { body: req.body } as ServiceBusMessage try { const serviceBusClient = new ServiceBusClient("set this value accordingly"); const sender = serviceBusClient.createSender("set this value accordingly"); await sender.sendMessages(serviceBusMessage); } catch (error) { context.log.error(error SendMessage${error}); throw error; } }; export default httpTrigger;

Expected behavior sender.sendMessages should not throw error.

Error Body

InvalidOperationError: The link ‘G4S2:3993911:hybris.syndication-product.cds-sbt-2ce21e98-e39b-0b4b-a421-48f12923638f’ is force detached by the broker because publisher(link9441) received a batch message with no data in it. Detach origin: Publisher.

Additional context as per the document large-messages-support Batching is not supported for Large Messages and as per the sendMessage code https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/servicebus/service-bus/src/sender.ts#L193-L223, inside else case we are creating batch from message due to which we are getting this error, on my local machine I replaced it with following code :

async sendMessages( messages: | ServiceBusMessage | ServiceBusMessage[] | ServiceBusMessageBatch | AmqpAnnotatedMessage | AmqpAnnotatedMessage[], options?: OperationOptionsBase ): Promise { this._throwIfSenderOrConnectionClosed() throwTypeErrorIfParameterMissing(this._context.connectionId, “messages”, messages) let batch: ServiceBusMessageBatch; if (isServiceBusMessageBatch(messages)) { batch = messages; const spanLinks: TracingSpanLink[] = batch._messageSpanContexts.map((tracingContext) => { return { tracingContext, }; }) return tracingClient.withSpan( “ServiceBusSender.send”, options ?? {}, (updatedOptions) => this._sender.sendBatch(batch, updatedOptions), { spanLinks, …toSpanOptions( { entityPath: this.entityPath, host: this._context.config.host }, “client” ), } ); } else { if (!Array.isArray(messages)) { messages = [messages]; } const sendMessagesPromise = messages.map((message) => { return tracingClient.withSpan( “ServiceBusSender.send”, options ?? {}, (updatedOptions) => this._sender.send(message, updatedOptions), { …toSpanOptions( { entityPath: this.entityPath, host: this._context.config.host }, “client” ), } ); }); await Promise.all(sendMessagesPromise) } }

it worked, request you to please look into this.

Dummy data for issue verification

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
HarshaNallurucommented, Aug 26, 2022

Hey @sabharwal-garv,

Thanks for the message.

After talking to others in the feature crew for service-bus SDKs, we decided to go with “allow sending a single message without creating a batch for it”, PR created for it https://github.com/Azure/azure-sdk-for-js/pull/23014. Feel free to provide feedback.

While we have this solution, we are also going to ask the service team for new properties on the link to manage batching of messages better in the sendMessages method. I’ll post more on this if there is progress on these discussions.

But, for now, I believe this #23014 should work for you. I’ll provide you with a dev package version for you to test the fix before checking in the PR.

0reactions
HarshaNallurucommented, Sep 7, 2022

@sabharwal-garv, the fix has been published with the @azure/service-bus@7.7.1 version, please pull down the latest version and let us know if the fix works for you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Microsoft Azure Service Bus quotas and limits
Quota name Scope Value Number of concurrent connections on a namespace Namespace Net Messaging: 1,000. A... Maximum size of a message ID Entity 128 Maximum size...
Read more >
A request has exceeded the maximum message size for the ...
Can anyone suggest me why the Azure Service Bus does not allow more than 1 MB of message size even though I used...
Read more >
Dealing with Azure Service Bus Message Size | Serverless360
A developer using MSMQ on-premises can send messages up to 4 MB in size, while an Azure developer using Storage Queues will be...
Read more >
Service Bus and large files - the easy way - John Taubensee
Azure Service Bus has a message size limit of 256 KB for the standard offering, and 1 MB for the premium tier (the...
Read more >
Service Bus · Community - Azure Feedback
Premium is currently limited to a maximum message size of 1 MB. It would be great if you increased the maximum message size...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found