firebasegoogle-cloud-functions

Cloud Functions for Firebase Deployment issue


I'm trying to create some Firebase Cloud Functions but every time a I try to deploy with firebase deploy --only functions the build is failing with no logs in Cloud Build:

No logs

I'm using the template project created using firebase init functions and then uncomment:

exports.helloWorld = onRequest((request, response) => {
  logger.info("Hello logs!", { structuredData: true });
  response.send("Hello from Firebase!");
});

The console message is:

Build failed with status: FAILURE and message: An unexpected error occurred. Refer to build logs: https://console.cloud.google.com/cloud-build/builds;region=us-central1/.... For more details see the logs at https://console.cloud.google.com/cloud-build/builds;region=us-central1/... Functions deploy had errors with the following functions: helloWorld(us-central1) Error: There was an error deploying functions

My Account is Owner and I should be able to deploy anything.


Solution

  • I manged to find the issue with logs and deploy.

    The issue was related to the service account running the buildĀ that does not have permission to write logs, i added role roles/logging.logWriter and then all logs appeared as normal.