dockergoamazon-ec2devopsbugsnag

https://sessions.bugsnag.com": x509: certificate signed by unknown authority


I have integrated bugsnag with my go-service, and it was working good on my local machine; but when I deployed it on server it giving the above error whenever bugsnag try to notify error.

I am deploying it on ec2 with docker container. after exploring Internet I have added below command to my docker file

RUN apk add --no-cache ca-certificates

but this also did not work for me

Below is simplified version of code I am using

package main

import (
    "fmt"
    "github.com/bugsnag/bugsnag-go/v2"
    "time"
)

func init() {
    ConfigureBugsnag()
}

func ConfigureBugsnag() {
    bugsnag.Configure(bugsnag.Configuration{
        APIKey:          "bugsnagKey",
        ReleaseStage:    "stage",
        ProjectPackages: []string{"main", "github.com/myapp"},
    })
}

func main() {

    bugsnag.Notify(fmt.Errorf("Test error"))

    time.Sleep(time.Hour)
}

this is working on local machine but giving the error on server


Solution

  • I don't have much explanation: but adding following in the Dockerfile, solved the issue

    RUN apk add -U --no-cache ca-certificates
    FROM scratch as final
    COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/