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

Multilevel function declaration deployment failed - this stoped working #6419

Closed
vincekruger opened this issue Sep 29, 2023 · 4 comments
Closed

Comments

@vincekruger
Copy link

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.

@google-oss-bot
Copy link
Contributor

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.

@aalej
Copy link
Contributor

aalej commented Sep 29, 2023

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.

@vincekruger
Copy link
Author

Woohoo I'm not crazy! 🤪

@joehan
Copy link
Contributor

joehan commented Oct 3, 2023

Should be fixed by #6423

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

No branches or pull requests

4 participants