Currently, I am having my azure function (in python) dynamically write a a plist file to in order for an app to be downloaded through a browser on an IOS device. This works fine locally, but when it is published to Azure I get an internal server error 500 and it fails to write the file when the function is called. This is my code snippet:
pList = {
'items': [
{
'assets': [
{
'kind': 'software-package',
'url': ipaUrl
},
{
'kind': 'display-image',
'needs-shine': False,
'url': imageUrl
}
],
'metadata': {
'bundle-identifier': bundleName,
'bundle-version': f'{versionName} ({buildName})',
'kind': 'software',
'title': appName
}
}
]
}
with open('list.plist', 'wb') as file:
plistlib.dump(pList, file)
Any suggestions? I am not sure if functions supports reading / writing to files when deployed so that may be my issue.
If your files can be temporary, you could use the temporary storage: https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-python?tabs=azurecli-linux%2Capplication-level#temporary-files
You can also access the root folder - but dependent on the type OS. https://azurelessons.com/how-to-access-azure-functions-wwwroot-folder/
If you need to permanently store the files, best to link your app to storage account (blob storage). (either with output binding or in the SDK) https://learn.microsoft.com/en-us/azure/azure-functions/functions-add-output-binding-storage-queue-vs-code?pivots=programming-language-python