Ntl CLI not generating new (2.0) functions

According to the blog post on Netlify Functions 2.0 (Netlify introduces new Functions capabilities), if you wish to use the CLI to scaffold new functions, you should ensure your CLI is updated to 16.6.2 or higher. This morning I updated to 17.9.0, scaffolded a new function, and the code used was 1.0, despite a comment on top though talking about 2.0:

// Docs on event and context https://docs.netlify.com/functions/build/#code-your-function-2
const handler = async (event) => {
  try {
    const subject = event.queryStringParameters.name || 'World'
    return {
      statusCode: 200,
      body: JSON.stringify({ message: `Hello ${subject}` }),
      // // more keys you can return:
      // headers: { "headerName": "headerValue", ... },
      // isBase64Encoded: true,
    }
  } catch (error) {
    return { statusCode: 500, body: error.toString() }
  }
}

module.exports = { handler }

I am not seeing anything like that. What I’m seeing is this:

If you use the Netlify CLI to develop or deploy your functions, make sure you update to version 16.6.2 or above.

Which simply means that you’d have to use 16.6.2 or above to be able to use the 2.0 syntax. It doesn’t say anything about scaffoling.

That link was just pointing to a header - again, nothing indicating Functions 2.0.

Am I missing something?

Ok, I guess your right? I mean, the blog post certainly implied it would scaffold 2.0, but if we want to be picky about it, ok. :slight_smile:

So that being said, wouldn’t you imagine a person might assume that new functions created would be in 2.0? Can I log an official “bug request” for that to be considered?

Feel free to file an issue on the CLI repo, or if you have the time, open a PR. The templates are here: cli/src/functions-templates/javascript at main · netlify/cli (github.com)