Go on App Service is experimental and only supported Linux. Since you supplied a web.config, it seems like you're using a Windows based app service. Windows based images may not be correctly configured for Go; therefore, I advise redeploying to a Linux based app service instead. Feel free to reference this quick start guide.
azure deploy github action - GOLANG
I'm working on a project and I need to deploy this project to Azure7
I deploy the application using github actions and azure's web services, the deply is successfully performed, but when trying to make a request through the postman using the url that is generated in azure, I get the following error:
The specified CGI application encountered an error and the server terminated the process.
my code is made using Golang programming language.
here are the snippets of my code:
golang:
func main() {
dbload := Init()
h := OpenDB(dbload)
/*port := os.Getenv("HTTP_PLATFORM_PORT")
if port == "" {
port = "8080"
}*/
router := gin.Default()
router.POST("/webhook/sendgrid", h.sendgridWeb)
//router.GET("/ping", ping)
port := os.Getenv("HTTP_PLATFORM_PORT")
// default back to 8080 for local dev
if port == "" {
port = "8080"
}
router.Run("127.0.0.1:" + port)
}
build - web.config:
.github - workflows- go.yml
name: Build Go app and push to Azure
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19.4
- name: Build
run: go build -o build/go-app.exe -v
- name: Test
run: go test
- name: Deploy to Azure
uses: Azure/webapps-deploy@v2
with:
app-name: golang-webhook
package: build/
publish-profile: ${
my code only has the post method.
the deploy succeeds, but when performing a post request via postman using the link that azure provided me in the web-app , I get the error 502 (bad geteway)-
The specified CGI application encountered an error and the server terminated the process.
1 answer
Sort by: Most helpful
-
Ryan Hill 29,666 Reputation points Microsoft Employee
2023-01-11T13:40:55.5233333+00:00