-
Notifications
You must be signed in to change notification settings - Fork 63
Function creation in the same namespace throws #69
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
Comments
This was intentional as templates could have files named the same, thus overwriting or failing if you try to write them into the same namespace. We could add a check to see if it would overwrite and complete the action if it's safe or throw an error if not. Or we could start adding suffixes to the file names ( What do you think? |
Yeah the concept of namespaces was introduced because we wanted to support multi file templates and with those you'd hit the issue that Phil just described. So at least I'm fine with marking this as an intended behavior for now |
Understood. :) For good DX I'd still love to improve here and not go with a
This seems absolutely reasonable to me. A short error message with |
I'm happy to merge a PR if you want to work on it 😊 But what would you expect the behavior to be for the following:
Both create a token.js file in functions/example/ Would you expect the second one to do nothing? What would happen if both of those have multiple files they write but only one of those overlaps? |
I think this could be tackled in stages... 🙈 First, succeed if there are no conflicts and allow files under the same namespace. If there is a conflict fail hard with a warning that these two templates conflict with each other. Further improvements, could follow. :) |
@philnash worked on this experience so I let him call the shot here :) that works for me |
I think this is a reasonable approach to start with. I'm not sure of the ROI on going much further as I think it might be a lot more work than its worth. On the other hand, we also control the |
Agree – this first stage would totally do the job for me. :) |
@stefanjudis will you be working on this? Also to your point @philnash: the chat, video and sync token templates already all use "token.js" as filenames. Just as an FIY |
Good spot! We should make them |
Currently, it is not possible to create multiple function templates using the same namespace via
twilio serverless:new
ortwilio-run new
.My use case was that I wanted to create functions for sms and call forwarding under the same namespace
forward-everything
.I tracked down where the exception is thrown and the template creation expects the namespace dir to not exist?
That surprised me and I think it's a bug, because I was expecting that I can create several functions under the same namespace. :)
The text was updated successfully, but these errors were encountered: