We have an alerting system that sends out messages, however the status of the alert (success/failure) is contained within a .txt attachment on the email. I am attempting to create a flow that will send me a notification based on the presence of the word "failed" in the text of the attachment.
with the exact condition of: @contains(base64ToString(items('Apply_to_each')?['ContentBytes']), 'failed')
This results in the following error:
InvalidTemplate. Unable to process template language expressions for action 'Condition at line '1' and column '2394: 'The template language function baseo4ToString expects its parameter to be a string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#base64ToString for usage details.'.
Removing the conversion from base64tostring only causes the error to change to the following:
InvalidTemplate. Unable to process template language expressions for action 'Condition at line '1' and column '2394' : 'The template language function 'contains' expects its first argument 'collection' to be a dictionary (object), an array or a string. The provided value is of type 'Null'.'.
Based on this, I believe I am incorrectly requesting the attachment contents from Flow. The attachment I am testing with is a basic ASCII text file with no special characters or affectations created on a Windows PC using VSCode. I do not believe there is anything unique about the text file I am using to cause this behavior.
What error am I making in the way I am fetching the content of the email attachment?