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

[@azure/service-bus] TypeError: messageSpan.spanContext is not a function when trying to sendMessages #17307

Closed
2 of 6 tasks
harveyconnor opened this issue Aug 27, 2021 · 14 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. issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Bus

Comments

@harveyconnor
Copy link

  • Package Name: @azure/service-bus
  • Package Version: 7.3.0
  • Operating system: Azure App Services Web App Container Linux
  • nodejs
    • version: 14
  • browser
    • name/version:
  • typescript
    • version: 4.3.5
  • Is the bug related to documentation in

Describe the bug
When trying to send a message via the @azure/service-bus package it doesn't work and throws and error:
TypeError: messageSpan.spanContext is not a function.

I have the package [email protected] installed also as that was recommended in another ticket.

To Reproduce

const client = new ServiceBusClient(process.env.AZURE_SERVICE_BUS_CONNECTION_STRING);
const sender = client.createSender(process.env.AZURE_SERVICE_BUS_QUEUE_NAME);

sender.sendMessages({
  contentType: 'application/json',
    body: {
      bookingId: booking.id.toString(),
      type: 'PRE_BOOKING',
    },
    scheduledEnqueueTimeUtc: new Date(),
})

Expected behavior
The message should send without throwing an error.

@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Aug 27, 2021
@maorleger maorleger self-assigned this Aug 30, 2021
@maorleger
Copy link
Member

Hey @harveyconnor

The dependencies you have listed should be compatible from an opentelemetry version side... but it's possible that some things are still out of date - I've seen that happen due to outdated lockfiles. Unfortunately as you noticed an OpenTelemetry API change ended up causing us some pain but I'd love to help you get this resolved!

For starters, could you tell me what dependencies you have listed in your package.json?
Also, it would be really helpful to know what the output of npm ls @opentelemetry/api is on an environment where this reproduces.

Thanks in advance!

@maorleger maorleger added the needs-author-feedback Workflow: More information is needed from author to address the issue. label Aug 30, 2021
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Aug 30, 2021
@maorleger maorleger added Client This issue points to a problem in the data-plane of the library. Service Bus labels Aug 30, 2021
@harveyconnor
Copy link
Author

@maorleger Thanks for the reply, I can't give you a list of all of the libraries we have in our package.json but will provide you with the microsoft/azure related ones.

Also we downgraded the versions of the following packages and it is now behaving correctly without the error. These below are the packages and versions being used.

"@azure/msal-node": "1.3.0",
"@azure/service-bus": "7.0.5",
"applicationinsights": "1.8.10",
"azure-sb": "0.11.2",

"@types/azure-sb": "0.0.38",

Response from npm ls @opentelemetry/api:

api@1.0.0 /Users/user/Development/Production_Workspace/api
└─┬ @azure/service-bus@7.0.5
  └─┬ @azure/core-tracing@1.0.0-preview.11
    └── @opentelemetry/api@1.0.0-rc.0 

@ghost ghost added needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed needs-author-feedback Workflow: More information is needed from author to address the issue. labels Aug 31, 2021
@maorleger
Copy link
Member

maorleger commented Aug 31, 2021

Thanks @harveyconnor for the information.

So if I understand correctly, you said that using applicationinsights 2.1.6 with @azure/service-bus 7.3.0 throws the error TypeError: messageSpan.spanContext is not a function is that right?

Your package.json shows that you're still using applicationinsights 1.8.10 but I assume that's after downgrading right? 1.8.10 doesn't seem to depend on @opentelemetry/api at all so it's likely not the culprit.

At any rate, the below combination worked for me:

    "@azure/msal-node": "1.3.0",
    "@azure/service-bus": "7.3.0",
    "applicationinsights": "2.1.6",
    "azure-sb": "0.11.2",
    "@types/azure-sb": "0.0.38"

btw - azure-sb, while not officially deprecated on npm has been replaced by @azure/service-bus so you likely don't need both

And when i run npm ls @opentelemetry/api I see the following:

validation main % npm ls @opentelemetry/api            
[email protected] /home/mleger/workspace/azure-sdk-experiments/validation
├─┬ @azure/[email protected]
│ ├─┬ @azure/[email protected]
│ │ └─┬ @azure/[email protected]
│ │   └── @opentelemetry/[email protected]  deduped
│ └─┬ @azure/[email protected]
│   └── @opentelemetry/[email protected]  deduped
└─┬ [email protected]
  └── @opentelemetry/[email protected] 

I believe that this combination should work for you - could you let me know what the same command shows after you upgrade to service-bus 7.3.0? It's possible that due to some caching or a stale lockfile you are still using @azure/core-http 1.x but I'll have to see the npm ls output to verify.

@maorleger maorleger added the needs-author-feedback Workflow: More information is needed from author to address the issue. label Aug 31, 2021
@ghost ghost removed the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Aug 31, 2021
@harveyconnor
Copy link
Author

Thanks for your reply, I will test with your configuration.
Also with azure-sb we use that for notification hub, are we able to use it the same way in notification hub with the @azure/service-bus package?

@ghost ghost added needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed needs-author-feedback Workflow: More information is needed from author to address the issue. labels Sep 1, 2021
@maorleger
Copy link
Member

Thanks for your reply, I will test with your configuration.
Also with azure-sb we use that for notification hub, are we able to use it the same way in notification hub with the @azure/service-bus package?

That is a great question... I reached out to our Service Bus expert @chradek and he will do some digging. In the meanwhile, I do believe that the above configuration should resolve your issues so I will mark this issue as addressed - feel free to let me know if you are still running into issues

@maorleger maorleger added the issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. label Sep 9, 2021
@ghost
Copy link

ghost commented Sep 9, 2021

Hi @harveyconnor. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve” to remove the “issue-addressed” label and continue the conversation.

@ghost ghost removed the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Sep 9, 2021
@ramya-rao-a
Copy link
Contributor

Also with azure-sb we use that for notification hub, are we able to use it the same way in notification hub with the @azure/service-bus package?

Can you clarify your question here @harveyconnor?

@harveyconnor
Copy link
Author

@ramya-rao-a Hi,
Currently we are interacting with azure notification hub by using the azure-sb package as this has all of the device registration stuff built in. Is there a way we can use @azure/service-bus to do the same device registration, and sending of push notifications etc. ?

@ramya-rao-a
Copy link
Contributor

Is there a way we can use @azure/service-bus to do the same device registration, and sending of push notifications etc. ?

The answer would be no. The @azure/service-bus package can only be used with the Azure Service Bus service and not Notification Hubs.

#13841 is tracking the requirement for a new package for Notification Hubs that would be similar to @azure/service-bus in terms of our SDK guidelines. You can subscribe to that issue for updates.

@harveyconnor
Copy link
Author

Thank you

@harveyconnor
Copy link
Author

harveyconnor commented Sep 22, 2021

@maorleger sorry to revive this but we have recently tried to install the packages with your versioning however it seems we are still facing the same issue (spanContext is not a function) when we build in azure pipelines and push to an app service. What we did do however was turn off application insights for that app service and it started working. What do you think could be the issue? Is there a conflict with the applicationinsights package?

@maorleger
Copy link
Member

Hmmm might be related to #17471 ?

I believe @hectorhdzg posted a workaround that might help here #17471 (comment)

Could you try that and let me know if it resolves your issues?

@harveyconnor
Copy link
Author

@maorleger thanks for posting that! Will keep an eye out for when there's an update. For now we have just disabled app insights.

@ghost
Copy link

ghost commented Sep 29, 2021

Hi @harveyconnor, since you haven’t asked that we “/unresolve” the issue, we’ll close this out. If you believe further discussion is needed, please add a comment “/unresolve” to reopen the issue.

@ghost ghost closed this as completed Sep 29, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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. issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. 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