GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Bug: AttributeError: 'function' object has no attribute 'headers' when using request_configuration lambda/function for messages.get() in v1.26.0 · Issue #1175 · microsoftgraph/msgraph-sdk-python Open Labels Needs: Attention 👋priority:p3Nice to have. Customer impact is very minimalNice to have. Customer impact is very minimal DescriptionDescribe the bugWhen attempting to use the request_configuration parameter with the .get() method on a MessagesRequestBuilder (specifically graph_client.users.by_user_id(...).mail_folders.by_mail_folder_id(...).messages.get()), providing a lambda function or a named function to configure query parameters (like $select, $top, $skip, $orderby) results in an AttributeError: 'function' object has no attribute 'headers'. This error occurs internally within the Kiota request adapter's configure method (kiota_abstractions\request_information.py), indicating that the SDK is incorrectly trying to access attributes on the configuration function itself, rather than executing the function to modify the internal request configuration object before attempting to access its attributes. Calling the same .get() method without the request_configuration parameter works successfully (confirming authentication and base Mail.Read permissions are correct), but this prevents necessary customization like pagination and field selection. Attempts to import and use explicit configuration classes like MessagesRequestBuilderGetQueryParameters also fail with an ImportError in this version, suggesting the lambda/function approach is the intended method, but it appears to be broken for this endpoint/version combination. Expected behaviorThe messages.get() call should execute the provided lambda function (request_config_lambda) against an internal request configuration object. The query parameters specified within the lambda ($select, $top, $orderby) should be applied to the outgoing Graph API request. The request should succeed (assuming correct permissions), returning the specified number of messages with the selected fields, ordered accordingly. Actual Behavior: The script fails with an AttributeError inside the Kiota request adapter before the API call is made: AttributeError: 'function' object has no attribute 'headers' How to reproduceSet up a virtual environment with msgraph-sdk==1.26.0 and its dependencies (azure-identity, python-dotenv, microsoft-kiota-abstractions, etc.). Create a .env file with valid AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, and MAILBOX_USER_ID (for a mailbox the App Registration has Mail.Read Application permission + Admin Consent for). Run the following minimal Python script: import os Basic Logginglogging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') Load .envload_dotenv() if not all([tenant_id, client_id, client_secret, user_id]): async def main(): if name == "main": SDK Version1.26 Latest version known to work for scenario above?None Known WorkaroundsRemoving the request_configuration parameter entirely allows the messages.get() call to succeed, fetching the default fields and default page size. However it defeats the purpose of the app in order to collect all the data. This works, but lacks customization:messages_response = await graph_client.users.by_user_id(user_id).mail_folders.by_mail_folder_id("inbox").messages.get() Debug outputClick to expand log```Activity
MetadataMetadataAssigneesLabelsNeeds: Attention 👋priority:p3Nice to have. Customer impact is very minimalNice to have. Customer impact is very minimal TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |