firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Deploy Complete is not true, function on Google Cloud does not update.

Open Zelfapp opened this issue 2 years ago • 4 comments

[REQUIRED] Environment info

firebase-tools: 11.14.3

Platform: Manjaro Linux

[REQUIRED] Test case

I'm running the following as I've done a thousand times before. This is a v2 function located in us-east4.

firebase deploy --only functions:myFunction

[REQUIRED] Steps to reproduce

firebase deploy --only functions:[my function]

[REQUIRED] Expected behavior

If Deploy Complete! displays, then the function should be updated on GCF.

[REQUIRED] Actual behavior

I get the following CLI output, which ends with Deploy Complete!. However, the function is not getting updated on GCF. If it doesn't actually deploy, then it should not state Deploy Complete!, and there should be better info explaining why.

=== Deploying to 'my-app'...

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

> [email protected] lint
> eslint --ext .js,.ts .

Running command: npm --prefix "$RESOURCE_DIR" run build

> [email protected] 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...
✔  functions: required API cloudbuild.googleapis.com is enabled
✔  functions: required API cloudfunctions.googleapis.com is enabled
✔  artifactregistry: required API artifactregistry.googleapis.com is enabled
i  functions: preparing codebase default for deployment
⚠  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: preparing functions directory for uploading...
i  functions: packaged /home/me/AndroidStudioProjects/order_fulfillment/functions (286.87 KB) for uploading
i  functions: packaged /home/me/AndroidStudioProjects/order_fulfillment/functions (287.13 KB) 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 eventarc.googleapis.com is enabled
✔  functions: required API run.googleapis.com is enabled
✔  functions: required API storage.googleapis.com is enabled
✔  functions: required API pubsub.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
i  functions: cleaning up build files...

✔  Deploy complete!

There is a warning that my package.json is outdated for firebase-fuctions, which is currently "firebase-functions": "^3.24.1". However, when I try to run npm install --save firebase-functions@latest, which installs 4.0 RC it breaks. So I reverted to 3.24.1. Is the outdated packages.json causing the deploy to fail? There is nothing in the logs other than the output above. My function has zero errors in it and passes all lints, but it will not update on GCF.

Note: Typically a deploy for a function takes a bit of time. However, this completes in maybe 10 seconds, which is odd for a deploy.

Zelfapp avatar Oct 14 '22 17:10 Zelfapp

Interesting. Would you mind running the deploy with --debug and seeing if there's useful logs to share? Sounds like something our Functions team will want to look at.

bkendall avatar Oct 14 '22 23:10 bkendall

Hi! I am getting this same issue. When I updated to firebase-function@latest I was getting a bunch of errors on npm install about conflicting libraries, so I figured it would just be easier to revert the library update. Some of my other function deploys seem to work. Should be mentioned that I did a bunch of refactoring to my backend code!

douglasrcjames avatar Oct 15 '22 01:10 douglasrcjames

@bkendall running with --debug. The upload is created, but then it is omitted and the operation states functions folder uploaded successfully, but then nothing is deployed.

[2022-10-15T04:35:21.900Z] >>> [apiv2][body] PUT https://storage.googleapis.com/uploads-615904486750.us-east4.cloudfunctions.appspot.com/55a6f5c3-60b4-45f8-9392-343370f7f3c8.zip [stream]
[2022-10-15T04:35:22.294Z] <<< [apiv2][status] PUT https://storage.googleapis.com/uploads-615904486750.us-east4.cloudfunctions.appspot.com/55a6f5c3-60b4-45f8-9392-343370f7f3c8.zip 200
[2022-10-15T04:35:22.294Z] <<< [apiv2][body] PUT https://storage.googleapis.com/uploads-615904486750.us-east4.cloudfunctions.appspot.com/55a6f5c3-60b4-45f8-9392-343370f7f3c8.zip [omitted]
✔  functions: functions folder uploaded successfully 
[2022-10-15T04:35:22.296Z] Total Function Deployment time: 0
[2022-10-15T04:35:22.296Z] 0 Functions Deployed
[2022-10-15T04:35:22.296Z] 0 Functions Errored
[2022-10-15T04:35:22.296Z] 0 Function Deployments Aborted
[2022-10-15T04:35:22.296Z] Average Function Deployment time: NaN
[2022-10-15T04:35:22.296Z] Not printing URL for HTTPS function. Typically this means it didn't match a filter or we failed deployment
[2022-10-15T04:35:22.297Z] Not printing URL for HTTPS function. Typically this means it didn't match a filter or we failed deployment
i  functions: cleaning up build files... 

Zelfapp avatar Oct 15 '22 04:10 Zelfapp

@bkendall addendum: In my case, my brain was malfunctioning and my function, which is a v2 GCF does not allow uppercase letters in the function name, unlike v1, and I was typing my function in v1 camelcase. So instead of typing firebase deploy --only functions:myapp I was typing firebase deploy --only functions:myApp.

However, I would still consider this an issue that should be resolved in firebase deploy, it should have returned that I had no function named myApp and failed, rather than stating Deploy Complete!.

Zelfapp avatar Oct 15 '22 05:10 Zelfapp

Quick update that I was able to successfully deploy after fixing a repeated handler function being passed to an onCreated and onUpdate listeners. I also needed to remove my typescript functions return declarations... for some reason if I set the function return decl to Promise<any> it wouldn't deploy, but if I just removed that (and now have a warning), they deployed successfully. I will hopefully find a way to remove those warnings without failing the deploy, but for now it seems to be "fixed"!

douglasrcjames avatar Oct 21 '22 21:10 douglasrcjames

@Zelfapp I'm going to change this from a bug to a feature request for better error handling to improve the devx and we'll try to prioritize the work internally

colerogers avatar Oct 24 '22 19:10 colerogers