Skip to content

Commit

Permalink
skip deferred binding for cosmos trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
liliankasem committed Jan 11, 2023
1 parent 11a0add commit a6e4d8e
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,15 @@ protected override async Task<Collection<ParameterDescriptor>> GetFunctionParame
{
var bindings = inputBindings.Union(outputBindings);

// If an input or output binding uses expressions, we do not want to use ParameterBindingData for the trigger bindings
if (triggerMetadata.SupportsDeferredBinding())
{
bool skipDeferredBinding = BindingAttributeContainsExpression(bindings);
if (skipDeferredBinding)
// If an input or output binding uses expressions, we do not want to use ParameterBindingData for the trigger bindings
bool containsExpression = BindingAttributeContainsExpression(bindings);

// If the trigger is a CosmosDBTrigger, we do not want to use ParameterBindingData as it is not supported
bool isCosmosTrigger = IsCosmosDBTrigger(triggerMetadata);

if (containsExpression || isCosmosTrigger)
{
triggerMetadata.Properties.Add(ScriptConstants.SkipDeferredBindingKey, true);
}
Expand Down Expand Up @@ -135,5 +139,10 @@ internal bool BindingAttributeContainsExpression(IEnumerable<FunctionBinding> bi

return false;
}

internal bool IsCosmosDBTrigger(BindingMetadata triggerMetadata)
{
return triggerMetadata.Type == "cosmosDBTrigger" ? true : false;
}
}
}

0 comments on commit a6e4d8e

Please sign in to comment.