Using private dependencies with Cloud Run functions

You can use a package in an npm or Python repository as a dependency for a Cloud Run function.

Required permissions

Cloud Run functions uses the Cloud Build service account in the same Google Cloud project to build and deploy your function.

  • If Cloud Run functions and Artifact Registry are in the same Google Cloud project, the service account has the necessary permissions to download from repositories.
  • If Cloud Run functions and Artifact Registry are in different projects, you must grant repository access to the Cloud Build service account.
    • To provide read-only access for downloading dependencies, grant the Artifact Registry Reader role.
    • If you also use Cloud Build to upload artifacts to repositories, grant the Artifact Registry Writer role.

Configuring access to dependencies

See the Cloud Run functions documentation for npm and Python configuration instructions.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年11月24日 UTC.