Firebase deploy 가 잘 되지 않습니다.


  • Level 4

    Firebase Function을 추가하고 진행했는데, 예상과 달리 Firebase를 처음 설치할 때도 오류가 생겨서 왜이러나 싶더니,
    이젠 기본 함수 마저 제대로 deploy를 할 수 없습니다.

    Function 자체를 쓰고 하는데 무리가 없고,
    eslint 가 있으면 방해되는 것 같아서 Firebase에서 제공하는 lint를 끄고 설치하니...
    이젠 다른 오류가 나타나면서 더욱 더 혼란스럽게 하는 것 같습니다.

    관련 포럼도 도저히 알아볼 곳이 없어 여기에 글을 올립니다. 한번 확인 부탁 드립니다.

    [debug] [2023-01-11T05:39:25.361Z] ----------------------------------------------------------------------
    [debug] [2023-01-11T05:39:25.365Z] Command:       /usr/bin/node /usr/bin/firebase deploy
    [debug] [2023-01-11T05:39:25.366Z] CLI Version:   11.20.0
    [debug] [2023-01-11T05:39:25.366Z] Platform:      linux
    [debug] [2023-01-11T05:39:25.367Z] Node Version:  v16.19.0
    [debug] [2023-01-11T05:39:25.367Z] Time:          Wed Jan 11 2023 05:39:25 GMT+0000 (협정 세계시)
    [debug] [2023-01-11T05:39:25.368Z] ----------------------------------------------------------------------
    [debug] 
    [debug] [2023-01-11T05:39:25.859Z] > 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"]
    [debug] [2023-01-11T05:39:25.860Z] > authorizing via signed-in user (example@gmail.com)
    [debug] [2023-01-11T05:39:25.861Z] [iam] checking project xxxxxxxxxxxxxxxxxxxxx for permissions ["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]
    [debug] [2023-01-11T05:39:25.866Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx:testIamPermissions [none]
    [debug] [2023-01-11T05:39:25.866Z] >>> [apiv2][(partial)header] POST https://cloudresourcemanager.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx:testIamPermissions x-goog-quota-user=projects/xxxxxxxxxxxxxxxxxxxxx
    [debug] [2023-01-11T05:39:25.866Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx:testIamPermissions {"permissions":["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]}
    [debug] [2023-01-11T05:39:26.975Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx:testIamPermissions 200
    [debug] [2023-01-11T05:39:26.976Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx:testIamPermissions {"permissions":["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]}
    [debug] [2023-01-11T05:39:26.977Z] >>> [apiv2][query] POST https://iam.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/serviceAccounts/xxxxxxxxxxxxxxxxxxxxx@appspot.gserviceaccount.com:testIamPermissions [none]
    [debug] [2023-01-11T05:39:26.978Z] >>> [apiv2][body] POST https://iam.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/serviceAccounts/xxxxxxxxxxxxxxxxxxxxx@appspot.gserviceaccount.com:testIamPermissions {"permissions":["iam.serviceAccounts.actAs"]}
    [debug] [2023-01-11T05:39:27.360Z] <<< [apiv2][status] POST https://iam.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/serviceAccounts/xxxxxxxxxxxxxxxxxxxxx@appspot.gserviceaccount.com:testIamPermissions 200
    [debug] [2023-01-11T05:39:27.360Z] <<< [apiv2][body] POST https://iam.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/serviceAccounts/xxxxxxxxxxxxxxxxxxxxx@appspot.gserviceaccount.com:testIamPermissions {"permissions":["iam.serviceAccounts.actAs"]}
    [info] 
    [info] === Deploying to 'xxxxxxxxxxxxxxxxxxxxx'...
    [info] 
    [info] i  deploying functions 
    [debug] [2023-01-11T05:39:27.366Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/xxxxxxxxxxxxxxxxxxxxx [none]
    [debug] [2023-01-11T05:39:27.770Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/xxxxxxxxxxxxxxxxxxxxx 200
    [debug] [2023-01-11T05:39:27.771Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/xxxxxxxxxxxxxxxxxxxxx {"projectId":"xxxxxxxxxxxxxxxxxxxxx","projectNumber":"529367310438","displayName":"SHAKS GAMEPAD UTILITY","name":"projects/xxxxxxxxxxxxxxxxxxxxx","resources":{"hostingSite":"xxxxxxxxxxxxxxxxxxxxx","realtimeDatabaseInstance":"xxxxxxxxxxxxxxxxxxxxx","storageBucket":"xxxxxxxxxxxxxxxxxxxxx.appspot.com","locationId":"europe-west"},"state":"ACTIVE","etag":"1111111111-1111-1111-1111-111111111111"}
    [info] i  functions: preparing codebase default for deployment 
    [info] i  functions: ensuring required API cloudfunctions.googleapis.com is enabled... 
    [info] i  functions: ensuring required API cloudbuild.googleapis.com is enabled... 
    [info] i  artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled... 
    [debug] [2023-01-11T05:39:27.775Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/services/cloudfunctions.googleapis.com [none]
    [debug] [2023-01-11T05:39:27.775Z] >>> [apiv2][(partial)header] GET https://serviceusage.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/services/cloudfunctions.googleapis.com x-goog-quota-user=projects/xxxxxxxxxxxxxxxxxxxxx
    [debug] [2023-01-11T05:39:27.777Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/services/runtimeconfig.googleapis.com [none]
    [debug] [2023-01-11T05:39:27.778Z] >>> [apiv2][(partial)header] GET https://serviceusage.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/services/runtimeconfig.googleapis.com x-goog-quota-user=projects/xxxxxxxxxxxxxxxxxxxxx
    [debug] [2023-01-11T05:39:27.779Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/services/cloudbuild.googleapis.com [none]
    [debug] [2023-01-11T05:39:27.779Z] >>> [apiv2][(partial)header] GET https://serviceusage.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/services/cloudbuild.googleapis.com x-goog-quota-user=projects/xxxxxxxxxxxxxxxxxxxxx
    [debug] [2023-01-11T05:39:27.781Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/services/artifactregistry.googleapis.com [none]
    [debug] [2023-01-11T05:39:27.781Z] >>> [apiv2][(partial)header] GET https://serviceusage.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/services/artifactregistry.googleapis.com x-goog-quota-user=projects/xxxxxxxxxxxxxxxxxxxxx
    [debug] [2023-01-11T05:39:28.894Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/services/cloudfunctions.googleapis.com 200
    [debug] [2023-01-11T05:39:28.894Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/services/cloudfunctions.googleapis.com [omitted]
    [info] ✔  functions: required API cloudfunctions.googleapis.com is enabled 
    [debug] [2023-01-11T05:39:28.904Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/services/artifactregistry.googleapis.com 200
    [debug] [2023-01-11T05:39:28.904Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/services/artifactregistry.googleapis.com [omitted]
    [info] ✔  artifactregistry: required API artifactregistry.googleapis.com is enabled 
    [debug] [2023-01-11T05:39:28.908Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/services/runtimeconfig.googleapis.com 200
    [debug] [2023-01-11T05:39:28.908Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/services/runtimeconfig.googleapis.com [omitted]
    [debug] [2023-01-11T05:39:28.911Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/services/cloudbuild.googleapis.com 200
    [debug] [2023-01-11T05:39:28.912Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/services/cloudbuild.googleapis.com [omitted]
    [info] ✔  functions: required API cloudbuild.googleapis.com is enabled 
    [debug] [2023-01-11T05:39:28.913Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/xxxxxxxxxxxxxxxxxxxxx/adminSdkConfig [none]
    [debug] [2023-01-11T05:39:29.364Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/xxxxxxxxxxxxxxxxxxxxx/adminSdkConfig 200
    [debug] [2023-01-11T05:39:29.364Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/xxxxxxxxxxxxxxxxxxxxx/adminSdkConfig {"projectId":"xxxxxxxxxxxxxxxxxxxxx","databaseURL":"https://xxxxxxxxxxxxxxxxxxxxx.firebaseio.com","storageBucket":"xxxxxxxxxxxxxxxxxxxxx.appspot.com","locationId":"europe-west"}
    [debug] [2023-01-11T05:39:29.365Z] >>> [apiv2][query] GET https://runtimeconfig.googleapis.com/v1beta1/projects/xxxxxxxxxxxxxxxxxxxxx/configs [none]
    [debug] [2023-01-11T05:39:29.844Z] <<< [apiv2][status] GET https://runtimeconfig.googleapis.com/v1beta1/projects/xxxxxxxxxxxxxxxxxxxxx/configs 200
    [debug] [2023-01-11T05:39:29.844Z] <<< [apiv2][body] GET https://runtimeconfig.googleapis.com/v1beta1/projects/xxxxxxxxxxxxxxxxxxxxx/configs {"configs":[{"name":"projects/xxxxxxxxxxxxxxxxxxxxx/configs/youtube"}]}
    [debug] [2023-01-11T05:39:29.845Z] >>> [apiv2][query] GET https://runtimeconfig.googleapis.com/v1beta1/projects/xxxxxxxxxxxxxxxxxxxxx/configs/youtube/variables [none]
    [debug] [2023-01-11T05:39:30.254Z] <<< [apiv2][status] GET https://runtimeconfig.googleapis.com/v1beta1/projects/xxxxxxxxxxxxxxxxxxxxx/configs/youtube/variables 200
    [debug] [2023-01-11T05:39:30.255Z] <<< [apiv2][body] GET https://runtimeconfig.googleapis.com/v1beta1/projects/xxxxxxxxxxxxxxxxxxxxx/configs/youtube/variables {"variables":[{"name":"projects/xxxxxxxxxxxxxxxxxxxxx/configs/youtube/variables/key","updateTime":"2023-01-10T17:23:23.675799728Z"}]}
    [debug] [2023-01-11T05:39:30.260Z] >>> [apiv2][query] GET https://runtimeconfig.googleapis.com/v1beta1/projects/xxxxxxxxxxxxxxxxxxxxx/configs/youtube/variables/key [none]
    [debug] [2023-01-11T05:39:30.761Z] <<< [apiv2][status] GET https://runtimeconfig.googleapis.com/v1beta1/projects/xxxxxxxxxxxxxxxxxxxxx/configs/youtube/variables/key 200
    [debug] [2023-01-11T05:39:30.762Z] <<< [apiv2][body] GET https://runtimeconfig.googleapis.com/v1beta1/projects/xxxxxxxxxxxxxxxxxxxxx/configs/youtube/variables/key {"name":"projects/xxxxxxxxxxxxxxxxxxxxx/configs/youtube/variables/key","updateTime":"2023-01-10T17:23:23.675799728Z","text":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}
    [debug] [2023-01-11T05:39:30.764Z] Validating nodejs source
    [debug] [2023-01-11T05:39:33.687Z] > [functions] package.json contents: {
      "name": "functions",
      "description": "Cloud Functions for Firebase",
      "scripts": {
        "serve": "firebase emulators:start --only functions",
        "shell": "firebase functions:shell",
        "start": "npm run shell",
        "deploy": "firebase deploy --only functions",
        "logs": "firebase functions:log"
      },
      "engines": {
        "node": "16"
      },
      "main": "index.js",
      "dependencies": {
        "firebase-admin": "^10.0.2",
        "firebase-functions": "^4.1.1"
      },
      "devDependencies": {
        "firebase-functions-test": "^0.2.0"
      },
      "private": true
    }
    [debug] [2023-01-11T05:39:33.688Z] Building nodejs source
    [debug] [2023-01-11T05:39:33.689Z] Could not find functions.yaml. Must use http discovery
    [debug] [2023-01-11T05:39:35.170Z] Serving at port 9005
    
    [debug] [2023-01-11T05:39:36.284Z] Got response from /__/functions.yaml {"endpoints":{"helloWorld":{"platform":"gcfv1","availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"serviceAccountEmail":null,"vpc":null,"httpsTrigger":{},"entryPoint":"helloWorld"}},"specVersion":"v1alpha1","requiredAPIs":[]}
    [debug] [2023-01-11T05:39:36.470Z] shutdown requested via /__/quitquitquit
    
    [info] i  functions: preparing functions directory for uploading... 
    [info] i  functions: packaged /workspace/FirebaseCLI/functions (54.74 KB) for uploading 
    [debug] [2023-01-11T05:39:36.791Z] >>> [apiv2][query] GET https://cloudfunctions.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/locations/-/functions [none]
    [debug] [2023-01-11T05:39:37.561Z] <<< [apiv2][status] GET https://cloudfunctions.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/locations/-/functions 200
    [debug] [2023-01-11T05:39:37.561Z] <<< [apiv2][body] GET https://cloudfunctions.googleapis.com/v1/projects/xxxxxxxxxxxxxxxxxxxxx/locations/-/functions {}
    [debug] [2023-01-11T05:39:37.562Z] >>> [apiv2][query] GET https://cloudfunctions.googleapis.com/v2/projects/xxxxxxxxxxxxxxxxxxxxx/locations/-/functions filter=environment%3D%22GEN_2%22
    [debug] [2023-01-11T05:39:39.061Z] <<< [apiv2][status] GET https://cloudfunctions.googleapis.com/v2/projects/xxxxxxxxxxxxxxxxxxxxx/locations/-/functions 200
    [debug] [2023-01-11T05:39:39.061Z] <<< [apiv2][body] GET https://cloudfunctions.googleapis.com/v2/projects/xxxxxxxxxxxxxxxxxxxxx/locations/-/functions {"functions":[{"name":"projects/xxxxxxxxxxxxxxxxxxxxx/locations/europe-west4/functions/date","buildConfig":{"build":"projects/000000000000/locations/europe-west4/builds/dddddddd-dddd-dddd-dddd-dddddddddddd","runtime":"nodejs16","entryPoint":"date","source":{"storageSource":{"bucket":"gcf-v2-sources-529367310438-europe-west4","object":"date/function-source.zip"}},"sourceProvenance":{"resolvedStorageSource":{"bucket":"gcf-v2-sources-529367310438-europe-west4","object":"date/function-source.zip","generation":"1673405131430993"}}},"state":"FAILED","updateTime":"2023-01-11T02:46:32.035240385Z","labels":{"deployment-tool":"cli-firebase","firebase-functions-hash":"3a8fd04cd9faebcb56155db3fb569c13d4252fad"},"stateMessages":[{"severity":"ERROR","type":"CloudRunServiceNotFound","message":"Cloud Run service projects/xxxxxxxxxxxxxxxxxxxxx/locations/europe-west4/services/date for the function was not found. The function will not work correctly. Please redeploy."}],"environment":"GEN_2"},{"name":"projects/xxxxxxxxxxxxxxxxxxxxx/locations/us-east1/functions/date","buildConfig":{"build":"projects/529367310438/locations/us-east1/builds/624fc2c9-18a4-4bae-bef6-de5526e40a21","runtime":"nodejs16","entryPoint":"date","source":{"storageSource":{"bucket":"gcf-v2-sources-529367310438-us-east1","object":"date/function-source.zip"}},"sourceProvenance":{"resolvedStorageSource":{"bucket":"gcf-v2-sources-529367310438-us-east1","object":"date/function-source.zip","generation":"1673405130237486"}}},"state":"FAILED","updateTime":"2023-01-11T02:46:33.662216335Z","labels":{"firebase-functions-hash":"3a8fd04cd9faebcb56155db3fb569c13d4252fad","deployment-tool":"cli-firebase"},"stateMessages":[{"severity":"ERROR","type":"CloudRunServiceNotFound","message":"Cloud Run service projects/xxxxxxxxxxxxxxxxxxxxx/locations/us-east1/services/date for the function was not found. The function will not work correctly. Please redeploy."}],"environment":"GEN_2"},{"name":"projects/xxxxxxxxxxxxxxxxxxxxx/locations/us-west1/functions/date","buildConfig":{"build":"projects/529367310438/locations/us-west1/builds/e94c54cc-5534-4c74-ad24-08ea23ade1db","runtime":"nodejs16","entryPoint":"date","source":{"storageSource":{"bucket":"gcf-v2-sources-529367310438-us-west1","object":"date/function-source.zip"}},"sourceProvenance":{"resolvedStorageSource":{"bucket":"gcf-v2-sources-529367310438-us-west1","object":"date/function-source.zip","generation":"1673405129090729"}}},"state":"FAILED","updateTime":"2023-01-11T02:46:12.505826381Z","labels":{"deployment-tool":"cli-firebase","firebase-functions-hash":"3a8fd04cd9faebcb56155db3fb569c13d4252fad"},"stateMessages":[{"severity":"ERROR","type":"CloudRunServiceNotFound","message":"Cloud Run service projects/xxxxxxxxxxxxxxxxxxxxx/locations/us-west1/services/date for the function was not found. The function will not work correctly. Please redeploy."}],"environment":"GEN_2"}]}
    [debug] [2023-01-11T05:39:39.241Z] TypeError: Cannot read properties of undefined (reading 'service')
        at /usr/lib/node_modules/firebase-tools/lib/deploy/functions/backend.js:198:113
        at Array.map (<anonymous>)
        at loadExistingBackend (/usr/lib/node_modules/firebase-tools/lib/deploy/functions/backend.js:198:69)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
        at async Object.existingBackend (/usr/lib/node_modules/firebase-tools/lib/deploy/functions/backend.js:174:9)
        at async prepare (/usr/lib/node_modules/firebase-tools/lib/deploy/functions/prepare.js:138:115)
        at async chain (/usr/lib/node_modules/firebase-tools/lib/deploy/index.js:35:9)
        at async deploy (/usr/lib/node_modules/firebase-tools/lib/deploy/index.js:79:5)
    [error] 
    [error] Error: An unexpected error has occurred.
    
    

    이게 구름 IDE 쪽에서의 문제인지 아닌지 모르겠습니다.

  • Level 4

    @배명호-goorm 안타깝게도 Firebase 기본 샘플 함수를 해제한 게 전부였습니다. 기본 샘플에 오류가 있다고는 생각되지 않습니다.

  • Level 4

    스스로 다시 쓰는 것도 좀 그렇긴 하지만, 자체적으로 제공해주는 node.js 보다 homebrew를 설치하고 진행하니 기본 스크립트 Deploy에 성공했습니다.

    아래와 같이 진행하는 게 좋을 듯 합니다.

    1. 생성할 컨테이너는 node.js 16으로 우선 선택하여 컨테이너를 사용합니다.
    2. Homebrew 에서 짧은 한줄 스크립트 대신 아래의 스크립트로 설치합니다. 설치 시간이 상당히 오래 걸립니다.
    export HOMEBREW_INSTALL_FROM_API=1
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
    

    설치가 다 되면,

    echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /root/.profile
    echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /root/.profile
    eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
    

    이후 brew 를 넣어서 정상적으로 작동하는지 확인 후, 아래의 코드로 Firebase CLI를 설치합니다.

    brew install firebase-cli
    

    Firebase CLI를 쓸 경우 항상 최신 버전을 쓰도록 권장하던데, 하나 준비하는 시간이 너무 오래 걸리는 것 같네요.

  • Level 12

    안녕하세요.

    이 링크를 확인해보면, firebase function 목록 중 문제가 있는 function이 있으면 위 문제가 나타나는 것으로 보입니다. 해당 내용을 확인하여 문제가 있는 function을 찾아 지우는 등 조치를 취하면 해결이 될 것으로 보입니다.

ONLINE USERS

POPULAR TOPICS

SUGGESTED TOPICS

  • 5
  • 5
  • 2
  • 1
  • 2
  • 4
  • 4
  • 3