It seems that MS Flow has no ability to properly check if an object exists.
Let's have an example with an out-of-the-box Approval action:
If an approver does not leave a comment and simply approvers or rejects - our code that tries to read the comments will fail.
Worarounds that do not work:
Using condition step with `empty(body('Start_Approval')['comments'])` Because it will still fail
using equals null: equals(body('Start_Approval')['comments'], null) This will also faild
using contains function: `if(contains(body('Start_single_approval'), '"comments": '), body('Start_single_approval')['comments'] ,'')` - Because word "comments" can appear in different properties and overall it's a bad practice
- Using Try-catch-finally scopes
Please, implement a proper function that will check if property of an object exists. Example: