Differences between 0.5x and 1.x

I am trying to understand the differences between the 1.0x releases especially as some basic elements are concerned.
I understood that a new concept of services (Services Documentation) was introduced to group functions and dependencies, however, I cannot find examples in documentation with more than one function.


Multiple Function Example Needed

For example, while in 0.5 I could specify a directory to group my functions and already pre-wire all the project files with the details upon creation by using the CLI like so:

serverless function create functions/functionOne

This would ask me a few questions and wire up the config files. Done.

In 1.0
Using a template, it will only create one function, then, everything else has to wired manually?
Is there a way where I can change the yml and have serverless generate the missing functions as stubs?
E.g. if I used this:

functions:
  hello:
    handler: handler.hello
    events:
      - http:
          path: users/hello
          method: get
  world:
    handler: handler.world
  space:
    handler: space.time

Alternatively, could serverless expand the create command and add creation of functions back, the command would expand the yml as needed? Also be able to place functions into subdirectories for organization would be helpful (or it this delegated to “service” organization)


Where has the project definition gone

In 0.5
The creation of a project also created the package.json for node with the assumption that you operated outside the project directory and had serverless create the overall project.

In 1.0
The package.json is gone. The assumption is that you operate inside the target project directory. You have to, in addition,“serverless create” also run “npm init” inside the target project directory.
Could this be simplified?

There are probably more elements where people noticed quirks so additional observations would be helpful to understand.

1 Like

Another question just emerged.
In 1.0 how do you just generate the CloudFormation template without deploying it to AWS?

Previously with 0.5:
serverless project create -c true

now with 1.0?

I’m also trying to find an example of serverless.yml with multiple functions but can’t. Can someone post one here please?

@Bilal: you can add new functions the the yml and point to any handler file either in the same directory or sub directories. I don’t think we’ll be adding a create function command anytime soon, as adding new functions is a lot easier in V1 than it was in V0.

You also don’t have to point it to 1 specific file (e.g. handler.js) you can point it to any file you want to as long as its part of your service and will be zipped and uploaded.

For creating only the artefacts but not deploy them we currently have a PR open that will fix this: https://github.com/serverless/serverless/pull/1808

Echoing the OPs comment, publishing a v0 vs v1 page would be really helpful because I think it’s fair to say the differences are quite significant. I personally feel like I just mastered v0 and v1 really feels like a completely different product. That’s not a critique either, new isn’t bad, but having a comparison blog post or chart may help veteran users transition faster.

1 Like

Yup now that we’re closer to 1.x release and figured out all the features we’re starting to get to a point where we’re going to write more docs and especially can provide an update guide. Thats definitely the plan to go forward so you know exactly how to update from 0.5 to 1.0

@flomotlik I think you should reconsider creating additional functions in the Serverless CLI. I think it would be easy to implement and it is a good feature especially for new users who are unsure of how to wire in a new function. I liked how much you could do with the command line on v.5 and feel like you guys have cut a lot of that out of the newer version. A simple project structure example with multiple endpoints would also go a long way to reassure new users that their structure is sound. Just my 2 cents, I loved serverless since JAWS.

@contractorwolf yeah especially around docs and examples there is a LOT we need to do to make complex examples easier to understand and set up.

One of the main reasons why I don’t want to add a separate function create command is because I think it would make it too easy for us to have a bad UX in the config file, e.g. “Yeah the serverless.yml gets more complex and hard to manage but it doesn’t matter because we have those helper commands”.

I want the config file to be soooo damn easy and the provided examples and template projects to be so clear that there is simply no question how to do or change things in your serverless.yml by hand. Any tooling we build on top of the config file that makes setting up the config file easier would set the wrong incentives for us because we can always rely on a crutch with the commands.

So I totally get the problem you’re talking about and we need to tackle it, I just don’t want to set the wrong incentives for us (and the community working on it) because I strongly believe that setting the right incentives is really important for the long term success of the Project (or any project really)

1 Like