Skip to content

Service Account seems to disappear #1275

Closed

Description

@fgruchala

Related issues

[REQUIRED] Version info

node: 16

firebase-functions: 4.0.1

firebase-tools: 11.15.0

firebase-admin: 11.2.0

[REQUIRED] Test case

[REQUIRED] Steps to reproduce

  1. Deploy via the firebase-tools CLI a Cloud Function with a dedicated service account ;
  2. Check in the Google Cloud console, when you edit the previous Cloud Function, you can see that this field is blank.

Capture d’écran 2022-10-21 à 18 10 46

[REQUIRED] Expected behavior

In the Google Cloud console > Cloud Functions > edit one
In the Runtime Service Account, no change has to be done, the initial service account has to be the same as the previous deployment.

[REQUIRED] Actual behavior

No error in the deployment but the initial service account seems to be replace by a "blank" one.

Were you able to successfully deploy your functions?

Yes, but my dedicated service account used to run the Cloud Function has specific IAM rights, so I have a service interrupt for my users.

Activity

  1. google-oss-bot commented on Oct 21, 2022

    @google-oss-bot
    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 have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.
  2. inlined commented on Oct 31, 2022

    @inlined
    Member

    Previously, cloud functions for firebase did not support many Cloud features, so we decided to leave any unspecified fields alone. This confused many customers who expected that deleting a configuration from their code to change that code, so in 4.0 we made a breaking change: your backend will be made to explicitly match what is in your code by default.

    You can revert this behavior change using the new preserveExistingChanges option, or (recommended) you can specify the serviceAccount your function runs as in code. Both v1 and v2 support a serviceAccount option. If you want to specify different service accounts for different projects, I recommend checking out our new support for parmaterized codebases as well.

  3. fgruchala commented on Nov 7, 2022

    @fgruchala
    Author

    Hi @inlined ,

    I'm trying using parameterized codebases but I have this failure :

    [2022-11-07T10:54:51.173Z] Got response from /__/functions.yaml Failed to generate manifest from function source: TypeError: serviceAccount.includes is not a function
    [2022-11-07T10:54:51.177Z] Failed to parse functions.yamlincomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line at line 1, column 60:
         ...  from function source: TypeError: serviceAccount.includes is not ... 
                                             ^ {"name":"YAMLException","reason":"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line","mark":{"name":null,"buffer":"Failed to generate manifest from function source: TypeError: serviceAccount.includes is not a function\n\u0000","position":59,"line":0,"column":59},"message":"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line at line 1, column 60:\n     ...  from function source: TypeError: serviceAccount.includes is not ... \n                                         ^"}
    [2022-11-07T10:54:51.181Z] shutdown requested via /__/quitquitquit
    
    
    Error: Failed to load function definition from source: Failed to generate manifest from function source: TypeError: serviceAccount.includes is not a function
    Error: Process completed with exit code 1.
    

    In my code, I have this :

    const {defineString} = require("firebase-functions/params");
    
    const configuration = {
       ...,
       runtimeOptions: {
            serviceAccount: defineString("CF_SERVICE_ACCOUNT", {default: "default"}),
       }
    }
    

    The CF_SERVICE_ACCOUNT is configured in my functions/.env.[default|preproduction|production] like this : CF_SERVICE_ACCOUNT=cloud-functions-runner@<PROJECT_ID>.iam.gserviceaccount.com

    Do you have an idea where I made a mistake ?

    I upgraded to the latest Firebase tools CLI : 11.16.0

  4. taeold commented on Nov 7, 2022

    @taeold
    Contributor

    @fgruchala I think we should take a look at this issue separately. Created a new bug!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions