title: CosmosDB output binding not updating database
body: <p>In a TypeScript functions project, I built an HTTP triggered function that reads item data from CosmosDB using and input binding and tries to update the items using an output binding.</p>
  <p>The expected flow is:</p>
  <p>HTTP trigger -&gt; function execution &amp; read item from DB via input binding -&gt; update or create item via output binding -&gt; return HTTP response (JSON)</p>
  <p>Function code:</p>
  <pre><code>const httpTrigger: AzureFunction = async function (
      context: Context,
      req: HttpRequest,
      productItem: any,
      productToUpdate: any
  ): Promise&lt;void&gt; {
      context.log('HTTP trigger function processed a request.');
      
      productToUpdate = JSON.stringify({
          &quot;id&quot; : productItem.id,
          &quot;name&quot; : &quot;Changed by output binding&quot;
      })
      
      context.res = {
          status: 200,
          body: {
              id: context.bindingData.productId,
              name: &quot;Updated product&quot;
          }
      };
  
  };
  </code></pre>
  <p>If I trigger the function at <code>/api/products/1234</code> it will execute correctly and <code>productItem</code> is read from my DB and contains the item information with ID &quot;1234&quot;:</p>
  <p><a href="https://i.stack.imgur.com/VhrJF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VhrJF.png" alt="enter image description here" /></a></p>
  <p>The change to <code>productToUpdate</code> however, has no effect. The DB content remains unchanged. I tried to use both <code>JSON.stringify()</code> and a plain object <code>{ &quot;id&quot;: ... }</code>.</p>
  <p>There is no error message and no indication about a failing operation.
  What am I doing wrong? How can I debug this issue?</p>
  <p>For reference, here's my binding information in function.json:</p>
  <pre><code>{
    &quot;bindings&quot;: [
      {
        &quot;authLevel&quot;: &quot;anonymous&quot;,
        &quot;type&quot;: &quot;httpTrigger&quot;,
        &quot;direction&quot;: &quot;in&quot;,
        &quot;name&quot;: &quot;req&quot;,
        &quot;methods&quot;: [
          &quot;get&quot;,
          &quot;post&quot;
        ],
        &quot;route&quot;: &quot;product/{productId}&quot;
      },
      {
        &quot;type&quot;: &quot;http&quot;,
        &quot;direction&quot;: &quot;out&quot;,
        &quot;name&quot;: &quot;res&quot;
      },
      {
        &quot;type&quot;: &quot;cosmosDB&quot;,
        &quot;direction&quot;: &quot;in&quot;,
        &quot;name&quot;: &quot;productItem&quot;,
        &quot;databaseName&quot;: &quot;maindb&quot;,
        &quot;collectionName&quot;: &quot;products&quot;,
        &quot;connectionStringSetting&quot;: &quot;CosmosDbConnectionString&quot;,
        &quot;id&quot;: &quot;{productId}&quot;,
        &quot;partitionKey&quot;: &quot;{productId}&quot;
      },
      {
        &quot;type&quot;: &quot;cosmosDB&quot;,
        &quot;direction&quot;: &quot;out&quot;,
        &quot;name&quot;: &quot;productToUpdate&quot;,
        &quot;databaseName&quot;: &quot;maindb&quot;,
        &quot;collectionName&quot;: &quot;products&quot;,
        &quot;createIfNotExists&quot;: &quot;false&quot;,
        &quot;connectionStringSetting&quot;: &quot;CosmosDbConnectionString&quot;
      }
    ],
    &quot;scriptFile&quot;: &quot;../dist/products/index.js&quot;
  }
  </code></pre>