Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud Functions deployment failure: Unable to retrieve the repository metadata #5244

Closed
baumstern opened this issue Nov 15, 2022 · 39 comments
Closed

Comments

@baumstern
Copy link

[REQUIRED] Environment info

firebase-tools: 11.15.0

Platform: macOS

[REQUIRED] Test case

[REQUIRED] Steps to reproduce

  1. Create a new Firebase project
  2. Upgrade to Blaze plan
  3. Login to owner account of a new project by running firebase login command
  4. Try to deploy Cloud Functions of https://github.com/quadratic-funding/mpc-phase2-suite/ by following command:
git clone https://github.com/quadratic-funding/mpc-phase2-suite/
cd mpc-phase2-suite
git checkout 7fcd2291b61d23d2665c597e500f8b705986913f
cd firebase
firebase deploy --only functions

[REQUIRED] Expected behavior

Successful deployment

[REQUIRED] Actual behavior

Failed to deploy 26 of 27 Cloud Functions. Service account of Cloud Functions doesn't had a proper permission to retrieve the repository metadata when it failing

"Unable to retrieve the repository metadata for projects/redacted/locations/us-central1/repositories/gcf-artifacts. Ensure that the Cloud Functions service account has 'artifactregistry.repositories.list' and 'artifactregistry.repositories.get' permissions. You can add the permissions by granting the role 'roles/artifactregistry.reader'."

CLI log:

$ firebase deploy --only functions


=== Deploying to 'redacted'...

i  deploying functions
Running command: yarn --prefix "$RESOURCE_DIR" build
yarn run v1.22.19
$ tsc
✨  Done in 2.08s.
✔  functions: Finished running predeploy script.
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
i  artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
⚠  artifactregistry: missing required API artifactregistry.googleapis.com. Enabling now...
⚠  functions: missing required API cloudbuild.googleapis.com. Enabling now...
⚠  functions: missing required API cloudfunctions.googleapis.com. Enabling now...
✔  functions: required API cloudfunctions.googleapis.com is enabled
✔  artifactregistry: required API artifactregistry.googleapis.com is enabled
✔  functions: required API cloudbuild.googleapis.com is enabled
i  functions: preparing codebase default for deployment
i  functions: Loaded environment variables from .env.
i  functions: preparing . directory for uploading...
i  functions: packaged /mpc-phase2-suite/firebase (103.99 KB) for uploading
i  functions: packaged /mpc-phase2-suite/firebase (104.2 KB) for uploading
i  functions: ensuring required API cloudscheduler.googleapis.com is enabled...
⚠  functions: missing required API cloudscheduler.googleapis.com. Enabling now...
✔  functions: required API cloudscheduler.googleapis.com is enabled
i  functions: ensuring required API run.googleapis.com is enabled...
i  functions: ensuring required API eventarc.googleapis.com is enabled...
i  functions: ensuring required API pubsub.googleapis.com is enabled...
i  functions: ensuring required API storage.googleapis.com is enabled...
⚠  functions: missing required API eventarc.googleapis.com. Enabling now...
⚠  functions: missing required API run.googleapis.com. Enabling now...
✔  functions: required API pubsub.googleapis.com is enabled
✔  functions: required API storage.googleapis.com is enabled
✔  functions: required API eventarc.googleapis.com is enabled
✔  functions: required API run.googleapis.com is enabled
i  functions: generating the service identity for pubsub.googleapis.com...
i  functions: generating the service identity for eventarc.googleapis.com...
✔  functions: . folder uploaded successfully
i  functions: creating Node.js 16 function checkAndPrepareCoordinatorForFinalization(us-central1)...
i  functions: creating Node.js 16 function checkAndRemoveBlockingContributor(us-central1)...
i  functions: creating Node.js 16 function checkIfObjectExist(us-central1)...
i  functions: creating Node.js 16 function checkParticipantForCeremony(us-central1)...
i  functions: creating Node.js 16 function completeMultiPartUpload(us-central1)...
i  functions: creating Node.js 16 function coordinateContributors(us-central1)...
i  functions: creating Node.js 16 function createBucket(us-central1)...
i  functions: creating Node.js 16 function finalizeCeremony(us-central1)...
i  functions: creating Node.js 16 function finalizeLastContribution(us-central1)...
i  functions: creating Node.js 16 function generateGetObjectPreSignedUrl(us-central1)...
i  functions: creating Node.js 16 function generatePreSignedUrlsParts(us-central1)...
i  functions: creating Node.js 16 function initEmptyWaitingQueueForCircuit(us-central1)...
i  functions: creating Node.js 16 function makeProgressToNextContribution(us-central1)...
i  functions: creating Node.js 16 function permanentlyStoreCurrentContributionTimeAndHash(us-central1)...
i  functions: creating Node.js 16 function processSignUpWithCustomClaims(us-central1)...
i  functions: creating Node.js 16 function progressToNextContributionStep(us-central1)...
i  functions: creating Node.js 16 function refreshParticipantAfterContributionVerification(us-central1)...
i  functions: creating Node.js 16 function registerAuthUser(us-central1)...
i  functions: creating Node.js 16 function resumeContributionAfterTimeoutExpiration(us-central1)...
i  functions: creating Node.js 16 function setupCeremony(us-central1)...
i  functions: creating Node.js 16 function startCeremony(us-central1)...
i  functions: creating Node.js 16 function startMultiPartUpload(us-central1)...
i  functions: creating Node.js 16 function stopCeremony(us-central1)...
i  functions: creating Node.js 16 function temporaryStoreCurrentContributionComputationTime(us-central1)...
i  functions: creating Node.js 16 function temporaryStoreCurrentContributionMultiPartUploadId(us-central1)...
i  functions: creating Node.js 16 function temporaryStoreCurrentContributionUploadedChunkData(us-central1)...
i  functions: creating Node.js 16 function verifycontribution(us-central1)...
⚠  functions: failed to create function projects/redacted/locations/us-central1/functions/checkAndPrepareCoordinatorForFinalization
Failed to create function projects/redacted/locations/us-central1/functions/checkAndPrepareCoordinatorForFinalization
✔  functions[verifycontribution(us-central1)] Successful create operation.

Cloud Functions side Log

Following is a log of checkAndPrepareCoordinatorForFinalization function:

protoPayload: {
@type: "type.googleapis.com/google.cloud.audit.AuditLog"
status: {
code: 7
message: "Unable to retrieve the repository metadata for projects/redacted/locations/us-central1/repositories/gcf-artifacts. Ensure that the Cloud Functions service account has 'artifactregistry.repositories.list' and 'artifactregistry.repositories.get' permissions. You can add the permissions by granting the role 'roles/artifactregistry.reader'."
}
authenticationInfo: {1}
requestMetadata: {4}
serviceName: "cloudfunctions.googleapis.com"
methodName: "google.cloud.functions.v1.CloudFunctionsService.CreateFunction"
authorizationInfo: [1]
resourceName: "projects/redacted/locations/us-central1/functions/checkAndPrepareCoordinatorForFinalization"
request: {
@type: "type.googleapis.com/google.cloud.functions.v1.CreateFunctionRequest"
function: {7}
location: "projects/redacted/locations/us-central1"
}
resourceLocation: {1}
}
receiveTimestamp: "2022-11-14T04:34:00.016225233Z"
resource: {2}
severity: "ERROR"
timestamp: "2022-11-14T04:33:59.205589Z"
@baumstern baumstern added the bug label Nov 15, 2022
@google-oss-bot
Copy link
Contributor

This issue does not seem to follow the issue template. Make sure you provide all the required information.

@baumstern baumstern changed the title Cloud Functions deployment failure Cloud Functions deployment failure: Unable to retrieve the repository metadata Nov 15, 2022
@MorelSerge
Copy link

Having the same issue

@taeold
Copy link
Contributor

taeold commented Nov 30, 2022

@gurrpi @Vluf Looking into the issue.

message: "Unable to retrieve the repository metadata for projects/redacted/locations/us-central1/repositories/gcf-artifacts. Ensure that the Cloud Functions service account has 'artifactregistry.repositories.list' and 'artifactregistry.repositories.get' permissions. You can add the permissions by granting the role 'roles/artifactregistry.reader'."

Since I'm having trouble reproducing the issue (which usually is the case for permission related problems), is this happening consistently on your function deploys? Or, maybe, is it happening when you are trying to deploy your functions on a fresh project?

If this is only affecting deployments to a relatively new project, I suspect the issue is because it takes time for GCP IAM permissions grants to propagate.

@taeold taeold added the Needs: Author Feedback Issues awaiting author feedback label Nov 30, 2022
@MorelSerge
Copy link

MorelSerge commented Nov 30, 2022 via email

@google-oss-bot
Copy link
Contributor

Hey @gurrpi. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@taeold
Copy link
Contributor

taeold commented Dec 9, 2022

@Vluf Great to hear. Closing the issue for now.

@gurrpi feel free to re-open or to open a new issue if you or others are continuing to see a problem.

@taeold taeold closed this as completed Dec 9, 2022
@dapealfy
Copy link

im having the same problem

@0xpussycat
Copy link

0xpussycat commented Jan 15, 2023

I have the same problem. I think it might be permission propagation problem as @taeold pointed out.

So, I left it for a few hours and went to delete the cloud function manually (https://console.cloud.google.com/functions/list ) and ran the command again and it is working now.

@mujtabashamas
Copy link

Found the exact same issue while deploying on a new project, deleting the function and redoing seems to fix the prob,

@risalfajar
Copy link

risalfajar commented Feb 10, 2023

I also have this problem, the function can't be deployed at all, so there's nothing to delete.

"HTTP Error: 403, Unable to retrieve the repository metadata for projects/project/locations/asia-southeast2/repositories/gcf-artifacts. Ensure that the Cloud Functions service account has 'artifactregistry.repositories.list' and 'artifactregistry.repositories.get' permissions. You can add the permissions by granting the role 'roles/artifactregistry.reader'."

I can't even find Cloud Functions service account in IAM. I've tried to grant Artifact Registry Reader to Cloud Services and Cloud Build principal, nothing works.

@baumstern
Copy link
Author

Kindly remind you that this issue persists. @joehan @taeold

@keepri
Copy link

keepri commented Mar 10, 2023

I'm having the same issue.

@google-oss-bot
Copy link
Contributor

Since there haven't been any recent updates here, I am going to close this issue.

@gurrpi if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

@joehan joehan assigned colerogers and unassigned TheIronDev, Berlioz and taeold Jun 13, 2023
@colerogers
Copy link
Contributor

@gabyshev can you try adding that role to the ${projectNumber}-compute@developer.gserviceaccount.com principal?

For those that are still running into this issue, does the error state exactly what the original poster listed?

"Unable to retrieve the repository metadata for projects/redacted/locations/us-central1/repositories/gcf-artifacts. Ensure that the Cloud Functions service account has 'artifactregistry.repositories.list' and 'artifactregistry.repositories.get' permissions. You can add the permissions by granting the role 'roles/artifactregistry.reader'."

@colerogers colerogers added Needs: Author Feedback Issues awaiting author feedback and removed closed-by-bot Needs: Attention labels Jun 13, 2023
@3210jr
Copy link

3210jr commented Jun 13, 2023

@colerogers yes same issue as originally listed. I finally got my deployments working again, not sure if there were updates on the firebase side of things but here are my steps to get it to work:

  1. Found out that my payment method had expired - so i just quickly updated and went back to blaze plan (problem still persisted after)
  2. Add the artifact registry permissions to firebase-sdk account
  3. Stopped using yarn and moved back to npm
  4. Upgraded node engine to node v 18.

Full disclosure, not sure which step was the one that got things to work, in a time crunch so just threw darts at the wall and hopped something would work :). It just did after step 4.

Thanks firebase-tools team for your continued maintenance of the project!

@risalfajar
Copy link

Try to open your Google Cloud Console and check the Billing page for payment problems.

Mine is because the monthly bill is below Credit Card minimum payment, so it's rejected in the Google Cloud. But in Firebase it stays in Blaze plan, weird.

Adding manual payment fixed my issue.

@google-oss-bot
Copy link
Contributor

Hey @gurrpi. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@google-oss-bot
Copy link
Contributor

Since there haven't been any recent updates here, I am going to close this issue.

@gurrpi if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

@nifrasismail
Copy link

I got the same issue, It is purely because of my payment method expired. I think the error message should be explanatory instead of saying permission issue

@blehn
Copy link

blehn commented Jul 8, 2023

I'm having issues deploying cloud functions. I'm on Blaze plan and payment info is up to date afaik. I'm at a loss because it was working fine previously. I've even started fresh, empty projects and I'm getting the same errors now. +1 to better error messages — these messages aren't very helpful. One error looks like this:

i  functions: creating Node.js 18 (2nd Gen) function firebase-frameworks-PROJECT:ssrPROJECTt(us-central1)...
Unable to retrieve the repository metadata for projects/PROJECT/locations/us-central1/repositories/gcf-artifacts. Ensure that the Cloud Functions service account has 'artifactregistry.repositories.list' and 'artifactregistry.repositories.get' permissions. You can add the permissions by granting the role 'roles/artifactregistry.reader'.

Functions deploy had errors with the following functions:
	firebase-frameworks-PROJECT:ssrPROJECT(us-central1)

The other is:

i  functions: updating Node.js 18 (2nd Gen) function firebase-frameworks-PROJECT:ssrPROJECT(us-central1)...
Build failed with status: FAILURE and message: ...-array@1.1.2 from lock file
npm ERR! Missing: @jridgewell/resolve-uri@3.1.0 from lock file
npm ERR! Missing: @jridgewell/sourcemap-codec@1.4.14 from lock file
npm ERR! Missing: dequal@2.0.3 from lock file
npm ERR! Missing: @types/estree@1.0.1 from lock file
npm ERR! Missing: mdn-data@2.0.30 from lock file
npm ERR! Missing: source-map-js@1.0.2 from lock file
npm ERR! Missing: esbuild@0.18.11 from lock file
npm ERR! Missing: fsevents@2.3.2 from lock file
npm ERR! Missing: postcss@8.4.25 from lock file
npm ERR! Missing: rollup@3.26.2 from lock file
npm ERR! Missing: @esbuild/android-arm@0.18.11 from lock file
npm ERR! Missing: @esbuild/android-arm64@0.18.11 from lock file
npm ERR! Missing: @esbuild/android-x64@0.18.11 from lock file
npm ERR! Missing: @esbuild/darwin-arm64@0.18.11 from lock file
npm ERR! Missing: @esbuild/darwin-x64@0.18.11 from lock file
npm ERR! Missing: @esbuild/freebsd-arm64@0.18.11 from lock file
npm ERR! Missing: @esbuild/freebsd-x64@0.18.11 from lock file
npm ERR! Missing: @esbuild/linux-arm@0.18.11 from lock file
npm ERR! Missing: @esbuild/linux-arm64@0.18.11 from lock file
npm ERR! Missing: @esbuild/linux-ia32@0.18.11 from lock file
npm ERR! Missing: @esbuild/linux-loong64@0.18.11 from lock file
npm ERR! Missing: @esbuild/linux-mips64el@0.18.11 from lock file
npm ERR! Missing: @esbuild/linux-ppc64@0.18.11 from lock file
npm ERR! Missing: @esbuild/linux-riscv64@0.18.11 from lock file
npm ERR! Missing: @esbuild/linux-s390x@0.18.11 from lock file
npm ERR! Missing: @esbuild/linux-x64@0.18.11 from lock file
npm ERR! Missing: @esbuild/netbsd-x64@0.18.11 from lock file
npm ERR! Missing: @esbuild/openbsd-x64@0.18.11 from lock file
npm ERR! Missing: @esbuild/sunos-x64@0.18.11 from lock file
npm ERR! Missing: @esbuild/win32-arm64@0.18.11 from lock file
npm ERR! Missing: @esbuild/win32-ia32@0.18.11 from lock file
npm ERR! Missing: @esbuild/win32-x64@0.18.11 from lock file
npm ERR! Missing: nanoid@3.3.6 from lock file
npm ERR! Missing: picocolors@1.0.0 from lock file
npm ERR! 
npm ERR! Clean install a project
npm ERR! 
npm ERR! Usage:
npm ERR! npm ci
npm ERR! 
npm ERR! Options:
npm ERR! [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
npm ERR! [-E|--save-exact] [-g|--global]
npm ERR! [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]
npm ERR! [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
npm ERR! [--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
npm ERR! [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
npm ERR! [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
npm ERR! [-ws|--workspaces] [--include-workspace-root] [--install-links]
npm ERR! 
npm ERR! aliases: clean-install, ic, install-clean, isntall-clean
npm ERR! 
npm ERR! Run "npm help ci" for more info

npm ERR! A complete log of this run can be found in:
npm ERR!     /www-data-home/.npm/_logs/2023-07-07T23_47_06_803Z-debug-0.log. For more details see the logs at https://console.cloud.google.com/cloud-build/builds;region=us-central1/1646035e-8f1c-43eb-9241-ba0094a50be1?project=PROJECT.

Functions deploy had errors with the following functions:
	firebase-frameworks-PROJECT:ssrPROJECTus-central1)

This is a SvelteKit web app and I'm using the experimental firebase tools inside of it with firebase init. I didn't add any cloud functions and yet when I deploy it tries and fails to create one anyway.

@baumstern
Copy link
Author

I got the same issue again:

⚠  functions: failed to create function projects/p0tion-new-workflow/locations/us-central1/functions/checkAndPrepareCoordinatorForFinalization
Failed to create function projects/p0tion-new-workflow/locations/us-central1/functions/checkAndPrepareCoordinatorForFinalization
Unable to retrieve the repository metadata for projects/p0tion-new-workflow/locations/us-central1/repositories/gcf-artifacts. Ensure that the Cloud Functions service account has 'artifactregistry.repositories.list' and 'artifactregistry.repositories.get' permissions. You can add the permissions by granting the role 'roles/artifactregistry.reader'.

@nicain
Copy link

nicain commented Jul 12, 2023

Same issue for me too. Somebody tell that bot to stop closing this issue!!

@gunner-venus
Copy link

I have the same issue now. The thing is the firebase deploy works until this week. There was no updates on the firebase project setting or codebase.

[2023-07-14T01:31:46.538Z] <<< [apiv2][body] POST https://cloudfunctions.googleapis.com/v1/projects/selftable-store-dev/locations/us-central1/functions {"error":{"code":403,"message":"Unable to retrieve the repository metadata for projects/selftable-store-dev/locations/us-central1/repositories/gcf-artifacts. Ensure that the Cloud Functions service account has 'artifactregistry.repositories.list' and 'artifactregistry.repositories.get' permissions. You can add the permissions by granting the role 'roles/artifactregistry.reader'.","status":"PERMISSION_DENIED"}}
! functions: failed to create function projects/selftable-store-dev/locations/us-central1/functions/getCurrentDateTime

@MaxXx1313
Copy link

It might help to use 'Blaze' plan. I think this had solved my issue

@gunner-venus
Copy link

I have the same issue now. The thing is the firebase deploy works until this week. There was no updates on the firebase project setting or codebase.

[2023-07-14T01:31:46.538Z] <<< [apiv2][body] POST https://cloudfunctions.googleapis.com/v1/projects/selftable-store-dev/locations/us-central1/functions {"error":{"code":403,"message":"Unable to retrieve the repository metadata for projects/selftable-store-dev/locations/us-central1/repositories/gcf-artifacts. Ensure that the Cloud Functions service account has 'artifactregistry.repositories.list' and 'artifactregistry.repositories.get' permissions. You can add the permissions by granting the role 'roles/artifactregistry.reader'.","status":"PERMISSION_DENIED"}}
! functions: failed to create function projects/selftable-store-dev/locations/us-central1/functions/getCurrentDateTime

I checked the Blaze plan and noticed the credit card setting was incorrect. After fixing the credit card issue, it works well.

@PikabobAlex
Copy link

I have the same issue now. The thing is the firebase deploy works until this week. There was no updates on the firebase project setting or codebase.

[2023-07-14T01:31:46.538Z] <<< [apiv2][body] POST https://cloudfunctions.googleapis.com/v1/projects/selftable-store-dev/locations/us-central1/functions {"error":{"code":403,"message":"Unable to retrieve the repository metadata for projects/selftable-store-dev/locations/us-central1/repositories/gcf-artifacts. Ensure that the Cloud Functions service account has 'artifactregistry.repositories.list' and 'artifactregistry.repositories.get' permissions. You can add the permissions by granting the role 'roles/artifactregistry.reader'.","status":"PERMISSION_DENIED"}}
! functions: failed to create function projects/selftable-store-dev/locations/us-central1/functions/getCurrentDateTime

I checked the Blaze plan and noticed the credit card setting was incorrect. After fixing the credit card issue, it works well.

It happened to me when I changing the email in SendMail extension. When I save my config it prompt the same error to me. Glad you giving the right direction. Much appreciate.

@innomatica
Copy link

I had the same issue, not related to Blaze plan nor credit card issue. It said

Ensure that the Cloud Functions service account has 'artifactregistry.repositories.list'
and  'artifactregistry.repositories.get' permissions. You can add the permissions by 
granting the role  'roles/artifactregistry.reader'.

As some one put it above, I just tried it again. Then it worked. Don't know why.

@codingiswhyicry
Copy link

Same issue as above, trying to deploy with a configured Blaze plan and updated payment method. Debug logs say:

"original": {
"name": "FirebaseError",
"children": [],
"context": {
"function": "projects/faura-db/locations/us-central1/functions/helloWorld"
},
"exit": 1,
"message": "Failed to create function projects/faura-db/locations/us-central1/functions/helloWorld",
"original": {
"name": "FirebaseError",
"children": [],
"context": {
"body": {
"error": {
"code": 403,
"message": "Unable to retrieve the repository metadata for projects/faura-db/locations/us-central1/repositories/gcf-artifacts. Ensure that the Cloud Functions service account has 'artifactregistry.repositories.list' and 'artifactregistry.repositories.get' permissions. You can add the permissions by granting the role 'roles/artifactregistry.reader'.",
"status": "PERMISSION_DENIED"
}
},
"response": {
"statusCode": 403
}
},
"exit": 1,
"message": "HTTP Error: 403, Unable to retrieve the repository metadata for projects/faura-db/locations/us-central1/repositories/gcf-artifacts. Ensure that the Cloud Functions service account has 'artifactregistry.repositories.list' and 'artifactregistry.repositories.get' permissions. You can add the permissions by granting the role 'roles/artifactregistry.reader'.",
"status": 403
},
"status": 403,
"code": 403
}
}
[2023-09-16T14:57:02.714Z] Error: Failed to create function helloWorld in region us-central1
at /Users/amandasouthworth/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:51:11
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Fabricator.createV1Function (/Users/amandasouthworth/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:181:32)
at async Fabricator.createEndpoint (/Users/amandasouthworth/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:133:13)
at async handle (/Users/amandasouthworth/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:88:17)

Error: There was an error deploying functions

@jacobsandlund
Copy link

jacobsandlund commented May 1, 2024

I'm getting this same issue. It seems to happen on some functions and not others, and I have no idea why, given they both use the same service account. I've also successfully deployed this project before.

I've tried:

  • deleting the function and trying again
  • setting the roles/artifactregistry.reader on all the service accounts in the project.
  • setting the roles/artifactregistry.createOnPushRepoAdmin on the firebase-service-account@firebase-sa-management.iam.gserviceaccount.com account, and then all service accounts.
  • confirming I'm on the blaze plan.
  • confirming that payment details are up to date.
  • wiping out the gcf-artifacts in the artifact registry (last thing I tried)

Edit: Okay, this is really strange. I edited the function group to add in one of the function definitions from one of the function groups that deploys successfully. This unsuccessful function group used to have just an auth.user() builder, and now I added a firestore.document() builder, and it works. Removing that added function definition again causes it to fail.

Edit: Figured this out. We're using Terraform and set some IAM permissions with google_project_iam_binding and that removed some permissions from a Google created service account that wasn't visible on the IAM page: service-${google_project_number}@gcf-admin-robot.iam.gserviceaccount.com needed the roles/cloudfunctions.serviceAgent role.

@Zeeshan-Mehdi110
Copy link

Zeeshan-Mehdi110 commented May 17, 2024

same error here:
node version 10,
3 years old project:
"error": {
"code": 403,
"message": "Unable to retrieve the repository metadata for projects/projectid/locations/us-central1/repositories/gcf-artifacts. Ensure that the Cloud Functions service account has 'artifactregistry.repositories.list' and 'artifactregistry.repositories.get' permissions. You can add the permissions by granting the role 'roles/artifactregistry.reader'.",
"status": "PERMISSION_DENIED"
}

      functions: Unhandled error cleaning up build images. This could result in a small monthly bill if not corrected. You can attempt to delete these images by redeploying or you can delete them manually at
    https://console.cloud.google.com/artifacts/docker/projectid/us-central1/gcf-artifacts
    https://console.cloud.google.com/gcr/images/projectid/us/gcf

@ctsanjuan
Copy link

Same problem as described. If i reapply same resource google_cloudfunctions_function again it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests