firebase / firebase-tools

The Firebase Command Line Tools
MIT License
3.97k stars 915 forks source link

V2 Functions with uppercase letters are not deployed #7344

Closed becjit closed 1 week ago

becjit commented 1 week ago

[REQUIRED] Environment info

firebase-tools: [13.11.2]

mac

[REQUIRED] Test case

[REQUIRED] Steps to reproduce

create or deploy any functions with uppercase

[REQUIRED] Expected behavior

Should deploy

[REQUIRED] Actual behavior

v2 function name(s) can only contain lower case letters, numbers, hyphens, and not exceed 62 characters in length

google-oss-bot commented 1 week ago

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.

KSiejka commented 1 week ago

Can you run firebase deploy --debug and check the error logs? It works fine on my end, and all of my function's names use camelCase.

unxavi commented 1 week ago

@KSiejka without debug I am hitting this:

Error: Cannot set CPU on the functions my-Function-onCreate because they are GCF gen 1
KSiejka commented 1 week ago

@KSiejka without debug I am hitting this:

Error: Cannot set CPU on the functions my-Function-onCreate because they are GCF gen 1

According to this comment you are trying to downgrade function from v2 to v1. If that's not the case, make sure your firebase-tools are upgraded to the newest version and try importing the v2 functions library to force it to be V2.

unxavi commented 1 week ago

@KSiejka i am not trying to downgrade anything, before #7341 start to hit error this morning, the same codebase was deploying.

This is the same codebase that is using a v2 function and it was deploying some hours ago and no changes has occur on the dependencies (which are latests) and not change on the code, but thanks for your comment anyways

jesus-mg-ios commented 1 week ago

Same here, Is there any ETA fix on this?

becjit commented 1 week ago

I downgraded firebase-tools to 11.x and it started working

unxavi commented 1 week ago

this is working for me now with the latests firebase-tools

aalej commented 1 week ago

Hey folks, I’m currently trying to reproduce this issue. Similar to @KSiejka, I’m able to deploy functions without any issues. For those still encountering this, could you please provide code snippets of the functions you’re trying to deploy?

From what I can gather based on the report, functions names with uppercase letters like below should raise issues during deployments:

const { onRequest } = require("firebase-functions/v2/https");
const logger = require("firebase-functions/logger");
const { onDocumentCreated } = require("firebase-functions/v2/firestore");

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

exports.myFunctionOnCreate = onDocumentCreated("users/{userId}", (event) => {
   const snapshot = event.data;
   if (!snapshot) {
       console.log("No data associated with the event");
       return;
   }
   const data = snapshot.data();
   const name = data.name;
   logger.info("Username:", name);
});

Please let me know if I’m missing anything here. I’m using firebase-tools v13.11.2 for deploying functions.

unxavi commented 1 week ago

Right now for me is working back again and I have my functions with uppercase letters, for example: "user-Profile-onCreate"

becjit commented 1 week ago

Hey folks, I’m currently trying to reproduce this issue. Similar to @KSiejka, I’m able to deploy functions without any issues. For those still encountering this, could you please provide code snippets of the functions you’re trying to deploy?

From what I can gather based on the report, functions names with uppercase letters like below should raise issues during deployments:

const { onRequest } = require("firebase-functions/v2/https");
const logger = require("firebase-functions/logger");
const { onDocumentCreated } = require("firebase-functions/v2/firestore");

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

exports.myFunctionOnCreate = onDocumentCreated("users/{userId}", (event) => {
   const snapshot = event.data;
   if (!snapshot) {
       console.log("No data associated with the event");
       return;
   }
   const data = snapshot.data();
   const name = data.name;
   logger.info("Username:", name);
});

Please let me know if I’m missing anything here. I’m using firebase-tools v13.11.2 for deploying functions.

This was causing issue

aalej commented 1 week ago

I’m still unable to reproduce the issue. Any chance you could try running firebase deploy --debug while using firebase-tools v13.11.2 to see if the issue would still persist? If the issue still occurs, could you share the contents of the firebase-debug.log file? Please remove any personal identifiable information(PII) before sharing.

Also, I can’t seem to find the exact error message you shared. The closest error message I could find was from

https://github.com/firebase/firebase-tools/blob/d1a372e99a1246a9719828589a5270d1290c9dd1/src/deploy/functions/validate.ts#L200-L210

But this would raise an error similar to

Error: <INVALID_FUNCTION_NAME> function name(s) can only contain letters, numbers, hyphens, and not exceed 62 characters in length

Could you check if you’re using an older version of firebase-tools? The naming restriction was lifted in v11.29.0.

becjit commented 1 week ago

Thnx I actually downgraded to unblock myself. Feel free to close this. If I face this issue post upgrade will reopen or file a new one

On Thu, 20 Jun 2024 at 1:54 AM, aalej @.***> wrote:

I’m still unable to reproduce the issue. Any chance you could try running firebase deploy --debug while using firebase-tools v13.11.2 to see if the issue would still persist? If the issue still occurs, could you share the contents of the firebase-debug.log file? Please remove any personal identifiable information(PII) before sharing.

Also, I can’t seem to find the exact error message you shared. The closest error message I could find was from https://github.com/firebase/firebase-tools/blob/master/src/deploy/functions/validate.ts#L200-L210, but this would raise an error similar to

Error: function name(s) can only contain letters, numbers, hyphens, and not exceed 62 characters in length

Could you check if you’re using an older version of firebase-tools? The naming restriction was lifted in v11.29.0 https://github.com/firebase/firebase-tools/releases/tag/v11.29.0.

— Reply to this email directly, view it on GitHub https://github.com/firebase/firebase-tools/issues/7344#issuecomment-2179415457, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ4MLWXYCRGFX6KRAFQSPTZIHSHNAVCNFSM6AAAAABJRXYPNGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZZGQYTKNBVG4 . You are receiving this because you authored the thread.Message ID: @.***>