Skip to content

TypeError: start_span() got an unexpected keyword argument 'context' in microsoft-kiota-http #428

Closed

Description

Below is the error I am encountering in my project and deployment - which relates to mircosoft-kiota-http. The error is stating a TypeError on start_span() relating to "context"

The error is occurring while using the microsoft graph package to read from a mailbox using the delta builder.

Package version with the error - 1.6.6
Python version - 3.9
Deployed onto AKS

2024-12-17 09:20:46.640 | INFO     | __main__:process_batch:31 |  - Processing batch https://graph.microsoft.com/v1.0/users/d6ee16a1-9859-4e21-ae34-5fef0bde9bd7/mailFolders('inbox')/messages/delta?$deltatoken=LztZwWjo5IivWBhyxw5rAEQFNVslxZX9kw4uNFtmZHtqvMY7FWDfDG-vmY6BPbJXfBg1tSsM0la3GHFCwg50-6GHOEgDNLxnRSeO2s8s6g0.PsEHluygtAkPvdgPYo3Wyumwi4eMRfYBpSw6d6T8MGs.
Traceback (most recent call last):
  File "/app/mailbox_reader/script.py", line 121, in <module>
    asyncio.run(main())
  File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/app/mailbox_reader/script.py", line 118, in main
    more, link = await process_batch(graph_client, blob_container_client, link)
  File "/app/mailbox_reader/script.py", line 37, in process_batch
    delta_response : DeltaGetResponse = await builder.with_url(delta_link).get()
  File "/venv/lib/python3.9/site-packages/msgraph/generated/users/item/mail_folders/item/messages/delta/delta_request_builder.py", line 51, in get
    return await self.request_adapter.send_async(request_info, DeltaGetResponse, error_mapping)
  File "/venv/lib/python3.9/site-packages/kiota_http/httpx_request_adapter.py", line 182, in send_async
    response = await self.get_http_response_message(request_info, parent_span)
  File "/venv/lib/python3.9/site-packages/kiota_http/httpx_request_adapter.py", line 522, in get_http_response_message
    _get_http_resp_span = self._start_local_tracing_span(
  File "/venv/lib/python3.9/site-packages/kiota_http/httpx_request_adapter.py", line 155, in _start_local_tracing_span
    span = tracer.start_span(name, context=_context)
TypeError: start_span() got an unexpected keyword argument 'context'

Full requirement's txt is attached below.

requirements.txt

Activity

  1. moved this to Needs Triage 🔍 in Kiotaon Dec 17, 2024
  2. JamesWordie commented on Dec 17, 2024

    @JamesWordie
    Author

    It is failing specifically on this function in this file.

        def _start_local_tracing_span(self, name: str, parent_span: trace.Span) -> trace.Span:
            """Helper function to start a span locally with the parent context."""
            _context = trace.set_span_in_context(parent_span)
            span = tracer.start_span(name, context=_context)
            return span
    

    Which comes from

    """Helper function to start a span locally with the parent context."""

  3. andrueastman commented on Jan 13, 2025

    @andrueastman
    Contributor

    James Wordie (@JamesWordie) Any chance you can confirm this issue still occurs with the latest version of the library? There have been a couple of fixes since version 1.6.6 like #431 that may have alleviated the issue here.

  4. moved this from Needs Triage 🔍 to Waits for author 🔁 in Kiotaon Jan 13, 2025
  5. added
    bug
    status:waiting-for-author-feedback
    on Jan 13, 2025
  6. microsoft-github-policy-service commented on Jan 17, 2025

    @microsoft-github-policy-service

    This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

  7. moved this from Waits for author 🔁 to Done ✔️ in Kiotaon Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: No Recent Activitybugstatus:waiting-for-author-feedback

    Type

    No type

    Projects

    • Status
      Done ✔️

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions