Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud Functions not deploying: Build fails #795

Closed
aravindvnair99 opened this issue Oct 15, 2020 · 111 comments
Closed

Cloud Functions not deploying: Build fails #795

aravindvnair99 opened this issue Oct 15, 2020 · 111 comments
Labels
Needs: Author Feedback Issues awaiting author feedback no-recent-activity

Comments

@aravindvnair99
Copy link

aravindvnair99 commented Oct 15, 2020

Version info

node: v10.18.1 (Issue is present irrespective of version)

firebase-functions: 3.6.1 (Issue is present irrespective of version)

firebase-tools: 8.12.1 (Issue is present irrespective of version)

firebase-admin: 9.2.0 (Issue is present irrespective of version)

Steps to reproduce

I've been trying to deploy my existing project with just a few EJS changes. But it doesn't deploy even if I redeploy old code.

Expected behavior

Should deploy

Actual behavior

{"@type":"type.googleapis.com/google.cloud.audit.AuditLog","status":{"code":13,"message":"Build failed: Build error details not available. Please check the logs at https://console.cloud.google.com/logs/viewer?project=[Name removed]&advancedFilter=resource.type%3Dbuild%0Aresource.labels.build_id%3D[ID removed]%0AlogName%3Dprojects%2F[Name removed]%2Flogs%2Fcloudbuild"},"authenticationInfo":{"principalEmail":"[Email removed]"},"serviceName":"cloudfunctions.googleapis.com","methodName":"google.cloud.functions.v1.CloudFunctionsService.UpdateFunction","resourceName":"projects/[Name removed]/locations/us-central1/functions/app"} 

Were you able to successfully deploy your functions?

No, I ended up with this:

⚠  functions[app(us-central1)]: Deployment error.
Build failed: Build error details not available. Please check the logs at https://console.cloud.google.com/logs/viewer?project=[Name removed]&advancedFilter=resource.type%3Dbuild%0Aresource.labels.build_id%3D[ID Removed]%0AlogName%3Dprojects%2F[Name removed]%2Flogs%2Fcloudbuild


Functions deploy had errors with the following functions:
	app


To try redeploying those functions, run:
    firebase deploy --only "functions:app"


To continue deploying other features (such as database), run:
    firebase deploy --except functions

Error: Functions did not deploy properly.
@google-oss-bot
Copy link
Collaborator

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@aravindvnair99
Copy link
Author

I fixed it by deleting us.artifacts.[Project ID].appspot.com

@richiricardo
Copy link

Hello, i am having this issue. Any idea on the solution?

@aravindvnair99
Copy link
Author

Hello, i am having this issue. Any idea on the solution?

@richiricardo The solution I mentioned works. Try it out.

@richiricardo
Copy link

How exactly do I do this ?

@aravindvnair99
Copy link
Author

How exactly do I do this ?

@richiricardo You can go to Google Cloud Platform console, navigate to storage and then delete us.artifacts.[Project ID].appspot.com as I mentioned. Then redeploy. Should work fine.

@richiricardo
Copy link

Yo bro msg me priv ?

@aravindvnair99
Copy link
Author

Yo bro msg me priv ?

@richiricardo Sorry mate, you just have to do what I said itself. That's the solution. Worked for others too! If you need additional help, you can reply here. For other issues, start a new issue tracker.

@richiricardo
Copy link

Is it a lot of lines of code ? Or just that one line to remove

@aravindvnair99
Copy link
Author

Is it a lot of lines of code ? Or just that one line to remove

@richiricardo It's not a line of code. That's a storage bucket. You just need to navigate to the storage bucket I mentioned and delete the same in your project provided you have access for it. Else the concerned person has to do it for you.

@richiricardo
Copy link

richiricardo commented Feb 15, 2021 via email

@aravindvnair99
Copy link
Author

There wasn’t any us.artifacts. Only gcf sources - staging - projectid.appspot

@richiricardo [Project ID].appspot.com is the default bucket. As for GCF Sources, is gcf-sources-[PROJECT_NUMBER]-[REGION] the name of the bucket? If it's something else, you need to delete and recreate in this format. Also, you need one for every region you are deploying to.

@isamx
Copy link

isamx commented Feb 23, 2021

Hello So am having the same problem as you guys
I looked for the bucket that you minioned but I couldn't find it
I only found 3:

gcf-sources-537183344133-us-central1

kodx-app.appspot.com
staging.kodx-app.appspot.com

@richiricardo
Copy link

richiricardo commented Feb 23, 2021 via email

@aravindvnair99
Copy link
Author

@isamx Has the issue been resolved for you?

@Shekhar7860
Copy link

I fixed it by deleting us.artifacts.[Project ID].appspot.com

where is this file

@aravindvnair99
Copy link
Author

I fixed it by deleting us.artifacts.[Project ID].appspot.com

where is this file

@Shekhar7860 Please read the thread. I've already mentioned where to go and do what.

@itsmemanivel
Copy link

I fixed it by deleting us.artifacts.[Project ID].appspot.com

@aravindvnair99, The issue is still occurring after deleting the bucket

@aravindvnair99
Copy link
Author

I fixed it by deleting us.artifacts.[Project ID].appspot.com

@aravindvnair99, The issue is still occurring after deleting the bucket

@veluvj Which Node.js version are you using?

@itsmemanivel
Copy link

@veluvj Which Node.js version are you using?

@aravindvnair99 v10.23.3

@aravindvnair99
Copy link
Author

@veluvj Which Node.js version are you using?

@aravindvnair99 v10.23.3

@veluvj Check my reply here: firebase/firebase-tools#2699 (comment)

@lllouiseF
Copy link

I redone the project and it worked.

On Tue, 23 Feb 2021 at 15:38, isamx @.***> wrote: Hello So am having the same problem as you guys I looked for the bucket that you minioned but I couldn't find it I only found 3: gcf-sources-537183344133-us-central1 kodx-app.appspot.com staging.kodx-app.appspot.com — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#795 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASXLIDSEEUG5ASKXQIIIOWTTAPDYXANCNFSM4SRTU6SQ .

hey what did you do i have the same error

@aravindvnair99
Copy link
Author

I redone the project and it worked.

On Tue, 23 Feb 2021 at 15:38, isamx @.***> wrote: Hello So am having the same problem as you guys I looked for the bucket that you minioned but I couldn't find it I only found 3: gcf-sources-537183344133-us-central1 kodx-app.appspot.com staging.kodx-app.appspot.com — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#795 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASXLIDSEEUG5ASKXQIIIOWTTAPDYXANCNFSM4SRTU6SQ .

hey what did you do i have the same error

@lllouiseF Which Node.js version are you using?

@lllouiseF
Copy link

@aravindvnair99 my Node.js version is v15.11.0.

here's my error
Functions deploy had errors with the following functions:
storeImage(us-central1)

To try redeploying those functions, run:
firebase deploy --only "functions:storeImage"

To continue deploying other features (such as database), run:
firebase deploy --except functions

Error: Functions did not deploy properly.

@aravindvnair99
Copy link
Author

@aravindvnair99 my Node.js version is v15.11.0.

here's my error
Functions deploy had errors with the following functions:
storeImage(us-central1)

To try redeploying those functions, run:
firebase deploy --only "functions:storeImage"

To continue deploying other features (such as database), run:
firebase deploy --except functions

Error: Functions did not deploy properly.

@lllouiseF Oh strange... I haven't tried deploying v15 yet on Firebase. But how many buckets do you have in that project and can you name them?

@lllouiseF
Copy link

lllouiseF commented Mar 30, 2021

@aravindvnair99

i just copy this on my one of my course in udemy:

const functions = require('firebase-functions');
const cors = require('cors')({ origin: true });
const Busboy = require('busboy');
const os = require('os');
const path = require('path');
const fs = require('fs');
const uuid = require('uuid/v4');

const { Storage } = require('@google-cloud/storage');

const storage = new Storage({
projectId: 'YOUR_FIREBASE_PROJECT_ID'
});

exports.storeImage = functions.https.onRequest((req, res) => {
return cors(req, res, () => {
if (req.method !== 'POST') {
return res.status(500).json({ message: 'Not allowed.' });
}
const busboy = new Busboy({ headers: req.headers });
let uploadData;
let oldImagePath;

busboy.on('file', (fieldname, file, filename, encoding, mimetype) => {
  const filePath = path.join(os.tmpdir(), filename);
  uploadData = { filePath: filePath, type: mimetype, name: filename };
  file.pipe(fs.createWriteStream(filePath));
});

busboy.on('field', (fieldname, value) => {
  oldImagePath = decodeURIComponent(value);
});

busboy.on('finish', () => {
  const id = uuid();
  let imagePath = 'images/' + id + '-' + uploadData.name;
  if (oldImagePath) {
    imagePath = oldImagePath;
  }

  console.log(uploadData.type);
  return storage
    .bucket('YOUR_FIREBASE_PROJECT_ID.appspot.com')
    .upload(uploadData.filePath, {
      uploadType: 'media',
      destination: imagePath,
      metadata: {
        metadata: {
          contentType: uploadData.type,
          firebaseStorageDownloadTokens: id
        }
      }
    })

    .then(() => {
      return res.status(201).json({
        imageUrl:
          'https://firebasestorage.googleapis.com/v0/b/' +
          storage.bucket('YOUR_FIREBASE_PROJECT_ID.appspot.com').name +
          '/o/' +
          encodeURIComponent(imagePath) +
          '?alt=media&token=' +
          id,
        imagePath: imagePath
      });
    })
    .catch(error => {
      console.log(error);
      return res.status(401).json({ error: 'Unauthorized!' });
    });
});
return busboy.end(req.rawBody);

});
});

then i only changed the project name based on the professor..

@aravindvnair99
Copy link
Author

@aravindvnair99

i just copy this on my one of my course in udemy:
// Code redacted
then i only changed the project name based on the professor..

@lllouiseF As far as I have seen, the code of a project has never been the problem. As stated in my previous message, could you go to your Google Cloud Platform Console, navigate to Cloud Storage and list out the buckets you see?

@google-oss-bot
Copy link
Collaborator

Hey @aravindvnair99. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@aravindvnair99
Copy link
Author

Closing as per discussions with @taeold at firebase/firebase-tools#3359

@Garciconx
Copy link

Updating Node JS to version 16 work for me

"engines": { "node": "16" },

@bdrelling
Copy link

@Garciconx how did you get that to work? I couldn't deploy anything above Node 14 via Firebase Cloud Functions.

@taeold
Copy link
Contributor

taeold commented Sep 27, 2021

@bdrelling Go ahead and open a new issue if you are having problems. Logs would help!

@bdrelling
Copy link

I appreciate your help, but I'm not having any problems, so I'd rather not open an entirely new issue for a simple question in reply to a user on the same thread. Especially given that the documentation does not show that Node 16 is supported yet, so it doesn't strike me as an issue at all. If someone confirms that Node 16 can be used with Cloud Functions, then I'll happily open an issue.

I don't think there's value in stamping out discussion on issues if it could help potential users that continue to land on these PRs after the fact, especially while the issue is still open to comments. And if it's just a matter of noise, anyone can unsubscribe when they want to.

Apologies if I'm misunderstanding you.

@Garciconx
Copy link

@Garciconx how did you get that to work? I couldn't deploy anything above Node 14 via Firebase Cloud Functions.

Sorry at the end I had to set the node version to 14, because 16th version leads to some errors with other libraries.

@taeold
Copy link
Contributor

taeold commented Sep 27, 2021

@bdrelling Hmm we are not aware of any issue with deploying Node.js 16 functions, and since Node.js 16 is in "preview" (https://cloud.google.com/functions/docs/concepts/nodejs-runtime), it would actually help us stamp out any early issues if you are seeing something.

There are 100 different ways a function deploy could fail, and the issue that the original author had experienced is now resolved. I think it's too easy for the team to ignore whatever gets posted here, so I was trying to suggest a better way to signal boost your issue. Sounds like you don't have one(?) so that's jolly.

I guess I should've closed the comments down as you suggested 🤷‍♂️

@bdrelling
Copy link

@taeold if I try to use Node 16 again, I'll be happy to open a new issue with any problems I run into. 👍🏻

I totally get what you mean re: the team missing comments posted in an issue, and appreciate the redirection to open an issue (if I had one).

@DogeIsAwesome1
Copy link

DogeIsAwesome1 commented Sep 30, 2021

i have the same error even deleted the archive could it maybe be my code or ?

exports.addAlgoliaIndex = functions.firestore.document('order/document/serial{serial, productCode}').onCreate((change) => {
  const data = snapshot.data();
  const objectID = snapshot.id;
  return index.saveObject({ ...data, objectID });
});
exports.updateAlgoliaIndex = functions.firestore.document('order/document/serial{serial, productCode}').onUpdate((change) => {
  const newData = change.after.data();
  const objectID = change.after.id;
  return index.saveObject({ ...newData, objectID });

@inlined
Copy link
Member

inlined commented Sep 30, 2021

@DogeIsAwesome1 Your document strings are invalid. {template} strings can only be full components of a slash and must be a valid identifier name. So something like 'order/document/serial/{serial}'

@wpghijsen
Copy link

I have the same error as well when I deploy. As above I first deleted the [Project ID].appspot.com file and then waited 5 minutes and ran the deploy command. The build then fails with the 'Functions deploy had errors with the following functions:' error.
I then tried deleting both the [Project ID].appspot.com and the gcf-sources-[PROJECT_NUMBER]-[REGION] file, waited 5 minutes and deployed. The build then failed with the same error.
The weird thing is, when I look at the gcf-sources-[PROJECT_NUMBER]-[REGION] file in GCP, I see the names of the functions in zip files, but they all show that they take up no memory.

Any Help would be much appreciated

@inlined
Copy link
Member

inlined commented Oct 21, 2021

Please file a support ticket at firebase.google.com/support

@wpghijsen
Copy link

fixed it.. I removed an import for firebase/auth that I was not using

@nelsonlarocca
Copy link

nelsonlarocca commented Oct 31, 2021

hi !
any new about this ?
just moving to:

  "engines": {
    "node": "16"
  },

in the package.json file

execution of
firebase deploy --only functions
throws

Error: package.json in functions directory has an engines field which is unsupported. Valid choices are: {"node": "10"}, {"node":"12"}, and {"node":"14"}.

Deploys to runtimes below Node.js 10 are now disabled in the Firebase CLI. Existing Node.js 8 functions will stop executing on 2021-03-15. Update existing functions to Node.js 10 or greater as soon as possible.

@inlined
Copy link
Member

inlined commented Nov 1, 2021

@nelsonlarocca Looks like you need a newer version of firebase-tools. Try running npm install -g firebase-tools@latest to get a version with support for Node 16.

@faustoct1
Copy link

so what's the solution?

@aravindvnair99
Copy link
Author

so what's the solution?

@faustoct what's the issue you are facing?

@faustoct1
Copy link

so what's the solution?

@faustoct what's the issue you are facing?

it says: ✔ functions: functions folder uploaded successfully

Then
Functions deploy had errors with the following functions:

i  functions: cleaning up build files...
Error: There was an error deploying functions:

all my functions show here... saying Error Failed to update...

@faustoct1
Copy link

@aravindvnair99 any ideia

@aravindvnair99
Copy link
Author

@aravindvnair99 any ideia

@faustoct you need to attach your log files for any of us to pin point your issue.

@faustoct1
Copy link

@aravindvnair99 any ideia

@faustoct you need to attach your log files for any of us to pin point your issue.

@aravindvnair99 ok fixed

@inlined
Copy link
Member

inlined commented Jan 27, 2022

Fixed? I don't see a log file anywhere. I'll repeat again that this is a forum for reporting bugs, not troubleshooting general deploy problems. We have many more people employed to help you with the latter than the former. You'll find very qualified support at your disposal at firebase.google.com/support.

@faustoct1
Copy link

@inlined you are right. I am paid customer and forgot about the the support because I went through the support in Google Cloud dashboard instead Firebase Console.

Yes, I fixed!

@adamsadiq7
Copy link

Haha for people like me who forget the basics, after checking the logs I simply saw that I hadn't included a package in my package.json

@monkeyK1n9
Copy link

How exactly do I do this ?

@richiricardo You can go to Google Cloud Platform console, navigate to storage and then delete us.artifacts.[Project ID].appspot.com as I mentioned. Then redeploy. Should work fine.

Worked for me!

You need to open the project in the Google Cloud Platform console, then storage => bucket. You will see the [Project ID].appspot.com, delete it and open your code editor to run again npm run deploy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Author Feedback Issues awaiting author feedback no-recent-activity
Projects
None yet
Development

No branches or pull requests