Skip to content

Commit a0cd194

Browse files
authored
EventGrid Trigger execution failed in azure portal (Azure#29824)
1 parent 4973d43 commit a0cd194

File tree

4 files changed

+37
-7
lines changed

4 files changed

+37
-7
lines changed

sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/CHANGELOG.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
# Release History
22

3-
## 3.3.0-beta.1 (Unreleased)
4-
5-
### Features Added
6-
7-
### Breaking Changes
3+
## 3.2.1 (2022-08-17)
84

95
### Bugs Fixed
106

11-
### Other Changes
7+
- EventGrid Trigger execution failed in azure portal.
128

139
## 3.2.0 (2022-04-20)
1410

sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/src/EventGridExtensionConfigProvider.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public void Initialize(ExtensionConfigContext context)
8585
.AddConverter<JToken, string>(jtoken => jtoken.ToString(Formatting.Indented))
8686
.AddConverter<JToken, string[]>(jarray => jarray.Select(ar => ar.ToString(Formatting.Indented)).ToArray())
8787
.AddConverter<JToken, DirectInvokeString>(jtoken => new DirectInvokeString(null))
88+
.AddConverter<DirectInvokeString, JToken>(directInvokeString => JToken.Parse(directInvokeString.Value))
8889
.AddConverter<JToken, EventGridEvent>(jobject => EventGridEvent.Parse(new BinaryData(jobject.ToString()))) // surface the type to function runtime
8990
.AddConverter<JToken, EventGridEvent[]>(jobject => EventGridEvent.ParseMany(new BinaryData(jobject.ToString())))
9091
.AddConverter<JToken, CloudEvent>(jobject => CloudEvent.Parse(new BinaryData(jobject.ToString())))

sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/src/Microsoft.Azure.WebJobs.Extensions.EventGrid.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
44
<Description>This extension adds bindings for EventGrid</Description>
5-
<Version>3.3.0-beta.1</Version>
5+
<Version>3.2.1</Version>
66
<!--The ApiCompatVersion is managed automatically and should not generally be modified manually.-->
77
<ApiCompatVersion>3.2.0</ApiCompatVersion>
88
<NoWarn>$(NoWarn);AZC0001;CS1591</NoWarn>

sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/tests/JobhostEndToEnd.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,26 @@ public async Task ConsumeCloudEventTest(string functionName)
158158
_functionOut = null;
159159
}
160160

161+
[Theory]
162+
[TestCase("DirectInvocation.TestString", "StringDataEvent")]
163+
[TestCase("DirectInvocation.TestEventGridEvent", "EventGridEvent")]
164+
public async Task ConsumeDirectInvocation(string functionName, string argument)
165+
{
166+
string value = (string)(typeof(FakeData)).GetField(argument).GetValue(null);
167+
168+
JObject eve = JObject.Parse(value);
169+
var args = new Dictionary<string, object>{
170+
{ "value", value }
171+
};
172+
173+
var expectOut = (string)eve["subject"];
174+
var host = TestHelpers.NewHost<DirectInvocation>();
175+
176+
await host.GetJobHost().CallAsync(functionName, args);
177+
Assert.AreEqual(_functionOut, expectOut);
178+
_functionOut = null;
179+
}
180+
161181
[Theory]
162182
[TestCase("TriggerParamResolve.TestJObject", "EventGridEvent", @"https://shunsouthcentralus.blob.core.windows.net/debugging/shunBlob.txt")]
163183
[TestCase("TriggerParamResolve.TestString", "StringDataEvent", "goodBye world")]
@@ -878,6 +898,19 @@ public void JObjectEvents([EventGrid(TopicEndpointUri = "eventgridUri", TopicKey
878898
}
879899
}
880900
}
901+
902+
public class DirectInvocation
903+
{
904+
public static void TestString([EventGridTrigger] string value)
905+
{
906+
_functionOut = (string)JObject.Parse(value)["subject"];
907+
}
908+
909+
public static void TestEventGridEvent([EventGridTrigger] EventGridEvent value)
910+
{
911+
_functionOut = value.Subject;
912+
}
913+
}
881914
}
882915

883916
#pragma warning disable SA1402

0 commit comments

Comments
 (0)