Skip to content

Multilevel function declaration deployment failed - this stoped working #6419

Closed

Description

@vincekruger

Environment info

firebase-tools: 12.6.1

Platform: macOS 14

Test case

Steps to reproduce

I've discovered something very strange.
This issue started yesterday after upgrading to 12.6.1, however, it shouldn't be related, but it's the only thing that changed.

Fail

Deploying functions deploy --only functions

index.js example

export const codebase = {
  httpFunc,
  trigger: {
    trigger1,
    trigger2,
  },
}
Could not create or update Cloud Run service {function_name}, Container Healthcheck failed. Revision '{archive}' 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.

The logs are unhelpful and don't provide any clues.

now if I go and shuffle the index file around and have only one level of exports everything works perfectly. Zero problems.

export const codebase = {
  httpFunc,
  trigger1,
  trigger2,
}

This is weird behaviour.

Expected behavior

Deployment successful.

Actual behavior

Deployment fails.

Activity

  1. google-oss-bot commented on Sep 29, 2023

    @google-oss-bot
    Collaborator

    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. aalej commented on Sep 29, 2023

    @aalej
    Contributor

    Hi @vincekruger, thanks for reporting this issue. I was able to replicate the error you mentioned using the sample code snippet you provided. I modified it a bit to include functions code:

    import {onRequest} from "firebase-functions/v2/https";
    import {
      onDocumentWritten,
    } from "firebase-functions/v2/firestore";
    
    const httpFunc = onRequest((req, res) => {
      res.send("Hello World");
    });
    
    const trigger1 = onDocumentWritten("users/{id}", (event) => {
      console.log(`users: ${event}`);
    });
    
    const trigger2 = onDocumentWritten("pets/{id}", (event) => {
      console.log(`pets: ${event}`);
    });
    
    export const codebase = {
      httpFunc,
      trigger: {
        trigger1,
        trigger2,
      },
    };

    The above code snippet would result in an error. However, as you mentioned, rearranging them to the code snippet below raises no errors during deployment:

    export const codebase = {
      httpFunc,
      trigger1,
      trigger2,
    }

    Let me notify our team about this issue so that we can investigate the cause.

  3. vincekruger commented on Sep 29, 2023

    @vincekruger
    Author

    Woohoo I'm not crazy! 🤪

  4. joehan commented on Oct 3, 2023

    @joehan
    Member

    Should be fixed by #6423

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