Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Diagnose Azure service issues, query logs, and troubleshoot failures using GitHub Copilot for Azure
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
troubleshooting/messaging/azure-servicebus-js.md
1# Azure Service Bus SDK — JavaScript23Package: `@azure/service-bus` | [README](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/servicebus/service-bus/) | [Full Troubleshooting Guide](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/servicebus/service-bus/TROUBLESHOOTING.md)45## Common Errors67| Error Code | Cause | Fix |8|------------|-------|-----|9| `ServiceTimeout` | Service didn't respond; or no unlocked sessions | Transient — auto-retried. Verify state if persists |10| `MessageLockLost` | Processing exceeded lock duration or link detached | Reduce processing time, ensure autolock renewal works |11| `SessionLockLost` | Session lock expired or link detached | Re-accept session, keep renewing lock |12| `QuotaExceeded` | Too many concurrent receives | Reduce receivers or use batch receives |13| `MessageSizeExceeded` | Message or batch > max size | Reduce payload. Premium supports individual messages up to 100MB. Batch limit is computed from max message size on the client, so batches can also be impacted |14| `UnauthorizedAccess` | Bad credentials | Verify connection string, SAS, or RBAC roles |1516`ServiceBusError` fields: `code`, `retryable`, `name`, `info`, `address`.1718## Enable Logging1920```bash21# All SDK logs22export AZURE_LOG_LEVEL=verbose2324# Or granular control25export DEBUG=azure*,rhea*2627# Errors only28export DEBUG=azure:service-bus:error,azure:core-amqp:error,rhea-promise:error,rhea:events,rhea:frames,rhea:io,rhea:flow29```3031Log to file:32```bash33node app.js > out.log 2>debug.log34```3536## Key Issues3738- **Socket exhaustion**: Treat `ServiceBusClient` as singleton. Each creates a new AMQP connection. Always call `close()`.39- **Lock lost before expiry**: Can happen on link detach (transient network issue or 10-min idle timeout). Not always due to processing time.40- **Batch receive returns fewer messages**: After first message arrives, receiver waits only 1s for additional messages. `maxWaitTimeInMs` controls wait for the *first* message only.41- **Autolock renewal not working**: Ensure system clock is accurate. Autolock relies on system time.42- **Batch size limits**: Batch limit is artificially computed on the client from the max message size sent by the service. Send large messages individually if batch creation fails.43- **WebSockets**: Pass `webSocketOptions` to `ServiceBusClient` constructor for port 443 connectivity.44- **Distributed tracing**: Experimental OpenTelemetry support via `@azure/opentelemetry-instrumentation-azure-sdk`.45