Azure / Azure/azure-functions-powershell-worker
Improve error when input binding is missing
- Dominant language
- C#
- Stars
- 215
- Forks
- 61
- Avg merge
- 21h 4m
- Merged PRs (30d)
- 6
Description
If you have the default input binding for an Activity Function:
```
{
"bindings": [
{
"name": "name",
"type": "activityTrigger",
"direction": "in"
}
]
}
```
But the run.ps1 is expecting an input parameter of a different name (ie. $InputObject):
`param($triggerMetadata, $InputObject)`
Then a generic error is thrown when running the project in the local emulator:
```
[2021-06-28T14:36:50.295Z] Worker process started and initialized.
[2021-06-28T14:36:50.540Z] Worker failed to function id 8c711fde-95cf-4e73-b84a-4f39cb814df5.
[2021-06-28T14:36:50.542Z] Result: Failure
Exception: No parameter defined in the script or function for the input binding 'name'.
[2021-06-28T14:36:50.543Z] No input binding defined for the parameter 'InputObject' that is declared in the script or function.
[2021-06-28T14:36:50.544Z]
Stack: at Microsoft.Azure.Functions.PowerShellWorker.AzFunctionInfo..ctor(RpcFunctionMetadata metadata) in /home/vsts/work/1/s/src/FunctionInfo.cs:line 131
[2021-06-28T14:36:50.546Z] at Microsoft.Azure.Functions.PowerShellWorker.FunctionLoader.LoadFunction(FunctionLoadRequest request) in /home/vsts/work/1/s/src/FunctionLoader.cs:line 52
[2021-06-28T14:36:50.547Z] at Microsoft.Azure.Functions.PowerShellWorker.RequestProcessor.ProcessFunctionLoadRequest(StreamingMessage request) in /home/vsts/work/1/s/src/RequestProcessor.cs:line 222.
[2021-06-28T14:37:13.193Z] Host lock lease acquired by instance ID '0000000000000000000000004BCB02C4'.
```
**Expected:**
The error message should indicate the name of the function that failed to load. "function id 8c711fde-95cf-4e73-b84a-4f39cb814df5" as seen in the error message is not meaningful to me.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in src/FunctionInfo.cs at the AzFunctionInfo constructor and trace how the function-load error is assembled before reaching FunctionLoader.cs. Update the failure message to identify the function by name rather than only its function ID, then verify the resulting load error with the relevant function-loading tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp, powershell
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100