Skip to content

Firebase function redeploy error after re-setting secrets #6453

Closed

Description

@maroshvarchola

[REQUIRED] Environment info

firebase-tools: 12.6.2

Platform: macOS (tried also Ubuntu)

[REQUIRED] Test case

Create firebase project, enable firebase functions, create firebase functions source code that in some way uses secrets. Set secrets, deploy functions.

[REQUIRED] Steps to reproduce

  1. Set firebase functions secrets with firebase functions:secrets:set
  2. Deploy functions that are using that secrets
  3. Set secrets again, when asked if needed to redeploy and destroy stale version, type yes

[REQUIRED] Expected behavior

It should set secrets, then deploy functions and then when secrets are set again, it should redeploy correctly.

[REQUIRED] Actual behavior

First set of secrets is working ok, then functions deployment its ok, but when you will try to re-set secrets, it will ask you if you want to redeploy functions, when you will reply yes, It will create this error:

marosvarchola@Maross-MacBook-Pro glassfinder-firebase-functions % firebase functions:secrets:set ALGOLIA_ID        
? Enter a value for ALGOLIA_ID [hidden]
✔  Created a new secret version projects/129938725887/secrets/ALGOLIA_ID/versions/7
i  2 functions are using stale version of secret ALGOLIA_ID:
        onGlassesUpdateIndexAlgolia(europe-west3)
        rebuildGlassesIndex(europe-west3)
? Do you want to re-deploy the functions and destroy the stale version of secret ALGOLIA_ID? Yes
i  Updating function onGlassesUpdateIndexAlgolia(europe-west3)...
i  Updating function rebuildGlassesIndex(europe-west3)...
⚠  functions: HTTP Error: 400, Validation failed for trigger projects/glass-finder-c5b53/locations/europe-west3/triggers/onglassesupdateindexalgolia-785296: The request was invalid: invalid argument: event type google.cloud.firestore.document.v1.written not supported: attribute topic not found within event type
⚠  functions:  failed to update function projects/glass-finder-c5b53/locations/europe-west3/functions/onGlassesUpdateIndexAlgolia

Error: Failed to update function projects/glass-finder-c5b53/locations/europe-west3/functions/onGlassesUpdateIndexAlgolia

Logs:

marosvarchola@Maross-MacBook-Pro glassfinder-firebase-functions % firebase --debug functions:secrets:set ALGOLIA_ID
[2023-10-16T20:52:03.508Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2023-10-16T20:52:03.509Z] > authorizing via signed-in user ([email protected])
[2023-10-16T20:52:03.513Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/glass-finder-c5b53/services/secretmanager.googleapis.com [none]
[2023-10-16T20:52:03.513Z] >>> [apiv2][(partial)header] GET https://serviceusage.googleapis.com/v1/projects/glass-finder-c5b53/services/secretmanager.googleapis.com x-goog-quota-user=projects/glass-finder-c5b53
[2023-10-16T20:52:04.529Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/glass-finder-c5b53/services/secretmanager.googleapis.com 200
[2023-10-16T20:52:04.530Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/glass-finder-c5b53/services/secretmanager.googleapis.com [omitted]
[2023-10-16T20:52:04.530Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2023-10-16T20:52:04.530Z] > authorizing via signed-in user ([email protected])
[2023-10-16T20:52:04.530Z] [iam] checking project glass-finder-c5b53 for permissions ["firebase.projects.get","secretmanager.secrets.create","secretmanager.secrets.get","secretmanager.secrets.update","secretmanager.versions.add"]
[2023-10-16T20:52:04.531Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/glass-finder-c5b53:testIamPermissions [none]
[2023-10-16T20:52:04.531Z] >>> [apiv2][(partial)header] POST https://cloudresourcemanager.googleapis.com/v1/projects/glass-finder-c5b53:testIamPermissions x-goog-quota-user=projects/glass-finder-c5b53
[2023-10-16T20:52:04.531Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/glass-finder-c5b53:testIamPermissions {"permissions":["firebase.projects.get","secretmanager.secrets.create","secretmanager.secrets.get","secretmanager.secrets.update","secretmanager.versions.add"]}
[2023-10-16T20:52:05.273Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/glass-finder-c5b53:testIamPermissions 200
[2023-10-16T20:52:05.273Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/glass-finder-c5b53:testIamPermissions {"permissions":["firebase.projects.get","secretmanager.secrets.create","secretmanager.secrets.get","secretmanager.secrets.update","secretmanager.versions.add"]}
[2023-10-16T20:52:05.275Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/glass-finder-c5b53 [none]
[2023-10-16T20:52:05.567Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/glass-finder-c5b53 200
[2023-10-16T20:52:05.568Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/glass-finder-c5b53 {"projectId":"glass-finder-c5b53","projectNumber":"129938725887","displayName":"glassfinder","name":"projects/glass-finder-c5b53","resources":{"hostingSite":"glass-finder-c5b53","storageBucket":"glass-finder-c5b53.appspot.com","locationId":"europe-west3"},"state":"ACTIVE","etag":"1_42359ff0-a4e9-43c6-a5e3-00c33a1b76ea"}
[2023-10-16T20:52:05.569Z] >>> [apiv2][query] GET https://secretmanager.googleapis.com/v1/projects/glass-finder-c5b53/secrets/ALGOLIA_ID [none]
[2023-10-16T20:52:05.867Z] <<< [apiv2][status] GET https://secretmanager.googleapis.com/v1/projects/glass-finder-c5b53/secrets/ALGOLIA_ID 200
[2023-10-16T20:52:05.867Z] <<< [apiv2][body] GET https://secretmanager.googleapis.com/v1/projects/glass-finder-c5b53/secrets/ALGOLIA_ID {"name":"projects/129938725887/secrets/ALGOLIA_ID","replication":{"automatic":{}},"createTime":"2023-08-29T22:12:58.913994Z","labels":{"firebase-managed":"true"},"etag":"\"1604171d14a0ca\""}
? Enter a value for ALGOLIA_ID [hidden]
[2023-10-16T20:52:08.905Z] >>> [apiv2][query] POST https://secretmanager.googleapis.com/v1/projects/glass-finder-c5b53/secrets/ALGOLIA_ID:addVersion [none]
[2023-10-16T20:52:08.905Z] >>> [apiv2][body] POST https://secretmanager.googleapis.com/v1/projects/glass-finder-c5b53/secrets/ALGOLIA_ID:addVersion {"payload":{"data":"dGVzdA=="}}
[2023-10-16T20:52:10.833Z] <<< [apiv2][status] POST https://secretmanager.googleapis.com/v1/projects/glass-finder-c5b53/secrets/ALGOLIA_ID:addVersion 200
[2023-10-16T20:52:10.833Z] <<< [apiv2][body] POST https://secretmanager.googleapis.com/v1/projects/glass-finder-c5b53/secrets/ALGOLIA_ID:addVersion {"name":"projects/129938725887/secrets/ALGOLIA_ID/versions/8","createTime":"2023-10-16T20:52:10.697490Z","state":"ENABLED","replicationStatus":{"automatic":{}},"etag":"\"1607db947cb712\""}
✔  Created a new secret version projects/129938725887/secrets/ALGOLIA_ID/versions/8 
[2023-10-16T20:52:10.834Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/glass-finder-c5b53/services/cloudfunctions.googleapis.com [none]
[2023-10-16T20:52:10.834Z] >>> [apiv2][(partial)header] GET https://serviceusage.googleapis.com/v1/projects/glass-finder-c5b53/services/cloudfunctions.googleapis.com x-goog-quota-user=projects/glass-finder-c5b53
[2023-10-16T20:52:11.741Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/glass-finder-c5b53/services/cloudfunctions.googleapis.com 200
[2023-10-16T20:52:11.741Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/glass-finder-c5b53/services/cloudfunctions.googleapis.com [omitted]
[2023-10-16T20:52:11.742Z] >>> [apiv2][query] GET https://cloudfunctions.googleapis.com/v1/projects/glass-finder-c5b53/locations/-/functions [none]
[2023-10-16T20:52:12.268Z] <<< [apiv2][status] GET https://cloudfunctions.googleapis.com/v1/projects/glass-finder-c5b53/locations/-/functions 200
[2023-10-16T20:52:12.269Z] <<< [apiv2][body] GET https://cloudfunctions.googleapis.com/v1/projects/glass-finder-c5b53/locations/-/functions {}
[2023-10-16T20:52:12.270Z] >>> [apiv2][query] GET https://cloudfunctions.googleapis.com/v2/projects/glass-finder-c5b53/locations/-/functions filter=environment%3D%22GEN_2%22
[2023-10-16T20:52:12.959Z] <<< [apiv2][status] GET https://cloudfunctions.googleapis.com/v2/projects/glass-finder-c5b53/locations/-/functions 200
[2023-10-16T20:52:12.960Z] <<< [apiv2][body] GET https://cloudfunctions.googleapis.com/v2/projects/glass-finder-c5b53/locations/-/functions {"functions":[{"name":"projects/glass-finder-c5b53/locations/europe-west3/functions/onGlassesUpdateIndexAlgolia","buildConfig":{"build":"projects/129938725887/locations/europe-west3/builds/33f35c85-f074-4389-aff7-de898731d94a","runtime":"nodejs18","entryPoint":"onGlassesUpdateIndexAlgolia","source":{"storageSource":{"bucket":"gcf-v2-sources-129938725887-europe-west3","object":"onGlassesUpdateIndexAlgolia/function-source.zip","generation":"1697488932765117"}},"environmentVariables":{"GOOGLE_NODE_RUN_SCRIPTS":""},"sourceProvenance":{"resolvedStorageSource":{"bucket":"gcf-v2-sources-129938725887-europe-west3","object":"onGlassesUpdateIndexAlgolia/function-source.zip","generation":"1697488932765117"}},"dockerRegistry":"ARTIFACT_REGISTRY"},"serviceConfig":{"service":"projects/glass-finder-c5b53/locations/europe-west3/services/onglassesupdateindexalgolia","timeoutSeconds":60,"environmentVariables":{"FIREBASE_CONFIG":"{\"projectId\":\"glass-finder-c5b53\",\"storageBucket\":\"glass-finder-c5b53.appspot.com\",\"locationId\":\"europe-west3\"}","GCLOUD_PROJECT":"glass-finder-c5b53","EVENTARC_CLOUD_EVENT_SOURCE":"projects/glass-finder-c5b53/locations/europe-west3/services/onGlassesUpdateIndexAlgolia","FUNCTION_SIGNATURE_TYPE":"cloudevent","FUNCTION_TARGET":"onGlassesUpdateIndexAlgolia"},"maxInstanceCount":100,"ingressSettings":"ALLOW_ALL","uri":"https://onglassesupdateindexalgolia-4byka4px4a-ey.a.run.app","serviceAccountEmail":"[email protected]","availableMemory":"256Mi","allTrafficOnLatestRevision":true,"secretEnvironmentVariables":[{"key":"ALGOLIA_ID","projectId":"glass-finder-c5b53","secret":"ALGOLIA_ID","version":"6"},{"key":"ALGOLIA_ADMIN_KEY","projectId":"glass-finder-c5b53","secret":"ALGOLIA_ADMIN_KEY","version":"3"}],"revision":"onglassesupdateindexalgolia-00003-xeb","maxInstanceRequestConcurrency":80,"availableCpu":"1"},"eventTrigger":{"trigger":"projects/glass-finder-c5b53/locations/europe-west3/triggers/onglassesupdateindexalgolia-758719","triggerRegion":"europe-west3","eventType":"google.cloud.firestore.document.v1.written","eventFilters":[{"attribute":"database","value":"(default)"},{"attribute":"namespace","value":"(default)"},{"attribute":"document","value":"glasses/{glassesId}","operator":"match-path-pattern"}],"pubsubTopic":"projects/glass-finder-c5b53/topics/eventarc-europe-west3-onglassesupdateindexalgolia-758719-658","serviceAccountEmail":"[email protected]","retryPolicy":"RETRY_POLICY_DO_NOT_RETRY"},"state":"ACTIVE","updateTime":"2023-10-16T20:43:30.860238706Z","labels":{"deployment-tool":"cli-firebase","firebase-functions-hash":"6a6dd5ccfd56712594d36f967acb274b079e8a14"},"environment":"GEN_2","url":"https://europe-west3-glass-finder-c5b53.cloudfunctions.net/onGlassesUpdateIndexAlgolia"},{"name":"projects/glass-finder-c5b53/locations/europe-west3/functions/rebuildGlassesIndex","buildConfig":{"build":"projects/129938725887/locations/europe-west3/builds/65c53802-cf6c-483f-a91e-d9e32349b465","runtime":"nodejs18","entryPoint":"rebuildGlassesIndex","source":{"storageSource":{"bucket":"gcf-v2-sources-129938725887-europe-west3","object":"rebuildGlassesIndex/function-source.zip","generation":"1697489076192893"}},"environmentVariables":{"GOOGLE_NODE_RUN_SCRIPTS":""},"sourceProvenance":{"resolvedStorageSource":{"bucket":"gcf-v2-sources-129938725887-europe-west3","object":"rebuildGlassesIndex/function-source.zip","generation":"1697489076192893"}},"dockerRegistry":"ARTIFACT_REGISTRY"},"serviceConfig":{"service":"projects/glass-finder-c5b53/locations/europe-west3/services/rebuildglassesindex","timeoutSeconds":60,"environmentVariables":{"FIREBASE_CONFIG":"{\"projectId\":\"glass-finder-c5b53\",\"storageBucket\":\"glass-finder-c5b53.appspot.com\",\"locationId\":\"europe-west3\"}","GCLOUD_PROJECT":"glass-finder-c5b53","EVENTARC_CLOUD_EVENT_SOURCE":"projects/glass-finder-c5b53/locations/europe-west3/services/rebuildGlassesIndex","FUNCTION_TARGET":"rebuildGlassesIndex"},"maxInstanceCount":100,"ingressSettings":"ALLOW_ALL","uri":"https://rebuildglassesindex-4byka4px4a-ey.a.run.app","serviceAccountEmail":"[email protected]","availableMemory":"256Mi","allTrafficOnLatestRevision":true,"secretEnvironmentVariables":[{"key":"ALGOLIA_ID","projectId":"glass-finder-c5b53","secret":"ALGOLIA_ID","version":"7"},{"key":"ALGOLIA_ADMIN_KEY","projectId":"glass-finder-c5b53","secret":"ALGOLIA_ADMIN_KEY","version":"3"}],"revision":"rebuildglassesindex-00006-wed","maxInstanceRequestConcurrency":80,"availableCpu":"1"},"state":"ACTIVE","updateTime":"2023-10-16T20:45:42.289911901Z","labels":{"deployment-callable":"true","firebase-functions-hash":"6a6dd5ccfd56712594d36f967acb274b079e8a14","deployment-tool":"cli-firebase"},"environment":"GEN_2","url":"https://europe-west3-glass-finder-c5b53.cloudfunctions.net/rebuildGlassesIndex"}]}
i  2 functions are using stale version of secret ALGOLIA_ID:
        onGlassesUpdateIndexAlgolia(europe-west3)
        rebuildGlassesIndex(europe-west3) 
? Do you want to re-deploy the functions and destroy the stale version of secret ALGOLIA_ID? Yes
i  Updating function onGlassesUpdateIndexAlgolia(europe-west3)... 
i  Updating function rebuildGlassesIndex(europe-west3)... 
[2023-10-16T20:52:15.331Z] >>> [apiv2][query] PATCH https://cloudfunctions.googleapis.com/v2/projects/glass-finder-c5b53/locations/europe-west3/functions/onGlassesUpdateIndexAlgolia updateMask=name%2CbuildConfig.runtime%2CbuildConfig.entryPoint%2CbuildConfig.source.storageSource.bucket%2CbuildConfig.source.storageSource.object%2CbuildConfig.source.storageSource.generation%2CbuildConfig.environmentVariables%2CserviceConfig.environmentVariables%2CserviceConfig.secretEnvironmentVariables%2CserviceConfig.ingressSettings%2CserviceConfig.timeoutSeconds%2CserviceConfig.serviceAccountEmail%2CserviceConfig.availableMemory%2CserviceConfig.maxInstanceCount%2CserviceConfig.maxInstanceRequestConcurrency%2CserviceConfig.availableCpu%2Clabels%2CeventTrigger.eventType%2CeventTrigger.retryPolicy%2CeventTrigger.eventFilters%2CeventTrigger.triggerRegion%2CbuildConfig.buildEnvironmentVariables
[2023-10-16T20:52:15.332Z] >>> [apiv2][body] PATCH https://cloudfunctions.googleapis.com/v2/projects/glass-finder-c5b53/locations/europe-west3/functions/onGlassesUpdateIndexAlgolia {"name":"projects/glass-finder-c5b53/locations/europe-west3/functions/onGlassesUpdateIndexAlgolia","buildConfig":{"runtime":"nodejs18","entryPoint":"onGlassesUpdateIndexAlgolia","source":{"storageSource":{"bucket":"gcf-v2-sources-129938725887-europe-west3","object":"onGlassesUpdateIndexAlgolia/function-source.zip","generation":"1697488932765117"}},"environmentVariables":{"GOOGLE_NODE_RUN_SCRIPTS":""}},"serviceConfig":{"environmentVariables":{"FIREBASE_CONFIG":"{\"projectId\":\"glass-finder-c5b53\",\"storageBucket\":\"glass-finder-c5b53.appspot.com\",\"locationId\":\"europe-west3\"}","GCLOUD_PROJECT":"glass-finder-c5b53","EVENTARC_CLOUD_EVENT_SOURCE":"projects/glass-finder-c5b53/locations/europe-west3/services/onGlassesUpdateIndexAlgolia","FUNCTION_SIGNATURE_TYPE":"cloudevent","FUNCTION_TARGET":"onGlassesUpdateIndexAlgolia"},"secretEnvironmentVariables":[{"key":"ALGOLIA_ID","projectId":"glass-finder-c5b53","secret":"ALGOLIA_ID","version":"8"},{"key":"ALGOLIA_ADMIN_KEY","projectId":"glass-finder-c5b53","secret":"ALGOLIA_ADMIN_KEY","version":"3"}],"ingressSettings":"ALLOW_ALL","timeoutSeconds":60,"serviceAccountEmail":"[email protected]","availableMemory":"256Mi","maxInstanceCount":100,"maxInstanceRequestConcurrency":80,"availableCpu":"1"},"labels":{"deployment-tool":"cli-firebase","firebase-functions-hash":"6a6dd5ccfd56712594d36f967acb274b079e8a14"},"eventTrigger":{"eventType":"google.cloud.firestore.document.v1.written","retryPolicy":"RETRY_POLICY_DO_NOT_RETRY","eventFilters":[{"attribute":"topic","value":"projects/glass-finder-c5b53/topics/eventarc-europe-west3-onglassesupdateindexalgolia-758719-658"}],"triggerRegion":"europe-west3"}}
[2023-10-16T20:52:15.335Z] >>> [apiv2][query] PATCH https://cloudfunctions.googleapis.com/v2/projects/glass-finder-c5b53/locations/europe-west3/functions/rebuildGlassesIndex updateMask=name%2CbuildConfig.runtime%2CbuildConfig.entryPoint%2CbuildConfig.source.storageSource.bucket%2CbuildConfig.source.storageSource.object%2CbuildConfig.source.storageSource.generation%2CbuildConfig.environmentVariables%2CserviceConfig.environmentVariables%2CserviceConfig.secretEnvironmentVariables%2CserviceConfig.ingressSettings%2CserviceConfig.timeoutSeconds%2CserviceConfig.serviceAccountEmail%2CserviceConfig.availableMemory%2CserviceConfig.maxInstanceCount%2CserviceConfig.maxInstanceRequestConcurrency%2CserviceConfig.availableCpu%2Clabels%2CbuildConfig.buildEnvironmentVariables
[2023-10-16T20:52:15.335Z] >>> [apiv2][body] PATCH https://cloudfunctions.googleapis.com/v2/projects/glass-finder-c5b53/locations/europe-west3/functions/rebuildGlassesIndex {"name":"projects/glass-finder-c5b53/locations/europe-west3/functions/rebuildGlassesIndex","buildConfig":{"runtime":"nodejs18","entryPoint":"rebuildGlassesIndex","source":{"storageSource":{"bucket":"gcf-v2-sources-129938725887-europe-west3","object":"rebuildGlassesIndex/function-source.zip","generation":"1697489076192893"}},"environmentVariables":{"GOOGLE_NODE_RUN_SCRIPTS":""}},"serviceConfig":{"environmentVariables":{"FIREBASE_CONFIG":"{\"projectId\":\"glass-finder-c5b53\",\"storageBucket\":\"glass-finder-c5b53.appspot.com\",\"locationId\":\"europe-west3\"}","GCLOUD_PROJECT":"glass-finder-c5b53","EVENTARC_CLOUD_EVENT_SOURCE":"projects/glass-finder-c5b53/locations/europe-west3/services/rebuildGlassesIndex","FUNCTION_TARGET":"rebuildGlassesIndex"},"secretEnvironmentVariables":[{"key":"ALGOLIA_ID","projectId":"glass-finder-c5b53","secret":"ALGOLIA_ID","version":"8"},{"key":"ALGOLIA_ADMIN_KEY","projectId":"glass-finder-c5b53","secret":"ALGOLIA_ADMIN_KEY","version":"3"}],"ingressSettings":"ALLOW_ALL","timeoutSeconds":60,"serviceAccountEmail":"[email protected]","availableMemory":"256Mi","maxInstanceCount":100,"maxInstanceRequestConcurrency":80,"availableCpu":"1"},"labels":{"deployment-callable":"true","firebase-functions-hash":"6a6dd5ccfd56712594d36f967acb274b079e8a14","deployment-tool":"cli-firebase"}}
[2023-10-16T20:52:16.248Z] <<< [apiv2][status] PATCH https://cloudfunctions.googleapis.com/v2/projects/glass-finder-c5b53/locations/europe-west3/functions/onGlassesUpdateIndexAlgolia 400
[2023-10-16T20:52:16.248Z] <<< [apiv2][body] PATCH https://cloudfunctions.googleapis.com/v2/projects/glass-finder-c5b53/locations/europe-west3/functions/onGlassesUpdateIndexAlgolia {"error":{"code":400,"message":"Validation failed for trigger projects/glass-finder-c5b53/locations/europe-west3/triggers/onglassesupdateindexalgolia-149467: The request was invalid: invalid argument: event type google.cloud.firestore.document.v1.written not supported: attribute topic not found within event type","status":"INVALID_ARGUMENT"}}
⚠  functions: HTTP Error: 400, Validation failed for trigger projects/glass-finder-c5b53/locations/europe-west3/triggers/onglassesupdateindexalgolia-149467: The request was invalid: invalid argument: event type google.cloud.firestore.document.v1.written not supported: attribute topic not found within event type 
⚠  functions:  failed to update function projects/glass-finder-c5b53/locations/europe-west3/functions/onGlassesUpdateIndexAlgolia 
[2023-10-16T20:52:16.257Z] <<< [apiv2][status] PATCH https://cloudfunctions.googleapis.com/v2/projects/glass-finder-c5b53/locations/europe-west3/functions/rebuildGlassesIndex 200
[2023-10-16T20:52:16.257Z] <<< [apiv2][body] PATCH https://cloudfunctions.googleapis.com/v2/projects/glass-finder-c5b53/locations/europe-west3/functions/rebuildGlassesIndex {"name":"projects/glass-finder-c5b53/locations/europe-west3/operations/operation-1697489535509-607db94c62433-e8c39cbc-99e34fff","metadata":{"@type":"type.googleapis.com/google.cloud.functions.v2.OperationMetadata","createTime":"2023-10-16T20:52:16.245575623Z","target":"projects/glass-finder-c5b53/locations/europe-west3/functions/rebuildGlassesIndex","verb":"update","cancelRequested":false,"apiVersion":"v2"},"done":false}
[2023-10-16T20:52:16.258Z] >>> [apiv2][query] GET https://cloudfunctions.googleapis.com/v2/projects/glass-finder-c5b53/locations/europe-west3/operations/operation-1697489535509-607db94c62433-e8c39cbc-99e34fff [none]
[2023-10-16T20:52:16.370Z] FirebaseError: HTTP Error: 400, Validation failed for trigger projects/glass-finder-c5b53/locations/europe-west3/triggers/onglassesupdateindexalgolia-149467: The request was invalid: invalid argument: event type google.cloud.firestore.document.v1.written not supported: attribute topic not found within event type
    at responseToError (/opt/homebrew/Cellar/firebase-cli/12.6.2/libexec/lib/node_modules/firebase-tools/lib/responseToError.js:49:12)
    at RetryOperation._fn (/opt/homebrew/Cellar/firebase-cli/12.6.2/libexec/lib/node_modules/firebase-tools/lib/apiv2.js:285:77)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Error: Failed to update function projects/glass-finder-c5b53/locations/europe-west3/functions/onGlassesUpdateIndexAlgolia
[2023-10-16T20:52:16.370Z] Error Context: {
  "function": "projects/glass-finder-c5b53/locations/europe-west3/functions/onGlassesUpdateIndexAlgolia"
}
[2023-10-16T20:52:16.436Z] <<< [apiv2][status] GET https://cloudfunctions.googleapis.com/v2/projects/glass-finder-c5b53/locations/europe-west3/operations/operation-1697489535509-607db94c62433-e8c39cbc-99e34fff 200
[2023-10-16T20:52:16.437Z] <<< [apiv2][body] GET https://cloudfunctions.googleapis.com/v2/projects/glass-finder-c5b53/locations/europe-west3/operations/operation-1697489535509-607db94c62433-e8c39cbc-99e34fff {"name":"projects/glass-finder-c5b53/locations/europe-west3/operations/operation-1697489535509-607db94c62433-e8c39cbc-99e34fff","metadata":{"@type":"type.googleapis.com/google.cloud.functions.v2.OperationMetadata","createTime":"2023-10-16T20:52:16.245575623Z","target":"projects/glass-finder-c5b53/locations/europe-west3/functions/rebuildGlassesIndex","verb":"update","cancelRequested":false,"apiVersion":"v2","requestResource":{"@type":"type.googleapis.com/google.cloud.functions.v2.Function","name":"projects/glass-finder-c5b53/locations/europe-west3/functions/rebuildGlassesIndex","buildConfig":{"runtime":"nodejs18","entryPoint":"rebuildGlassesIndex","source":{"storageSource":{"bucket":"gcf-v2-sources-129938725887-europe-west3","object":"rebuildGlassesIndex/function-source.zip","generation":"1697489536219710"}},"environmentVariables":{"GOOGLE_NODE_RUN_SCRIPTS":""},"sourceProvenance":{"resolvedStorageSource":{"bucket":"gcf-v2-sources-129938725887-europe-west3","object":"rebuildGlassesIndex/function-source.zip","generation":"1697489076192893"}},"dockerRegistry":"ARTIFACT_REGISTRY"},"serviceConfig":{"service":"projects/glass-finder-c5b53/locations/europe-west3/services/rebuildglassesindex","timeoutSeconds":60,"environmentVariables":{"FIREBASE_CONFIG":"{\"projectId\":\"glass-finder-c5b53\",\"storageBucket\":\"glass-finder-c5b53.appspot.com\",\"locationId\":\"europe-west3\"}","GCLOUD_PROJECT":"glass-finder-c5b53","EVENTARC_CLOUD_EVENT_SOURCE":"projects/glass-finder-c5b53/locations/europe-west3/services/rebuildGlassesIndex","FUNCTION_TARGET":"rebuildGlassesIndex"},"maxInstanceCount":100,"ingressSettings":"ALLOW_ALL","uri":"https://rebuildglassesindex-4byka4px4a-ey.a.run.app","serviceAccountEmail":"[email protected]","availableMemory":"256Mi","allTrafficOnLatestRevision":true,"secretEnvironmentVariables":[{"key":"ALGOLIA_ID","projectId":"glass-finder-c5b53","secret":"ALGOLIA_ID","version":"8"},{"key":"ALGOLIA_ADMIN_KEY","projectId":"glass-finder-c5b53","secret":"ALGOLIA_ADMIN_KEY","version":"3"}],"revision":"rebuildglassesindex-00006-wed","maxInstanceRequestConcurrency":80,"availableCpu":"1"},"state":"ACTIVE","labels":{"deployment-callable":"true","firebase-functions-hash":"6a6dd5ccfd56712594d36f967acb274b079e8a14","deployment-tool":"cli-firebase"},"environment":"GEN_2","url":"https://europe-west3-glass-finder-c5b53.cloudfunctions.net/rebuildGlassesIndex"},"stages":[{"name":"BUILD","state":"NOT_STARTED"},{"name":"SERVICE","state":"NOT_STARTED"}]},"done":false}

Please, provide at least some option to allow not re-deploying functions, just setting new secrets. We need it in CI/CD so it is not problem for us to redeploy functions after new secret values.

Activity

  1. aalej commented on Oct 18, 2023

    @aalej
    Contributor

    Hi @mvarchdev, sorry to hear that you encountered this issue and thanks for reporting this to us. I’m able to reproduce the error when deploying a v2 Cloud Firestore trigger. Just to make sure we’re on the same page, are you also encountering the issue when deploying a v2 function or are you deploying a v1 function?

    I’ll notify our engineering team about this issue and mark this as reproducible.

  2. taeold commented on Oct 19, 2023

    @taeold
    Contributor

    Fix will be shipped in the next release of the Firebase CLI. Thank you for the detailed report!

  3. added a commit that references this issue on Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions