DeserializationError: Cannot deserialize content-type: text/plain

Viewed 683

I am new to Azure functions and I have created a Timer Trigger Azure Function to retrieve the list of repositories from Azure Container Registry using Azure Python SDK v3.6.

This code is executed properly in my local VS Code setup but when I deploy it in Azure and execute I get a DeserializationError: Cannot deserialize content-type: text/plain error.

Here is a summary of what I tried till now:

import azure.functions as func
from azure.containerregistry import ContainerRegistryClient
from azure.identity import DefaultAzureCredential

container_registry_client = ContainerRegistryClient(
    account_url,
    DefaultAzureCredential()
    # DefaultAzureCredential(logging_enable=True)
)

def main(mytimer: func.TimerRequest) -> None:
    
    logging.info("============================Start=================================")
    # Here I am able to print the container registry client which is not null, 
    # So I assume my azure function is able to connect with my ACR
    logging.info(dir(container_registry_client)) 
    # Nothing is getting printed here onwards, so I assume some issues here or in For loop
    repository_names = container_registry_client.list_repository_names()
    
    for repository_name in repository_names:
        logging.info("ACR Repository Names: " + str(repository_name))
    
    logging.info("============================End=================================")

Full Error stack:

Ran into a deserialization error. Ignoring since this is failsafe deserialization Traceback (most recent call last): File "/home/site/wwwroot/.python_packages/lib/python3.6/site-packages/msrest/serialization.py", line 1501, in failsafe_deserialize return self(target_obj, data, content_type=content_type) File "/home/site/wwwroot/.python_packages/lib/python3.6/site-packages/msrest/serialization.py", line 1367, in __call__ data = self._unpack_content(response_data, content_type) File "/home/site/wwwroot/.python_packages/lib/python3.6/site-packages/msrest/serialization.py", line 1541, in _unpack_content raw_data.headers File "/home/site/wwwroot/.python_packages/lib/python3.6/site-packages/msrest/pipeline/universal.py", line 226, in deserialize_from_http_generics return cls.deserialize_from_text(body_bytes, content_type) File "/home/site/wwwroot/.python_packages/lib/python3.6/site-packages/msrest/pipeline/universal.py", line 203, in deserialize_from_text raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) msrest.exceptions.DeserializationError: Cannot deserialize content-type: text/plain
0 Answers
Related