How to invoke a Serverless function locally using terminal

Oscar de la Hera Gomez
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.

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.

delasign logo

Book a Free Consultation.

An icon of an email.

Click here to email us.

Fill in the details below to book a free consultation or to let us know about something else. Whatever it is, we are here to help.

How can we help you ?

Contact Details