Florian
Florian

Reputation: 563

Firebase cloud function deploy error

irregularly my firebase deployment get stuck at this log:

i  functions: updating function [FUNCTION NAME]...

After canceling the deploy and retrying it throws the following error message:

⚠  functions: failed to update function resetBadgeCount
⚠  functions: HTTP Error: 400, An operation on function [FUNCTION NAME] 
in region us-central1 in project [PROJECT NAME] is already in progress. 
Please try again later.

So it seams like that the deploy got stuck and kept in the pipeline blocking further deploys. After a while it let me deploy the functions normally again. But is there an explanation for this? Or maybe even a word around?

Upvotes: 54

Views: 42601

Answers (10)

Zahid Shaikh
Zahid Shaikh

Reputation: 103

These are few possible scenarios that I've faced:

  1. Project is not git initiated
  2. functions/ directory doesn't have node_modules installed
  3. If you have already deployed your project, but redeploying is causing issues, you'll have to check your Firebase dashboard -> functions -> you might see a red exclamation mark next to your function that is causing the issue, delete it and redeploy.

Upvotes: 0

Muhammad Ahmed Hassan
Muhammad Ahmed Hassan

Reputation: 539

Make sure you've installed dependencies in the functions directory.

for more information about you function you can go to this page

Upvotes: 0

Abraham
Abraham

Reputation: 15830

Try this

You can fix the issue much easier by examining the actual logs using this command to open the log

firebase functions:log

The specific issue will be visible there. I sometimes even had errors as simple as a missing package in package.json

Upvotes: 16

Alex Rosen
Alex Rosen

Reputation: 1

Set your directory to your project directory \functions then run this command: npm install -g firebase-tools

Upvotes: -1

Leonardo Rick
Leonardo Rick

Reputation: 788

For me it was the node version. Turns out I had the 15.x on my machine and the 12.x on the server. Just updating it solved my upload issue

Upvotes: 0

PinkyXW
PinkyXW

Reputation: 31

also you can wait a few minutes and you will get an error with {"code":10,"message":"ABORTED"}, then you can deploy again.

Upvotes: 1

jivan patel
jivan patel

Reputation: 212

just copy your index.js to some where else and delete function form firebasa function console

  1. firebase init -and overe write all file again
  2. past index.js text again
  3. deploy...

Upvotes: 0

Konstantin Konopko
Konstantin Konopko

Reputation: 5421

  1. Comment or cut your function
  2. Deploy
  3. Uncomment or paste back the function
  4. Rename the function
  5. Deploy
  6. Rename the function back
  7. Deploy

Upvotes: 4

Shahnaz Khan
Shahnaz Khan

Reputation: 1155

Go to Google cloud functions console and see if there is red exclamation mark against your function. Then select that particular function and try to delete. once it gets deleted from there, you can deploy again successfully. if it is showing spinner, then wait till it shows red mark.

Upvotes: 66

John Connor
John Connor

Reputation: 109

You can temporarily rename your function:

$ firebase deploy --only functions

...

i functions: deleting function onSameDataChanged...

i functions: creating function onSameDataChanged1...

...

✔ functions: all functions deployed successfully!

✔ Deploy complete!

Upvotes: 5

Related Questions