-
Notifications
You must be signed in to change notification settings - Fork 979
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
Function names cannot contain dashes. #1735
Comments
@joehan or @laurenzlong do you know which is correct? Can function names contain dashes? |
Unsure if this is related, but running 7.6.1 I can't emulate my functions with hyphens in the name either, but with a different error thrown.
|
@eghernqvist I think what's happening there is it's trying to do the mathematical operation This is not legal JavaScript:
If you try to run that you will get:
However Google Cloud Functions does allow dashes in function names because they are not literal JavaScript functions. Can you show how you're defining your |
@samtstern I've grouped my functions in the way the Firebase CLI docs recommend grouping functions. I'm using the emulator instead to get around this, but a small tip or note in the linked docs that |
@eghernqvist if we can't find a way to fix this behavior we will definitely add a documentation note. Can you show how you're grouping your functions though? I thought you'd get functions named |
@samtstern Re-read the docs and it does seem like getting Basically my setup is this:
const createUser = functions.auth.user()
.onCreate(() => {...})
export default { createUser }
import auth from './auth'
export { auth } Tried with import auth from './auth'
export default { auth }
// results in `default-auth-api` function name Also tried changing it to: import authApi from './auth'
export const auth = authApi
// results in function named `auth-api`, still |
I think the info line in // firebase functions:shell
blah.get({}) // index.js
exports.blah = {
get: functions.https.onCall(...)
} |
Hmmm yeah there's definitely some inconsistent stuff going on here. I tried with these functions: exports.myGroup = {
first: functions.https.onRequest(async (request, response) => {
response.json({ name: "first" });
}),
second: functions.https.onRequest(async (request, response) => {
response.json({ name: "second" });
}),
} When I run
However if I actually want to run the functions in the shell I need to do When I deploy (no args) I see this:
So in URL form they use the
If I use the |
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):
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. |
#1972 is merged so going to close this as I think that's as much as we can do to reduce this confusion! |
Still experiencing this firebase-tools |
[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:
[REQUIRED] Actual behavior
The function name errors out the functions emulator.
Error: Function name "DriveActivity-getActivity" is invalid. Function names cannot contain dashes.
The text was updated successfully, but these errors were encountered: