How to invoke a Serverless function locally using terminal

A step by step tutorial on running a Serverless function locally using Terminal.

Oscar de la Hera Gomez
Written by Oscar de la Hera Gomez
First published on 09/10/2022 at 12:20
Last Updated on 09/11/2022 at 09:58
A flower that represents Typescript next to one that represents Serverless, below it sits the text "Invoke Local Function".

A step by step tutorial on running a Serverless function locally using Terminal.

The following tutorial walks you through how to invoke a Serverless function locally using terminal. The tutorial makes use of our Open Source Typescript & Serverless starter project that is available using the link below.

Download Open Source projectHow to create a Typescript Serverless project

Step One: Set the current directory

A screenshot of terminal showing you how to set the current directory.

Open Terminal and set the current directory.

Step Two: Invoke the function

A screenshot of terminal showing you how to invoke the hello function created by Serverless in their out of the box project. This out of the box project is our open source project, with a few adaptations that make it work with Typescript.

Run the following line replacing hello with the name of the local function you intend to call.

serverless invoke local --function hello

Where can I find the name of my function?

In serverless.yml, under functions: you can find the name of your function. Please note that the name is that which is indented by one tab in the yaml file.

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.

SubscribeInquireView All PostsView All ServicesView All Work

Partner with us

We would love to get to know you and see how we can help your organization with its goals and needs.
Let's Talk

Stay Informed

Get occasional updates about our company, research, and product launches.
Subscribe