skip to Main Content

This has been the latest in a series of very frustrating errors I have been receiving the past
3 days with deploying my cloud functions.

When deploying I get:

firebase deploy --only "functions:retireAtlistedEvents,functions:enqueueAtlistedEventsToRetire"

=== Deploying to 'my-project'...

i  deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run build

> build
> tsc

✔  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: required API artifactregistry.googleapis.com is enabled
✔  functions: required API cloudfunctions.googleapis.com is enabled
✔  functions: required API cloudbuild.googleapis.com is enabled
i  functions: preparing codebase default for deployment
i  functions: preparing functions directory for uploading...
i  functions: packaged /home/wpghijsen/Programs/combinedInstance/treetopCombined/treetoprules/functions (188.31 KB) for uploading
i  functions: ensuring required API cloudscheduler.googleapis.com is enabled...
i  functions: ensuring required API cloudtasks.googleapis.com is enabled...
✔  functions: required API cloudscheduler.googleapis.com is enabled
✔  functions: required API cloudtasks.googleapis.com is enabled
✔  functions: functions folder uploaded successfully
i  functions: updating Node.js 14 function enqueueAtlistedEventsToRetire(us-central1)...
i  functions: updating Node.js 14 function retireAtlistedEvents(us-central1)...
Build failed: npm ERR! Cannot read property '@babel/core' of undefined

npm ERR! A complete log of this run can be found in:
npm ERR!     /www-data-home/.npm/_logs/2022-12-03T21_14_11_382Z-debug.log; Error ID: beaf8772
Build failed: npm ERR! Cannot read property '@babel/core' of undefined

npm ERR! A complete log of this run can be found in:
npm ERR!     /www-data-home/.npm/_logs/2022-12-03T21_14_54_517Z-debug.log; Error ID: beaf8772

Functions deploy had errors with the following functions:
    enqueueAtlistedEventsToRetire(us-central1)
    retireAtlistedEvents(us-central1)
i  functions: cleaning up build files...
Error: There was an error deploying functions:
- Error Failed to update function enqueueAtlistedEventsToRetire in region us-central1
- Error Failed to update function retireAtlistedEvents in region us-central1

I did the –debug option and got this for output before failure

https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/upsert_pro_event_info_in_typesense 404
[2022-12-03T21:49:54.764Z] <<< [apiv2][body] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/upsert_pro_event_info_in_typesense {"error":{"code":404,"message":"Package "projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/upsert_pro_event_info_in_typesense" was not found.","status":"NOT_FOUND"}}
[2022-12-03T21:49:54.766Z] <<< [apiv2][status] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/set_users_geo_coded_address_data 404
[2022-12-03T21:49:54.766Z] <<< [apiv2][body] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/set_users_geo_coded_address_data {"error":{"code":404,"message":"Package "projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/set_users_geo_coded_address_data" was not found.","status":"NOT_FOUND"}}
[2022-12-03T21:49:54.767Z] <<< [apiv2][status] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/retire_atlisted_events 404
[2022-12-03T21:49:54.767Z] <<< [apiv2][body] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/retire_atlisted_events {"error":{"code":404,"message":"Package "projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/retire_atlisted_events" was not found.","status":"NOT_FOUND"}}
[2022-12-03T21:49:54.769Z] <<< [apiv2][status] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/pro_cancel_atlisted_pro_event 404
[2022-12-03T21:49:54.770Z] <<< [apiv2][body] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/pro_cancel_atlisted_pro_event {"error":{"code":404,"message":"Package "projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/pro_cancel_atlisted_pro_event" was not found.","status":"NOT_FOUND"}}
[2022-12-03T21:49:54.776Z] <<< [apiv2][status] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/archive_chat 404
[2022-12-03T21:49:54.776Z] <<< [apiv2][body] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/archive_chat {"error":{"code":404,"message":"Package "projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/archive_chat" was not found.","status":"NOT_FOUND"}}
[2022-12-03T21:49:54.778Z] <<< [apiv2][status] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/initialize_chat 404
[2022-12-03T21:49:54.778Z] <<< [apiv2][body] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/initialize_chat {"error":{"code":404,"message":"Package "projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/initialize_chat" was not found.","status":"NOT_FOUND"}}
[2022-12-03T21:49:54.779Z] <<< [apiv2][status] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/is_atlisted_and_claimed_cloud_fxn 404
[2022-12-03T21:49:54.779Z] <<< [apiv2][body] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/is_atlisted_and_claimed_cloud_fxn {"error":{"code":404,"message":"Package "projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/is_atlisted_and_claimed_cloud_fxn" was not found.","status":"NOT_FOUND"}}
[2022-12-03T21:49:54.780Z] <<< [apiv2][status] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/schedule_manage_format_initial_atlisted_data 404
[2022-12-03T21:49:54.780Z] <<< [apiv2][body] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/schedule_manage_format_initial_atlisted_data {"error":{"code":404,"message":"Package "projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/schedule_manage_format_initial_atlisted_data" was not found.","status":"NOT_FOUND"}}
[2022-12-03T21:49:54.781Z] <<< [apiv2][status] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/request_multiple_atlisted_pro_events 404
[2022-12-03T21:49:54.781Z] <<< [apiv2][body] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/request_multiple_atlisted_pro_events {"error":{"code":404,"message":"Package "projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/request_multiple_atlisted_pro_events" was not found.","status":"NOT_FOUND"}}
[2022-12-03T21:49:54.781Z] <<< [apiv2][status] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/get_at_listed_doc_count 404
[2022-12-03T21:49:54.781Z] <<< [apiv2][body] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/get_at_listed_doc_count {"error":{"code":404,"message":"Package "projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/get_at_listed_doc_count" was not found.","status":"NOT_FOUND"}}
[2022-12-03T21:49:54.783Z] <<< [apiv2][status] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/adjust_atlisted_pro_event_open_slots_cloud_fxn 404
[2022-12-03T21:49:54.783Z] <<< [apiv2][body] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/adjust_atlisted_pro_event_open_slots_cloud_fxn {"error":{"code":404,"message":"Package "projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/adjust_atlisted_pro_event_open_slots_cloud_fxn" was not found.","status":"NOT_FOUND"}}
[2022-12-03T21:49:54.783Z] <<< [apiv2][status] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/remove_request_multiple_atlisted_pro_events 404
[2022-12-03T21:49:54.783Z] <<< [apiv2][body] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/remove_request_multiple_atlisted_pro_events {"error":{"code":404,"message":"Package "projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/remove_request_multiple_atlisted_pro_events" was not found.","status":"NOT_FOUND"}}
[2022-12-03T21:49:54.784Z] <<< [apiv2][status] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/schedule_scrape 404
[2022-12-03T21:49:54.784Z] <<< [apiv2][body] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/schedule_scrape {"error":{"code":404,"message":"Package "projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/schedule_scrape" was not found.","status":"NOT_FOUND"}}
[2022-12-03T21:49:54.784Z] <<< [apiv2][status] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/update_user_info_in_typesense 404
[2022-12-03T21:49:54.784Z] <<< [apiv2][body] DELETE https://artifactregistry.googleapis.com/v1beta2/projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/update_user_info_in_typesense {"error":{"code":404,"message":"Package "projects/my-project/locations/us-central1/repositories/gcf-artifacts/packages/update_user_info_in_typesense" was not found.","status":"NOT_FOUND"}}
[2022-12-03T21:49:54.785Z] Functions deploy failed.
[2022-12-03T21:49:54.785Z] {
  "endpoint": {
    "id": "enqueueAtlistedEventsToRetire",
    "project": "my-project",
    "region": "us-central1",
    "entryPoint": "enqueueAtlistedEventsToRetire",
    "platform": "gcfv1",
    "runtime": "nodejs14",
    "scheduleTrigger": {
      "schedule": "0,15,30,45 * * * *",
      "timeZone": null,
      "retryConfig": {
        "maxBackoffSeconds": null,
        "minBackoffSeconds": null,
        "maxRetrySeconds": null,
        "retryCount": null,
        "maxDoublings": null
      }
    },
    "labels": {
      "deployment-tool": "cli-firebase"
    },
    "serviceAccount": null,
    "ingressSettings": null,
    "availableMemoryMb": 2048,
    "timeoutSeconds": null,
    "maxInstances": null,
    "minInstances": null,
    "vpc": null,
    "environmentVariables": {
      "FIREBASE_CONFIG": "{"projectId":"my-project","databaseURL":"https://my-project.firebaseio.com","storageBucket":"my-project.appspot.com","locationId":"us-central"}",
      "GCLOUD_PROJECT": "my-project",
      "EVENTARC_CLOUD_EVENT_SOURCE": "projects/my-project/locations/us-central1/functions/upsertProEventInfoInTypesense"
    },
    "codebase": "default",
    "securityLevel": "SECURE_ALWAYS",
    "targetedByOnly": true,
    "hash": "2a1b0fcfaf7a46ed932b2b3e5eea8f11c62140c5"
  },
  "op": "update",
  "original": {
    "name": "FirebaseError",
    "children": [],
    "exit": 1,
    "message": "Build failed: npm ERR! Cannot read property '@babel/core' of undefinednnnpm ERR! A complete log of this run can be found in:nnpm ERR!     /www-data-home/.npm/_logs/2022-12-03T21_49_11_956Z-debug.log; Error ID: beaf8772",
    "status": 3
  }
}
[2022-12-03T21:49:54.785Z] {
  "endpoint": {
    "id": "retireAtlistedEvents",
    "project": "my-project",
    "region": "us-central1",
    "entryPoint": "retireAtlistedEvents",
    "platform": "gcfv1",
    "runtime": "nodejs14",
    "taskQueueTrigger": {
      "rateLimits": {
        "maxConcurrentDispatches": 6,
        "maxDispatchesPerSecond": null
      },
      "retryConfig": {
        "maxAttempts": 5,
        "maxBackoffSeconds": null,
        "minBackoffSeconds": 60,
        "maxRetrySeconds": null,
        "maxDoublings": null
      }
    },
    "serviceAccount": null,
    "ingressSettings": null,
    "availableMemoryMb": 2048,
    "timeoutSeconds": null,
    "maxInstances": null,
    "minInstances": null,
    "vpc": null,
    "environmentVariables": {
      "FIREBASE_CONFIG": "{"projectId":"my-project","databaseURL":"https://my-project.firebaseio.com","storageBucket":"my-project.appspot.com","locationId":"us-central"}",
      "GCLOUD_PROJECT": "my-project",
      "EVENTARC_CLOUD_EVENT_SOURCE": "projects/my-project/locations/us-central1/functions/upsertProEventInfoInTypesense"
    },
    "codebase": "default",
    "securityLevel": "SECURE_OPTIONAL",
    "targetedByOnly": true,
    "hash": "2a1b0fcfaf7a46ed932b2b3e5eea8f11c62140c5",
    "labels": {
      "deployment-tool": "cli-firebase"
    }
  },
  "op": "update",
  "original": {
    "name": "FirebaseError",
    "children": [],
    "exit": 1,
    "message": "Build failed: npm ERR! Cannot read property '@babel/core' of undefinednnnpm ERR! A complete log of this run can be found in:nnpm ERR!     /www-data-home/.npm/_logs/2022-12-03T21_49_36_419Z-debug.log; Error ID: beaf8772",
    "status": 3
  }
}
Error: There was an error deploying functions:
- Error Failed to update function enqueueAtlistedEventsToRetire in region us-central1
- Error Failed to update function retireAtlistedEvents in region us-central1

This is my package.json file:

{
  "name": "functions",
  "type": "module",
  "scripts": {
    "build": "tsc",
    "emulators:start": "firebase emulators:start",
    "emulators:stop": "lsof -t -i:5000 -i:5001 -i:4030 -i:9099 -i:9001 -i:9199 -i:8091 -i:9090 | xargs kill -9",
    "serve": "npm run build && firebase emulators:start --only functions",
    "shell": "npm run build && firebase functions:shell",
    "start": "npm run shell",
    "test": "mocha --reporter spec --timeout 10000",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "14"
  },
  "main": "lib/index.js",
  "dependencies": {
    "@babel/core": "^7.2.0",
    "@babel/preset-env": "^7.2.0",
    "@babel/runtime": "^7.2.0",
    "@firebase/app-compat": "^0.1.28",
    "@google-cloud/tasks": "^3.0.5",
    "@types/rimraf": "^3.0.2",
    "acorn": "^8.8.1",
    "axios": "^0.27.2",
    "chai": "^4.3.4",
    "csv-parse": "^5.2.1",
    "firebase-admin": "^11.3.0",
    "firebase-functions": "^4.1.0",
    "fs": "0.0.1-security",
    "mocha": "^9.1.3",
    "puppeteer": "^10.4.0",
    "rimraf": "^3.0.2",
    "typescript": "4.3.5",
    "typesense": "^1.3.0"
  },
  "devDependencies": {
    "firebase-functions-test": "^0.3.3"
  },
  "private": true
}


Please note that I also tried the latest versions of the @babel dependencies (which were not much newer) with no luck.

For your reference here are the cloud functions I was deploying:

export const retireAtlistedEvents = functions
    .runWith( { memory: '2GB' })
    .tasks.taskQueue({
      retryConfig: {
        maxAttempts: 5,
        minBackoffSeconds: 60,
      },
      rateLimits: {
        maxConcurrentDispatches: 6,
      },
    }).onDispatch(async (data) => {
      const minEvent = data.minEvent as MinEventInfo;

      functions.logger.log("THIS IS retireAtlistedEvents minEventsData Success minEvent", minEvent);

     });

    export const enqueueAtlistedEventsToRetire = functions
    .runWith( { memory: '2GB' })
    .pubsub
    .schedule('0,15,30,45 * * * *').onRun(async context => {
        const queue = getFunctions().taskQueue("retireAtlistedEvents");
      
        const enqueues = [];

        let minEvent: MinEventInfo = {
          proId: "abcd",
          eventId: "efgh"
        }

        enqueues.push(
          queue.enqueue({minEvent: minEvent}, {
              dispatchDeadlineSeconds: 20 // 20 seconds
          }),
        );


        await Promise.all(enqueues)
          .then(() => {
            const exit: ExtendedExitMessage = {
              exit: 0,
              message: "enqueueAtlistedEventsToRetire success",
              success: true,
            };
            return exit;
          })
          .catch(() => {
            const exit: ExtendedExitMessage = {
              exit: 1,
              message: "enqueueAtlistedEventsToRetire success",
              success: false,
            };
            return exit;
          });
     
      });

I am thinking there may be something like a v1 v2 mismatch, which I have been reading about. However, I am trying to keep everything v1 and when I go to my cloud functions, everything there says v1 for the above functions.

Any help is much appreciated.

2

Answers


  1. The error could be due to the issue while package installation of the property which is mentioned in the error log, as for this case it is babel core package which is shown undefined, as to prevent this you may try to re-install the package as below:

    npm install @babel/core --save

    Check for similar examples:

    Login or Signup to reply.
  2. This is the only post I found describing the exact issue that I spent most of yesterday trying to solve.

    I eventually tried deploying just a single function of the project to get a better idea of what exactly is happening in the debug log. I found a line "could not find functions.yaml. must use http discovery".

    Googling that found a sort-of adjacent SO topic here, where they recommended deleting the package-lock.json before deploying.

    I did that, and it worked just fine. Basically there’s a disconnect between packages in the package.lock and some of their dependencies as described in the package.json, and that made Firebase all cranky.

    Won’t pretend to have all the "why" answers, but deleting the package-lock solved this exact problem for me, and I didn’t want someone else facing this to not have a solution!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search