Azure / Azure/azure-functions-powershell-worker
SendGrid error when used in durable Orchestrator function
- Dominant language
- C#
- Stars
- 215
- Forks
- 61
- Avg merge
- 21h 4m
- Merged PRs (30d)
- 6
Description
I'm not sure if I'm doing something wrong, but to test this issue I created a new function project. I added a durable http starter function, an orchestrator function, and the SendGrid function all using the command palette templates.
When I run this function locally and call the endpoint to kick off an orchestrator instance, the SendGrid function successfully sends an email. However, when the orchestrator does its "replay" immediately after that function executes, it generates an exception saying ERROR: Value cannot be null. (Parameter 'input'). I'm not sure how this is possible. It shouldn't be trying to execute again, since the replay should remember that it already did. Also, the 'input' (which for testing I just set to 'Hello') is definitely not null.
See codebelow and the attached error message.
I updated my Orchestrator run.ps1 to this:
```
param($Context)
Write-Host "Hello from SendGrid activity!"
Invoke-DurableActivity -FunctionName 'SendGrid' -Input 'Test'
```
My SendGrid run.ps1 is below:
```
param($email, $TriggerMetadata)
Push-OutputBinding -Name 'Message' -Value (@{
subject = "Thanks for your order $($email)!"
content = @(@{
type = 'text/plain'
value = "Hi, thanks for your order!"
})
})
```
SendGrid's function.json (email addresses removed for privacy):
```
{
"bindings": [
{
"type": "activityTrigger",
"name": "email",
"direction": "in"
},
{
"type": "sendGrid",
"name": "message",
"direction": "out",
"apiKey": "SEND_GRID_API_KEY",
"from": "x",
"to": "x",
"subject": "Test"
}
]
}
```
[Error Message.txt](https://github.com/Azure/azure-functions-powershell-worker/files/11368733/Error.Message.txt)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.