question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Function names cannot contain dashes.

See original GitHub issue

[REQUIRED] Environment info

firebase-tools: 7.6.0

Platform: Windows WSL 1

[REQUIRED] Test case

Provide a function name that contains a ‘-’ The emulator will error out with an error similar to:
Error: Function name “DriveActivity-getActivity” is invalid. Function names cannot contain dashes.

The function emulator does allow for ‘.’ in the name but those are invalid in function names.

[REQUIRED] Steps to reproduce

Create a function with a ‘-’ in the name.
run firebase functions:shell

[REQUIRED] Expected behavior

According to the Functions UI in the cloud console:

Name must start with a letter followed by up to 62 letters, numbers, or hyphens, and cannot end with a hyphen

[REQUIRED] Actual behavior

The function name errors out the functions emulator.
Error: Function name “DriveActivity-getActivity” is invalid. Function names cannot contain dashes.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
samtsterncommented, Feb 14, 2020

Ok I have sent out #1972 to address the confusion.

Here’s what’s going on (I asked someone who has been around Cloud Functions longer than I have):

  • GCF allows - in function names, but we don’t in the Firebase CLI (explained below)
  • When you group functions using exports.group = { functionA: ..., functionB: ... } we wanted to make the process intuitive and Javascript-y. So we use . notation to refer to those functions wherever possible. You do --deploy only:group.functionA, etc.
  • Because . is not a valid name in a GCF function, when we deploy we replace the . with a - so that in the URL that function would be called group-functionA.
  • In the functions:shell we wanted to reflect your code, so the function is defined as group.functionA. However the log message in functions:shell was showing the deployed name, which is wrong.

So I hope that makes sense! I do agree it’s confusing but changing this decision now would be hugely disruptive for a small benefit. So I hope that #1972 reduces confusion.

1reaction
tmk1991commented, Dec 25, 2021

Still experiencing this firebase-tools 9.23.3

Read more comments on GitHub >

github_iconTop Results From Across the Web

function name(s) can only contain letters, numbers, hyphens ...
node. js - Failed to deploy function: function name(s) can only contain letters, numbers, hyphens, and not exceed 62 characters in length - ......
Read more >
Will it be bad that a function or script name contains dash ...
Yes, it's fine to use dashes in function names in bash. Here's an example of a project using function ...
Read more >
Why does Python not allow the usage of hyphens for function ...
It's true that hyphens can be used in variable names in languages such as Lisp (in fact "kebab-case" names ... A variable name...
Read more >
hyphens in function names - Google Groups
Is there a rule of thumb to apply when deciding whether to separate multiple words in a function name with hyphens? I can't...
Read more >
Organize multiple functions | Cloud Functions for Firebase
You may have too many functions to reasonably fit in a single file, or different teams ... lowercase letters, numeric characters, underscores, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found