我的代码项目是Nextjs@12.2.2
当我上传我的函数使用:firebase deploy --only函数,它们被成功上传
=== Deploying to 'casavelerosbot-evbl'...
i deploying functions
i functions: preparing codebase default for deployment
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...
✔ functions: required API cloudbuild.googleapis.com is enabled
✔ artifactregistry: required API artifactregistry.googleapis.com is enabled
✔ functions: required API cloudfunctions.googleapis.com is enabled
i functions: preparing functions directory for uploading...
i functions: packaged /Users/luisquiroga/Documents/GitHub/casavelerosweb/functions (109.88 KB) for uploading
✔ functions: functions folder uploaded successfully
i functions: updating Node.js 16 function onAccountCreate(us-central1)...
i functions: updating Node.js 16 function createProperty(us-central1)...
i functions: updating Node.js 16 function editProperty(us-central1)...
i functions: updating Node.js 16 function addMember(us-central1)...
i functions: updating Node.js 16 function removeMember(us-central1)...
i functions: updating Node.js 16 function createReservation(us-central1)...
i functions: updating Node.js 16 function editReservation(us-central1)...
i functions: updating Node.js 16 function updateReservationStatus(us-central1)...
i functions: updating Node.js 16 function removeReservation(us-central1)...
i functions: updating Node.js 16 function createTransaction(us-central1)...
i functions: updating Node.js 16 function editTransaction(us-central1)...
i functions: updating Node.js 16 function removeTransaction(us-central1)...
✔ functions[createTransaction(us-central1)] Successful update operation.
✔ functions[removeReservation(us-central1)] Successful update operation.
✔ functions[editProperty(us-central1)] Successful update operation.
✔ functions[editTransaction(us-central1)] Successful update operation.
✔ functions[removeMember(us-central1)] Successful update operation.
✔ functions[removeTransaction(us-central1)] Successful update operation.
✔ functions[editReservation(us-central1)] Successful update operation.
✔ functions[createReservation(us-central1)] Successful update operation.
✔ functions[updateReservationStatus(us-central1)] Successful update operation.
✔ functions[createProperty(us-central1)] Successful update operation.
✔ functions[addMember(us-central1)] Successful update operation.
✔ functions[onAccountCreate(us-central1)] Successful update operation.
i functions: cleaning up build files...
✔ Deploy complete!
正如你所看到的,没有一个函数叫做“ssrcasavelerosbotevbl”,所以我猜问题不在于我的函数。
然后出于某种原因当我跑的时候
firebase deploy --only hosting
命令build my web,然后它尝试部署hosting AND函数,当我明确地说--only hosting时。
从第一天开始,这个项目的行为就一直是一样的(在其他项目中,我只能上传/更新我的网站),但直到3天前,当我尝试做firebase部署时,它一直不是一个问题-只托管,这是控制台输出:
=== Deploying to 'casavelerosbot-evbl'...
i deploying functions, hosting
i functions: preparing codebase default for deployment
i functions: preparing codebase firebase-frameworks-casavelerosbot-evbl for deployment
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...
✔ functions: required API cloudfunctions.googleapis.com is enabled
✔ functions: required API cloudbuild.googleapis.com is enabled
✔ artifactregistry: required API artifactregistry.googleapis.com is enabled
⚠ functions: package.json indicates an outdated version of firebase-functions. Please upgrade using npm install --save firebase-functions@latest in your functions directory.
⚠ functions: Please note that there will be breaking changes when you upgrade.
i functions: Loaded environment variables from .env.
i functions: preparing functions directory for uploading...
i functions: packaged /Users/luisquiroga/Documents/GitHub/casavelerosweb/functions (159.33 KB) for uploading
i functions: preparing .firebase/casavelerosbot-evbl/functions directory for uploading...
i functions: packaged /Users/luisquiroga/Documents/GitHub/casavelerosweb/.firebase/casavelerosbot-evbl/functions (21.22 MB) for uploading
i functions: ensuring required API run.googleapis.com is enabled...
i functions: ensuring required API eventarc.googleapis.com is enabled...
i functions: ensuring required API pubsub.googleapis.com is enabled...
i functions: ensuring required API storage.googleapis.com is enabled...
✔ functions: required API pubsub.googleapis.com is enabled
✔ functions: required API storage.googleapis.com is enabled
✔ functions: required API run.googleapis.com is enabled
✔ functions: required API eventarc.googleapis.com is enabled
i functions: generating the service identity for pubsub.googleapis.com...
i functions: generating the service identity for eventarc.googleapis.com...
✔ functions: functions folder uploaded successfully
✔ functions: .firebase/casavelerosbot-evbl/functions folder uploaded successfully
i hosting[casavelerosbot-evbl]: beginning deploy...
i hosting[casavelerosbot-evbl]: found 71 files in .firebase/casavelerosbot-evbl/hosting
✔ hosting[casavelerosbot-evbl]: file upload complete
i functions: creating Node.js 16 function firebase-frameworks-casavelerosbot-evbl:ssrcasavelerosbotevbl(us-central1)...
⚠ functions: HTTP Error: 400, Could not create Cloud Run service ssrcasavelerosbotevbl. spec.template.spec.containers.resources.limits.cpu: Invalid value specified for cpu. For the specified value, maxScale may not exceed 10.
Consider running your workload in a region with greater capacity, decreasing your requested cpu-per-instance, or requesting an increase in quota for this region if you are seeing sustained usage near this limit, see https://cloud.google.com/run/quotas. Your project may gain access to further scaling by adding billing information to your account.
⚠ functions: failed to create function projects/casavelerosbot-evbl/locations/us-central1/functions/ssrcasavelerosbotevbl
Failed to create function projects/casavelerosbot-evbl/locations/us-central1/functions/ssrcasavelerosbotevbl
Functions deploy had errors with the following functions:
firebase-frameworks-casavelerosbot-evbl:ssrcasavelerosbotevbl(us-central1)
i functions: cleaning up build files...
Error: There was an error deploying functions
所以我不知道为什么它要求一个ssrcasavelerosbotevbl函数。我很久以前就删除了这个函数。
因此,由于这个错误的行为,我无法更新我的网页
firebase.json:
{
"functions": [
{
"source": "functions",
"codebase": "default",
"ignore": [
"node_modules",
".git",
"firebase-debug.log",
"firebase-debug.*.log"
]
}
],
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"hosting": {
"source": ".",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"frameworksBackend": {
"region": "us-central1"
}
},
"storage": {
"rules": "storage.rules"
}
}
我的前端的package.json
{
"name": "casavelerosweb",
"version": "0.1.1",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build && next export",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@date-io/moment": "^2.16.1",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@fontsource/roboto": "^4.5.8",
"@mui/icons-material": "^5.11.0",
"@mui/lab": "^5.0.0-alpha.122",
"@mui/material": "^5.11.4",
"@mui/styles": "^5.11.2",
"@mui/x-date-pickers": "^5.0.13",
"@next/font": "13.1.2",
"dayjs": "^1.11.7",
"eslint": "8.31.0",
"eslint-config-next": "13.1.2",
"firebase": "^9.18.0",
"firebase-admin": "^11.5.0",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"next": "12.2.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-firebase-hooks": "^5.1.1",
"react-firebaseui": "^6.0.0"
}
}
函数的package.json
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"lint": "eslint .",
"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": "^11.5.0",
"firebase-functions": "^4.2.1",
"request": "^2.88.2",
"twilio": "^2.5.2"
},
"devDependencies": {
"eslint": "^8.9.0",
"eslint-config-google": "^0.14.0",
"firebase-functions-test": "^0.2.0"
},
"private": true
}
1条答案
按热度按时间ar7v8xwq1#
通过将maxInstances添加到我的firebase.json解决