Skip to content

When deploying functions: TypeError: Cannot read property 'service' of undefined #4770

@abMarlim

Description

@abMarlim

[REQUIRED] Environment info

firebase-tools: 11.3.0

Platform: macOS
Node: v16.16.0

[REQUIRED] Test case

Attempt to deploy updated functions that were previously deployed

[REQUIRED] Steps to reproduce

Deploy via CLI with firebase deploy --only functions command

[REQUIRED] Expected behavior

Deploy from "functions" folder normally

[REQUIRED] Actual behavior

At the end of the firebase-debug.log file:

[debug] [2022-07-21T20:07:38.932Z] Building nodejs source
[debug] [2022-07-21T20:07:38.938Z] Could not find functions.yaml. Must use http discovery
[debug] [2022-07-21T20:07:39.155Z] Serving at port 9005

[debug] [2022-07-21T20:07:39.355Z] Got response from /__/functions.yaml {"endpoints":{"externals":{"platform":"gcfv1","httpsTrigger":{},"entryPoint":"externals"},"api_v1":{"platform":"gcfv1","httpsTrigger":{},"entryPoint":"api_v1"},"apiv2":{"platform":"gcfv2","labels":{},"httpsTrigger":{},"entryPoint":"apiv2"}},"specVersion":"v1alpha1","requiredAPIs":[]}
[debug] [2022-07-21T20:07:39.363Z] shutdown requested via /__/quitquitquit

[info] i  functions: preparing functions directory for uploading... 
[info] i  functions: packaged /Users/alexbrasileiro/Marlim/cryptoApi/functions (137.46 KB) for uploading 
[info] i  functions: packaged /Users/alexbrasileiro/Marlim/cryptoApi/functions (138.29 KB) for uploading 
[debug] [2022-07-21T20:07:39.601Z] >>> [apiv2][query] GET https://cloudfunctions.googleapis.com/v1/projects/marlim-crypto/locations/-/functions [none]
[debug] [2022-07-21T20:07:40.596Z] <<< [apiv2][status] GET https://cloudfunctions.googleapis.com/v1/projects/marlim-crypto/locations/-/functions 200
[debug] [2022-07-21T20:07:40.596Z] <<< [apiv2][body] GET https://cloudfunctions.googleapis.com/v1/projects/marlim-crypto/locations/-/functions {"functions":[{"name":"projects/marlim-crypto/locations/us-central1/functions/api_v1","httpsTrigger":{"url":"https://us-central1-marlim-crypto.cloudfunctions.net/api_v1","securityLevel":"SECURE_OPTIONAL"},"status":"ACTIVE","entryPoint":"api_v1","timeout":"60s","availableMemoryMb":256,"serviceAccountEmail":"[email protected]","updateTime":"2022-07-21T19:21:46.151Z","versionId":"36","labels":{"deployment-tool":"cli-firebase"},"sourceUploadUrl":"https://storage.googleapis.com/uploads-836009295537.us-central1.cloudfunctions.appspot.com/61a862ef-69b9-4307-bc20-fea7758ff6b0.zip","environmentVariables":{"FIREBASE_CONFIG":"{\"projectId\":\"marlim-crypto\",\"storageBucket\":\"marlim-crypto.appspot.com\",\"locationId\":\"us-central\"}","GCLOUD_PROJECT":"marlim-crypto"},"runtime":"nodejs16","ingressSettings":"ALLOW_ALL","buildId":"39ea34ce-6268-4ca2-9fe8-67d2cfd13041","buildName":"projects/541573807004/locations/us-central1/builds/39ea34ce-6268-4ca2-9fe8-67d2cfd13041","dockerRegistry":"ARTIFACT_REGISTRY"},{"name":"projects/marlim-crypto/locations/us-central1/functions/externals","httpsTrigger":{"url":"https://us-central1-marlim-crypto.cloudfunctions.net/externals","securityLevel":"SECURE_OPTIONAL"},"status":"ACTIVE","entryPoint":"externals","timeout":"60s","availableMemoryMb":256,"serviceAccountEmail":"[email protected]","updateTime":"2022-07-21T19:21:45.606Z","versionId":"16","labels":{"deployment-tool":"cli-firebase"},"sourceUploadUrl":"https://storage.googleapis.com/uploads-836009295537.us-central1.cloudfunctions.appspot.com/61a862ef-69b9-4307-bc20-fea7758ff6b0.zip","environmentVariables":{"FIREBASE_CONFIG":"{\"projectId\":\"marlim-crypto\",\"storageBucket\":\"marlim-crypto.appspot.com\",\"locationId\":\"us-central\"}","GCLOUD_PROJECT":"marlim-crypto"},"runtime":"nodejs16","ingressSettings":"ALLOW_ALL","buildId":"39ea34ce-6268-4ca2-9fe8-67d2cfd13041","buildName":"projects/541573807004/locations/us-central1/builds/39ea34ce-6268-4ca2-9fe8-67d2cfd13041","dockerRegistry":"ARTIFACT_REGISTRY"}]}
[debug] [2022-07-21T20:07:40.597Z] >>> [apiv2][query] GET https://cloudfunctions.googleapis.com/v2alpha/projects/marlim-crypto/locations/-/functions [none]
[debug] [2022-07-21T20:07:42.027Z] <<< [apiv2][status] GET https://cloudfunctions.googleapis.com/v2alpha/projects/marlim-crypto/locations/-/functions 200
[debug] [2022-07-21T20:07:42.027Z] <<< [apiv2][body] GET https://cloudfunctions.googleapis.com/v2alpha/projects/marlim-crypto/locations/-/functions {"functions":[{"name":"projects/marlim-crypto/locations/us-central1/functions/apiv2","buildConfig":{"build":"projects/541573807004/locations/us-central1/builds/1f328220-66c7-4bba-aa00-2adaabeaeef0","runtime":"nodejs16","entryPoint":"apiv2","source":{"storageSource":{"bucket":"gcf-v2-sources-541573807004-us-central1","object":"apiv2/function-source.zip"}},"sourceProvenance":{"resolvedStorageSource":{"bucket":"gcf-v2-sources-541573807004-us-central1","object":"apiv2/function-source.zip","generation":"1658431209596789"}}},"state":"FAILED","updateTime":"2022-07-21T19:22:19.383722406Z","labels":{"deployment-tool":"cli-firebase"},"stateMessages":[{"severity":"ERROR","type":"CloudRunServiceNotFound","message":"Cloud Run service projects/marlim-crypto/locations/us-central1/services/apiv2 for the function was not found. The function will not work correctly. Please redeploy."}],"environment":"GEN_2"}]}
[debug] [2022-07-21T20:07:42.187Z] TypeError: Cannot read properties of undefined (reading 'service')
    at /Users/alexbrasileiro/.nvm/versions/node/v16.16.0/lib/node_modules/firebase-tools/lib/deploy/functions/backend.js:197:113
    at Array.map (<anonymous>)
    at loadExistingBackend (/Users/alexbrasileiro/.nvm/versions/node/v16.16.0/lib/node_modules/firebase-tools/lib/deploy/functions/backend.js:197:69)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.existingBackend (/Users/alexbrasileiro/.nvm/versions/node/v16.16.0/lib/node_modules/firebase-tools/lib/deploy/functions/backend.js:173:9)
    at async prepare (/Users/alexbrasileiro/.nvm/versions/node/v16.16.0/lib/node_modules/firebase-tools/lib/deploy/functions/prepare.js:110:115)
    at async chain (/Users/alexbrasileiro/.nvm/versions/node/v16.16.0/lib/node_modules/firebase-tools/lib/deploy/index.js:33:9)
    at async deploy (/Users/alexbrasileiro/.nvm/versions/node/v16.16.0/lib/node_modules/firebase-tools/lib/deploy/index.js:68:5)
[error] 
[error] Error: An unexpected error has occurred.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions