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

huangapple go评论83阅读模式
英文:

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

问题

我已经将bugsnag与我的Go服务集成在一起,在我的本地机器上运行良好;但是当我将其部署到服务器上时,每当bugsnag尝试通知错误时,它都会出现上述错误。

我正在使用ec2和docker容器进行部署。
在浏览互联网后,我在我的docker文件中添加了以下命令:

RUN apk add --no-cache ca-certificates

但这对我也没有起作用。

下面是我正在使用的代码的简化版本

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)
}

这在本地机器上工作正常,但在服务器上出现错误。

英文:

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

答案1

得分: 0

我没有太多解释:
但是在Dockerfile中添加以下内容可以解决问题:

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

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/

huangapple
  • 本文由 发表于 2022年8月31日 23:29:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/73558329.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定