Artifact Registry returning 404 for private Go module

I am using GCP Artifact Registry to store a private Go module. The module is automatically uploaded by Cloud Build when a git push is performed. The upload is successful each time, and I can see the resulting output in Artifact Registry.

Example:
enter image description here

The package path used in my program exactly matches what Artifact Registry shows:

enter image description here

When I try to run go mod tidy in a project that calls this private module on my local cli, a 404 error is returned from Artifact Registry. I am logged into Google Cloud on my local cli with an account that should have ample permissions to perform this – however I’d expect a 401, if it were lack of permissions.

Full output:

$ go mod tidy
go: finding module for package australia-southeast1-go.pkg.dev/<PROJECT>/commonlibs/common
go: finding module for package australia-southeast1-go.pkg.dev/<PROJECT>/commonlibs/http
go: adminpanel imports
        australia-southeast1-go.pkg.dev/<PROJECT>/commonlibs/common: cannot find module providing package australia-southeast1-go.pkg.dev/<PROJECT>/commonlibs/common: unrecognized import path "australia-southeast1-go.pkg.dev/<PROJECT>/commonlibs/common": reading https://australia-southeast1-go.pkg.dev/<PROJECT>/commonlibs/common?go-get=1: 404 Not Found
<repeated for each module>

A simple go get returns a 404 error also:

$ go get australia-southeast1-go.pkg.dev/<PROJECT>/commonlibs 
go: unrecognized import path "australia-southeast1-go.pkg.dev/<PROJECT>/commonlibs": reading https://australia-southeast1-go.pkg.dev/<PROJECT>/commonlibs?go-get=1: 404 Not Found

The golang in the program that is importing the above libraries looks like:

package main

import (
    <standard imports removed>

    commonhttp "australia-southeast1-go.pkg.dev/<PROJECT>/commonlibs/http"
)

<code removed>

Another example from another file in the program:

package main

import (
    <removed modules>

    config "australia-southeast1-go.pkg.dev/<PROJECT>/commonlibs/config"
    db "australia-southeast1-go.pkg.dev/<PROJECT>/commonlibs/db"
)

The commonlibs structure is as follows:

$ tree .
.
├── cloudbuild.yaml
├── common
│   └── common.go
├── commonlibs.go
├── config
│   ├── config.go
│   └── structs.go
├── db
│   └── db.go
├── go.mod
├── go.sum
├── http
│   └── http.go
├── network
│   └── network.go
├── rabbitmq
│   └── rabbitmq.go
└── slack
    └── slack.go

This seems to match the suggested structure defined in the golang documentation.

In the commonlibs module the go.mod looks like:

module australia-southeast1-go.pkg.dev/<PROJECT>/commonlibs

go 1.21.5

require (
        <removed list>
)

require (
        <removed list>
)

I have tried to resolve this by following the provided documentation on using private go modules from Artifact Repository however as the demonstration uses a path like example.com/module I’m not actually sure if I’m using the wrong path or URL to access my private module.

This question is similar to my issue, however I’m having the problem locally whereas that question did not.

I have tried with all forms and combinations of env variables, for example the following each on their own, all together. Tried refreshing auth tokens also as per the example, however no combination seems to help.

export GOOS=linux
export GONOSUMDB=australia-southeast1-go.pkg.dev/<PROJECT>/*
export GOPROXY=https://australia-southeast1-go.pkg.dev/<PROJECT>/commonlibs,https://proxy.golang.org,direct
export GONOPROXY=github.com/GoogleCloudPlatform/artifact-registry-go-tools,australia-southeast1-go.pkg.dev/<PROJECT>/commonlibs
export GOPROXY=proxy.golang.org go run github.com/GoogleCloudPlatform/artifact-registry-go-tools/cmd/[email protected] refresh

So, I’m kinda stuck and stumped. As far as I know, this should work as presented.
I’m open to suggestions of things to try, or if I’ve made an obvious error (likely) please point it out 🙂

New contributor

GoCoder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật