It turned out, that I had a couple of functions defined before calling microsoftTeams.app.initialize()
<script type="text/javascript">
function function1() { document.getElementById("title").innerText = "Title"; }
function function2() { document.getElementById("Summary").innerText = "Summary"; }
microsoftTeams.app.initialize().then( function() { ... } );
I moved these functions declaration after calling microsoftTeams.app.initialize()
and the rest of the code - and it started to work
<script type="text/javascript">
microsoftTeams.app.initialize().then( function() { ... } );
...
function function1() { document.getElementById("title").innerText = "Title"; }
function function2() { document.getElementById("Summary").innerText = "Summary"; }
</script>