'GCP artifact registry cannot find a version that satisfies the requirement when using artifact registry in different GCP project

I am trying to add a custom package to a cloud function on GCP, I have the the right permission, and can import packages when I follow this tutorial in the same GCP project.

I cannot add artifact from an external GCP project, even if I give manually the role: Artifact Registry Reader to the service account deploying the cloud function.

I also posted an issue on the google cloud platform issue tracker



Solution 1:[1]

I believe this is working as expected, per official documentation.

If Cloud Functions and Artifact Registry are in different projects, you must grant repository access to the Cloud Build service account.

The Artifact Registry role needs to be given to the Cloud Build service account, and not to the Cloud Functions SA.

I know this is not the most intuitive thing to do :)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gourav B