Skip to content

Cloud Function Deployment Build Error  #257

@wk93210

Description

@wk93210

Bug Description

When using cloud-sql-go-connector as a dependency in vendor, can't run gcloud functions deploy due to build errors from cloud-sql-go-connector

Example code (or command)

<file>.go

package <pkg>

import (
    "cloud.google.com/go/cloudsqlconn"
)

// ...

go.mod

module github.com/<some>/<repo>

go 1.16

require (
	cloud.google.com/go/cloudsqlconn v0.5.0
)

Install as vendor

go mod vendor

Upload to Cloud Function

gcloud functions deploy <Func> \
    --quiet \
    --entry-point <Func> \
    --trigger-http  \
    --region us-central1 \
    --runtime go116 \
    --env-vars-file .env.production

Stacktrace

ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: src/<some>/<repo>/vendor/github.com/<other>/<repo>/<path>/<file>.go:11:2: /workspace/src/<some>/<repo>/vendor/cloud.google.com/go/cloudsqlconn/doc.go:1: cannot parse import comment; Error ID: 2f5e35a0

How to reproduce

  1. Put cloudsqlconn in go.mod
  2. Run go mod vendor
  3. Import cloudsqlconn in some code
  4. use gcloud functions deploy to deploy the code

Environment

  1. OS type and version:Description: Ubuntu 22.04 LTS
  2. Go version: go1.16.15 linux/arm64
  3. Connector version: v0.5.0

Metadata

Metadata

Assignees

Labels

priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions