Hi @Ken Just-Ken,
Follow below steps to create Function App with Custom as runtime stack:
Prerequisites:
- Upgrade/Downgrade Visual Studio Code version to
1.98.1
. I have tested the same and it worked. - Azure Function Core tools version:
4.0.6821
. - go version: go1.23.6 windows/amd64.
Steps to create function app with custom handler:
- Open Visual Studio Code, Click on
Azure=> Function icon
=>SelectCreate function App in Azure
. - Provide a unique function App name.
- Select
Function runtime: Custom handler
andFunction extension version: ~4
.
- Select required location.
- This creates all the resources required to run GO custom handler function in Azure.
Make sure the Functions Runtime is set to custom in App Settings under Function App=>Settings=>Environment Variables
.
Run below commands before deploying the function:
set GOOS=linux
set GOARCH=amd64
go build handler.go
- Add handler.exe in host.json:
host.json:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[4.*, 5.0.0)"
},
"customHandler": {
"description": {
"defaultExecutablePath": "handler.exe",
"workingDirectory": "",
"arguments": []
},
"enableForwardingHttpRequest": true
}
}
- Deploy GO custom handler to Azure function app.
- Run the deployed function in Portal:
Update:
Ken Just-Ken Thank you for your patience and for sharing your feedback on the Q&A community platform. I appreciate you sharing your findings! Your contribution is valuable and can help others in the community facing similar challenges.
As per the Microsoft Q&A community policy, "The question author cannot accept their own answer. They can only accept answers by others"
I’m reposting your workaround as solution here so you can mark it as accepted:
As an alternative, you can create function app with custom handler by selecting
Create Function app in Azure(Advanced)
in visual studio code:
Provide unique name for function app and select subscription, pricing plan and custom handler
as the runtime stack:
If you have any other questions, please let me know. Thank you again for your time and patience throughout this issue.
Please don’t forget to Accept Answer
and Yes
for "was this answer helpful" wherever the information provided helps you, this can be beneficial to other community members.