这是我过去收到的一系列非常令人沮丧的错误中最新的一个3天部署我的云功能。
部署时得到:
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
我执行了——debug选项,在失败之前得到了这个输出
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
这是我的包裹。json文件:{
"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
}
请注意,我也尝试了最新版本的@babel依赖项(更新不多),但没有运气。
供您参考,这里是我正在部署的云功能:
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;
});
});
我认为可能有像v1 v2不匹配的东西,我一直在阅读。然而,我试图保持一切v1,当我去到我的云函数时,上面的所有函数都说v1。
任何帮助都非常感谢。
这是我发现的唯一一篇描述我昨天花了大部分时间试图解决的确切问题的文章。
我最终尝试只部署项目的一个功能,以便更好地了解调试日志中究竟发生了什么。我发现一行"无法找到functions.yaml"。必须使用HTTP发现
在谷歌上找到了一个类似于SO的话题,他们建议删除包锁。
我这样做了,它工作得很好。基本上,包中的包之间是脱节的。锁和它们的一些依赖项,如包中所述。
不会假装拥有所有的"为什么";但是删除包锁为我解决了这个问题,我不希望其他人面对这个问题没有解决方案!
该错误可能是由于在安装错误日志中提到的属性时出现的问题,对于这种情况,它是显示未定义的babel核心包,为了防止这种情况,您可以尝试重新安装包,如下所示:
npm install @babel/core --save
检查类似的例子:
- 无法读取属性标签
- npm抛出异常无法读取属性
- 无法读取属性https