Reputation: 768
My code project is a [email protected]
When I upload my functions using: firebase deploy --only functions, they are upload successfully
=== 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!
As you can see, there is no function called "ssrcasavelerosbotevbl", so I guess the issue is not with my functions.
Then for some reason when I run
firebase deploy --only hosting
The command build my web, then it tries to deploy hosting AND functions, when I explicitly said --only hosting.
Well this behavior has been the same since day 1 with this project (in other projects I'm able to only upload/update my website), but it has not been an issue till 3 days ago, when I try to do the firebase deploy --only hosting, this is the console output:
=== 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
So I don't know why it is asking for a ssrcasavelerosbotevbl function. I have removed that function a long time ago.
So because of the behavior an this error, I am not able to update my webpage
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 of my frontend
{
"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 of functions
{
"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
}
Upvotes: 0
Views: 1038
Reputation: 768
Solved by adding maxInstances to my firebase.json
{
"functions": {
"source": "functions"
},
"hosting": {
"source": ".",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"frameworksBackend": {
"region": "us-central1",
"maxInstances": 2
}
}
}
Upvotes: 0