Using private dependencies with Cloud Run functions
Stay organized with collections
Save and categorize content based on your preferences.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-21 UTC."],[[["Cloud Run functions can use packages from npm or Python repositories as dependencies."],["The Cloud Build service account is used to build and deploy Cloud Run functions, requiring specific permissions."],["If Cloud Run functions and Artifact Registry are in the same project, the service account automatically has the necessary download permissions."],["If in separate projects, you must grant the Cloud Build service account either the Artifact Registry Reader role for downloading dependencies or the Artifact Registry Writer role for uploading and downloading."],["Detailed configuration instructions for npm and Python dependencies can be found in the Cloud Run functions documentation."]]],[]]