Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read properties of undefined (reading 'send') #27511

Closed
6 tasks
ryanbecker opened this issue Oct 23, 2023 · 3 comments
Closed
6 tasks

TypeError: Cannot read properties of undefined (reading 'send') #27511

ryanbecker opened this issue Oct 23, 2023 · 3 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Bus

Comments

@ryanbecker
Copy link

ryanbecker commented Oct 23, 2023

  • Package Name: @azure/service-bus
  • Package Version: 7.9.2
  • Operating system: Windows (Azure App Services)
  • nodejs
    • version: 18
  • browser
    • name/version:
  • typescript
    • version:
  • Is the bug related to documentation in

Describe the bug
Sometimes the underlying sender link is undefined when calling sender.sendMessages and our error handling and retry logic is invoked due to failure to send during the first attempt. Here's the error thrown and relevant call stack:

TypeError: Cannot read properties of undefined (reading 'send')
at Object.sendEventPromise [as operation] (C:\home\site\wwwroot\node_modules\@azure\service-bus\dist\index.js:9099:50)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.retry (C:\home\site\wwwroot\node_modules\@azure\core-amqp\dist\index.js:1445:22)
at async MessageSender.send (C:\home\site\wwwroot\node_modules\@azure\service-bus\dist\index.js:9174:20)
at async Object.withSpan (C:\home\site\wwwroot\node_modules\@azure\core-tracing\dist\index.js:140:28)

We are sending internal @azure/service-bus logs to App Insights and we usually see the sender_closed and session_closed events around the same time.

The call stack points to this line of code, where the sender link is assumed to have a value:

const delivery = await this.link!.send(encodedMessage, {

To Reproduce
Steps to reproduce the behavior:

  1. Maybe use Service Bus Standard to increase the changes of lost connectivity? Probably a unit test could neatly reproduce this race condition.
  2. Send a message while the underlying sender link is being recreated and is undefined.

Expected behavior

  1. No TypeErrors, even in the context of poor connectivity to the Service Bus servers.
  2. Automatic retry within the Service Bus library if the session/sender/anything else is being recreated. This is how the library has always worked and seems to be the intent - this is all happening inside the _trySend function and the whole send operation is wrapped in coreAmqp.retry.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-triage Workflow: This issue needs the team to triage. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Bus labels Oct 23, 2023
@xirzec xirzec removed the needs-team-triage Workflow: This issue needs the team to triage. label Oct 23, 2023
@github-actions github-actions bot added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Oct 23, 2023
@jeremymeng
Copy link
Member

@ryanbecker Thanks for the report! I will look into it.

@jeremymeng
Copy link
Member

PR #27557

@jeremymeng
Copy link
Member

fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Bus
Projects
None yet
Development

No branches or pull requests

3 participants