encore icon indicating copy to clipboard operation
encore copied to clipboard

"could not find package" build fail with AWS-V2 and dependents

Open theGlenn opened this issue 1 year ago • 2 comments

On deploy encore build fails with could not find package "github.com/aws/aws-sdk-go-v2/service/s3"

The same failure occurs with dependent package gocloud.dev/blob

Sources for reproducibility

AWS-SDK V2

import (
	"github.com/aws/aws-sdk-go-v2/service/s3"
)

type fileStorageClient struct {
	s3 *s3.Client
}

Stack

test build step initializing
── Error ──────────────────────────────────────────────────────────────[E0003]──

err: exit status 1: stderr: go: downloading
github.com/aws/aws-sdk-go-v2/service/s3 v1.50.1

"level":"info","dir":"/.cache/go-cacher","time":"2024-02-20T11:10:19Z","message":"using
default cache dir"}

"level":"debug","base_url":"http://127.0.0.1:43001","time":"2024-02-20T11:10:19Z","message":"using
http cacheprog server"}
go: downloading github.com/aws/aws-sdk-go-v2 v1.25.0
go: downloading github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.0
go: downloading github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.0
go: downloading github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.0
go: downloading github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding
v1.11.0
go: downloading github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.0
go: downloading github.com/aws/aws-sdk-go-v2/service/internal/presigned-url
v1.11.0
go: downloading github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.0
go: downloading github.com/aws/smithy-go v1.20.0
go: downloading github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.0
go: downloading github.com/google/go-cmp v0.5.9
go: updates to go.mod needed; to update it:
	go mod tidy

╭─[Stack Trace]
├─▶ pkginfo.(*Loader).resolveModuleForPkg            [email protected]/v2/internals/pkginfo/modresolve.go:175
├─▶ pkginfo.(*Loader).LoadPkg                        [email protected]/v2/internals/pkginfo/loader.go:183
├─▶ pkginfo.(*Loader).MustLoadPkg                    [email protected]/v2/internals/pkginfo/loader.go:136
├─▶ pkginfo.(*FileNames).resolveImportPath.func1.1.1 [email protected]/v2/internals/pkginfo/names.go:766
├─▶ sync.(*Once).doSlow                              sync/once.go:74
├─▶ sync.(*Once).Do                                  sync/once.go:65
╰─[... remaining frames omitted ...]

── Error ──────────────────────────────────────────────────────────────[E0003]──

could not find package "github.com/aws/aws-sdk-go-v2/service/s3"

go cloud

package files

import (
	"github.com/pkg/errors"
	"gocloud.dev/blob"
)

type fileStorageClient struct {
	bucketURL  string
}

...

func (c *fileStorageClient) openBucket(ctx context.Context) (*blob.Bucket, error) {
	bucket, err := blob.OpenBucket(ctx, c.bucketURL)
	if err != nil {
		return nil, errors.Wrap(err, "failed to open bucket")
	}
	return bucket, nil
}

Stack

compile build step initializing
compiling application
── Error ──────────────────────────────────────────────────────────────[E0003]──

err: exit status 1: stderr: go: downloading gocloud.dev v0.36.0
go: updates to go.mod needed; to update it:
	go mod tidy

╭─[Stack Trace]
├─▶ pkginfo.(*Loader).resolveModuleForPkg            [email protected]/v2/internals/pkginfo/modresolve.go:175
├─▶ pkginfo.(*Loader).LoadPkg                        [email protected]/v2/internals/pkginfo/loader.go:183
├─▶ pkginfo.(*Loader).MustLoadPkg                    [email protected]/v2/internals/pkginfo/loader.go:136
├─▶ pkginfo.(*FileNames).resolveImportPath.func1.1.1 [email protected]/v2/internals/pkginfo/names.go:766
├─▶ sync.(*Once).doSlow                              sync/once.go:74
├─▶ sync.(*Once).Do                                  sync/once.go:65
╰─[... remaining frames omitted ...]

── Error ──────────────────────────────────────────────────────────────[E0003]──

could not find package "gocloud.dev/blob"

theGlenn avatar Feb 20 '24 12:02 theGlenn

Thanks @theGlenn for the detailed report! Will try to reproduce.

eandre avatar Feb 20 '24 20:02 eandre

Update this seems to work fine with cgo_enabled:true

theGlenn avatar Feb 22 '24 17:02 theGlenn