I wrote an azure function to change the prefixes of tasks in Wrike using APIs for the events TaskParentsAdded, TaskParentsRemoved, TaskCustomFieldChanged. The code works as expected when I run the code locally, but when I deploy it to Azure it gives me this error "Error: error "syntaxError: Unexpected token "',"'/home/Log"...is not valid JSON" occurred while parsing the response body - '/home/LogFiles/' not found.." under the connect to Log Stream folder. I have attached the function I think is the problem.
@app.route(route=MAIN_ROUTE, auth_level=func.AuthLevel.ANONYMOUS)
def main(req, context):
#Retrieve the payload from the request
try:
#this should apply in production
payload = req.get_json()
except:
try:
#this should apply during testing
payload = req.params
except:
payload = {}
logging.info(f'Got request: {payload}')
I tried changing my logging configuration, my endpoint URL, which made it unable to run in the emulator.
host.Json
If the error still occurs same at the deployment stage, then try to remove the
fileLoggingModeconfiguration.The Azure Function will not attempt to write logs to the file system. Instead, it will rely on the Application Insights integration for logging.
Function app -
__init__.pyOutput: