Skip to content

Grouping functions doesn't work anymore in firebase-tools 12.6.0 with TS #6408

Closed

Description

@descampsk

[REQUIRED] Environment info

firebase-tools: 12.6.0

Platform: : Ubuntu

[REQUIRED] Test case

Grouping functions doesn't work anymore in firebase-tools 12.6.0

[REQUIRED] Steps to reproduce

Init a firebase project with Typescript.

{
  "functions": [
    {
      "source": "functions",
      "codebase": "default",
      "ignore": [
        "node_modules",
        ".git",
        "firebase-debug.log",
        "firebase-debug.*.log"
      ],
      "predeploy": [
        "npm --prefix \"$RESOURCE_DIR\" run build"
      ]
    }
  ]
}

Write index.ts:

import { onRequest } from 'firebase-functions/v2/https'

export const Hello = {
  world: onRequest((req, res) => {
    res.send('Hello World')
  })
}

[REQUIRED] Expected behavior

Install [email protected]

npm install -g [email protected]

Deploy the function firebase deploy --only functions

It works:

✔  functions: functions folder uploaded successfully
i  functions: creating Node.js 20 (2nd Gen) function Hello-world(us-central1)...
✔  functions[Hello-world(us-central1)] Successful create operation.
Function URL (Hello-world(us-central1)): https://hello-world-nknfuqmg3q-uc.a.run.app
i  functions: cleaning up build files...

✔  Deploy complete!

[REQUIRED] Actual behavior

Install [email protected]

npm install -g [email protected]

Deploy the function firebase deploy --only functions

It fail:

i  functions: creating Node.js 20 (2nd Gen) function Hello-world(us-central1)...
Could not create or update Cloud Run service hello-world, Container Healthcheck failed. Revision 'hello-world-00001-pav' is not ready and cannot serve traffic. The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable. Logs for this revision might contain more information.

Logs URL: https://console.cloud.google.com/logs/viewer?project=nomnomnest&resource=cloud_run_revision/service_name/hello-world/revision_name/hello-world-00001-pav&advancedFilter=resource.type%3D%22cloud_run_revision%22%0Aresource.labels.service_name%3D%22hello-world%22%0Aresource.labels.revision_name%3D%22hello-world-00001-pav%22 
For more troubleshooting guidance, see https://cloud.google.com/run/docs/troubleshooting#container-failed-to-start

Functions deploy had errors with the following functions:
        Hello-world(us-central1)
i  functions: cleaning up build files...

Error: There was an error deploying functions

CloudRun Logs:
image

Activity

  1. akb5566 commented on Sep 27, 2023

    @akb5566

    Can confirm this as well.

    I was using [email protected] with Typescript.
    I did the following command:

    firebase deploy --only functions:group1,functions:group2,functions:group3
    

    After those functions were successfully deployed, Nodejs notified me that a new version of firebase-tools is available.
    So I naturally updated firebase-tools to 12.6.0.

    Then I ran the following command to continue deploy other functions:

    firebase deploy --only functions:group4,functions:group5,functions:group6
    

    But all the functions failed to deploy. And I got the same error as OP.
    I ran the following command that were successfully executed in 12.5.3, but they also all failed to deploy in 12.6.0.

    firebase deploy --only functions:group1,functions:group2,functions:group3
    
    DSADZ

    --

    Edit 1:

    After I made this comment, I tried [email protected], [email protected], [email protected], but they all still failed to deployed with the same error. Which is weird because I was able to deploy literally the second before I updated firebase-tools to 12.6.0. But now I cannot deploy with any version of firebase-tools.

    Edit 2:

    It seemed like [email protected] somehow "corrupted" my functions that made them unable to be replaced by redeploy with any version of firebase-tools again.
    After manually deleting all the functions from console.cloud.google.com, I am now able to deploy functions again using [email protected].

    I also tried to delete all the functions from console.cloud.google.com. and deploy with [email protected]. But it failed and showed the same error as OP.

  2. aalej commented on Sep 27, 2023

    @aalej
    Contributor

    Hi everyone, thanks for reporting this issue. I was able to replicate the behavior mentioned. I tried deploying the code snippet provided using firebase-tools v12.5.4 and no issues were raised:

    import { onRequest } from 'firebase-functions/v2/https'
    
    export const Hello = {
      world: onRequest((req, res) => {
        res.send('Hello World')
      })
    }

    However, after upgrading to firebase-tools v12.6.0, it raises an error when trying to deploy the same functions from above.

    Let me raise this to our engineering team so that they can take a look and investigate the issue.

  3. milo- commented on Sep 27, 2023

    @milo-

    The last two versions (12.5.0 and 12.6.0) of firebase-tools have had critical bugs in them that should not have made it into a release.

    How are the firebase team looking to improve the release and testing process to ensure that these issues don't keep occurring?

    2.5.0 issue: #6290

  4. joehan commented on Sep 27, 2023

    @joehan
    Member

    Hey all, fix is coming ASAP for this issue. This also highlighted a gap in our integration tests - we'll be adding coverage for function groups to catch issues like this in the future.

  5. mortenbekditlevsen commented on Oct 4, 2023

    @mortenbekditlevsen

    The PR referred to above does not fix the issue. It does a functionId.replace("-", ".") which replaces the first instance of - with . and not all instances. It ought to use replaceAll instead.
    @joehan

  6. aalej commented on Oct 4, 2023

    @aalej
    Contributor

    Thanks for pointing this out @mortenbekditlevsen, functionId.replace("-", ".") was changed to functionId.replaceAll("-", ".") in #6423. This should be rolled out in the next release.

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