# Testing Lambda Functions

**URL:** <https://answers.netlify.com/t/testing-lambda-functions/6263>\
**Category:** Support\
**Tags:** lambda-functions\
**Created:** [December 15, 2019, 6:19pm UTC](https://answers.netlify.com/t/testing-lambda-functions/6263 "2019-12-15T18:19:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nonissue](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/nonissue/32/4261_2.png) [@nonissue](https://answers.netlify.com/u/nonissue)\
**Post date:** [December 15, 2019, 6:19pm UTC](https://answers.netlify.com/t/testing-lambda-functions/6263/1 "2019-12-15T18:19:13Z")

</div>

I’ve been trying to figure out a way to test my lambda functions (with something like Jest), and I’m having a tonne of trouble getting it set up and working. I’m a bit out of my depth, does anyone have any resources that would go over netlify functions testing, or even better, an example project that shows some ways to do it?

Thanks!

---

<div class="post-metadata">

**Author:** ![icetbr](https://avatars.discourse-cdn.com/v4/letter/i/3be4f8/32.png) [@icetbr](https://answers.netlify.com/u/icetbr)\
**Post date:** [December 16, 2019, 4:28pm UTC](https://answers.netlify.com/t/testing-lambda-functions/6263/2 "2019-12-16T16:28:09Z")

</div>

I’m pretty sure there is no support for test automation yet. You can do manual testing by running `netlify dev` in a command line, and then `netlify functions:invoke` in another.

I’m a noob at serverless myself, but I would recommend for you to setup a `server.js` in whatever framework you prefer (express, hapi), use a translator like [serverless-http](https://github.com/dougmoscrop/serverless-http), and then test against that server.

---

<div class="post-metadata">

**Author:** ![fool](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/fool/32/37_2.png) [@fool](https://answers.netlify.com/u/fool)\
**Post date:** [December 17, 2019, 11:00pm UTC](https://answers.netlify.com/t/testing-lambda-functions/6263/3 "2019-12-17T23:00:25Z")

</div>

You’d indeed have to do a test either on the already-deployed functions, or on a local copy you setup using `netlify-lambda serve`, @nonissue . The functions aren’t available until AFTER deploy for execution via our CDN.

You may be able to pick up some other associated advice from this article such as workflows for testing deploy previews before merging to production, or using multiple sites (1 for test, publishing later to prod): [[Support Guide] Testing your Netlify builds](https://answers.netlify.com/t/common-issue-testing-your-netlify-builds/1456)

---

<div class="post-metadata">

**Author:** ![chasegarsee](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/chasegarsee/32/4958_2.png) [@chasegarsee](https://answers.netlify.com/u/chasegarsee)\
**Post date:** [December 17, 2019, 11:24pm UTC](https://answers.netlify.com/t/testing-lambda-functions/6263/4 "2019-12-17T23:24:30Z")

</div>

Here’s a repo I just created to test out a very simple Netlify Lambda function with React.

> **[GitHub - chasegarsee/react-netlify-test](https://github.com/chasegarsee/react-netlify-test)**
>
> Contribute to chasegarsee/react-netlify-test development by creating an account on GitHub.

One thing to note, when I ran the terminal command `netlify-lambda serve` to deploy locally, it didn’t seem to work for me.

I added this in my package.json  
`start:lambda": "netlify-lambda serve functions`

then ran this command and it worked beautifully.  
`npm run start:lambda`

Give it a look and see if you can come up with anything!

---

<div class="post-metadata">

**Author:** ![fool](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/fool/32/37_2.png) [@fool](https://answers.netlify.com/u/fool)\
**Post date:** [December 18, 2019, 1:54am UTC](https://answers.netlify.com/t/testing-lambda-functions/6263/5 "2019-12-18T01:54:55Z")

</div>

Seems like it’s worked ok to judge from it working from package.json? `netlify-lambda serve` does no deploying, it just starts up your functions locally so you can access them on your computer without our infrastructure.

If it doesn’t run from the command line, we’d need more details on what might be going wrong like the actual error messages, you telling us how you have it installed for general usage, etc 🙂
