部署

时间:2019-02-19 14:46:20

标签: go google-cloud-platform google-cloud-functions

我正在尝试部署Go cloud功能。我已成功将此功能部署到一个GCP项目,但是现在当尝试将其部署到另一个GCP项目时,似乎无法部署它。

我使用此命令来部署功能:

gcloud functions deploy Generator --entry-point Generator --memory 512MB --region europe-west1 --runtime go111 --trigger-event google.storage.object.finalize --trigger-resource gs://[redacted].appspot.com --project [redacted]

我在部署时正在使用go.mod:

module gitlab.com/[redacted]/[redacted]/[redacted]

require (
    cloud.google.com/go v0.35.1
    firebase.google.com/go v3.6.0+incompatible
    github.com/tdewolff/parse/v2 v2.3.5
    golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3
    golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2
    google.golang.org/api v0.1.0
)

我收到此错误消息,该消息在有趣的地方被截断,所以我看不到实际的问题是什么(我认为)。

ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: go: finding github.com/tdewolff/parse/v2 v2.3.5
go: finding golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3
go: finding google.golang.org/api v0.1.0
go: finding golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2
go: finding cloud.google.com/go v0.35.1
go: finding firebase.google.com/go v3.6.0+incompatible
go: finding github.com/tdewolff/test v1.0.0
go: finding golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3
go: finding github.com/BurntSushi/toml v0.3.1
go: finding google.golang.org/genproto v0.0.0-20190122154452-ba6ebe99b011
go: finding golang.org/x/sync v0.0.0-20181108010431-42b317875d0f
go: finding github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c
go: finding github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57
go: finding golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890
go: finding google.golang.org/grpc v1.17.0
go: finding github.com/googleapis/gax-go/v2 v2.0.3
go: finding github.com/golang/mock v1.2.0
go: finding golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b
go: finding github.com/golang/protobuf v1.2.0
go: finding go.opencensus.io v0.18.0
go: finding honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a
go: finding golang.org/x/time v0.0.0-20181108054448-85acf8d2951c
go: finding golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d
go: finding github.com/google/martian v2.1.0+incompatible
go: finding google.golang.org/grpc v1.16.0
go: finding honnef.co/go/tools v0.0.0-20180728063816-88497007e858
go: finding cloud.google.com/go v0.26.0
go: finding golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
go: finding golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e
go: finding github.com/golang/mock v1.1.1
go: finding github.com/client9/misspell v0.3.4
go: finding google.golang.org/genproto v0.0.0-20180831171423-11092d34479b
go: finding github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273
go: finding github.com/ghodss/yaml v1.0.0
go: finding gopkg.in/yaml.v2 v2.2.1
go: finding github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
go: finding golang.org/x/net v0.0.0-20180826012351-8a410e7b638d
go: finding google.golang.org/appengine v1.3.0
go: finding golang.org/x/sys v0.0.0-20180830151530-49385e6e1522
go: finding github.com/matttproud/golang_protobuf_extensions v1.0.1
go: finding github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e
go: finding github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1
go: finding github.com/google/go-cmp v0.2.0
go: finding github.com/davecgh/go-spew v1.1.1
go: finding github.com/shurcooL/httperror v0.0.0-20170206035902-86b7830d14cc
go: finding github.com/stretchr/testify v1.2.2
go: finding golang.org/x/sys v0.0.0-20181029174526-d69651ed3497
go: finding github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371
go: finding github.com/google/go-github v17.0.0+incompatible
go: finding google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf
go: finding github.com/kisielk/gotool v1.0.0
go: finding github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b
go: finding github.com/shurcooL/htmlg v0.0.0-20170918183704-d01228ac9e50
go: finding github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e
go: finding google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898
go: finding golang.org/x/net v0.0.0-20181106065722-10aee1819953
go: finding golang.org/x/net v0.0.0-20181029044818-c44066c5c816
go: finding golang.org/x/lint v0.0.0-20180702182130-06c8688daad7
go: finding github.com/prometheus/client_golang v0.8.0
go: finding github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568
go: finding github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d
go: finding github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470
go: finding github.com/openzipkin/zipkin-go v0.1.1
go: finding golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852
go: finding github.com/gliderlabs/ssh v0.1.1
go: finding go4.org v0.0.0-20180809161055-417644f6feb5
go: finding dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0
go: finding golang.org/x/text v0.3.0
go: finding gi

如何获得部署功能?

1 个答案:

答案 0 :(得分:1)

与Google联系后,我发现了问题所在。

问题是由Google Cloud Functions包装器中的4096个字符的错误字符数限制和Google实施的go mod下载的人工超时造成的。

可以通过提供您的依赖项来解决此问题,如下所示:https://cloud.google.com/functions/docs/writing/specifying-dependencies-go#using_a_vendor_directory