# Function not found error while running locally using netlify dev

**URL:** <https://answers.netlify.com/t/function-not-found-error-while-running-locally-using-netlify-dev/6616>\
**Category:** Support\
**Tags:** netlify-dev-open-beta, netlify-newbie\
**Created:** [December 26, 2019, 7:28am UTC](https://answers.netlify.com/t/function-not-found-error-while-running-locally-using-netlify-dev/6616 "2019-12-26T07:28:12Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![AwesomeIronman](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/awesomeironman/32/5157_2.png) [@AwesomeIronman](https://answers.netlify.com/u/AwesomeIronman)\
**Post date:** [December 26, 2019, 7:28am UTC](https://answers.netlify.com/t/function-not-found-error-while-running-locally-using-netlify-dev/6616/1 "2019-12-26T07:28:12Z")

</div>

My HTML-CSS-JS only site with functions use works as expected when deployed  
But when I want to test the site locally, I use `$ netlify dev` command  
To run it on my machine, Site (index.html) works fine but it fails to fetch data from function  
As that network request gives “Not found” response

`$ netlify dev` command output is like:  
Server listening to 3999  
Waiting for localhost:3999.  
◈ Lambda server is listening on 51340  
Connected!  
Waiting for localhost:34567…

My netlify.toml file content:  
[build]  
base = “./”  
functions = “./functions/”  
publish = “./src/”  
[dev]  
publish = “./src/”

I don’t use any SSG, frameworks  
How do I get the functions working on my machine for testing purposes?  
Note: The site along with functions works perfectly as expected when pushed to netlify

---

<div class="post-metadata">

**Author:** ![Dennis](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/dennis/32/34_2.png) [@Dennis](https://answers.netlify.com/u/Dennis)\
**Post date:** [December 27, 2019, 1:32pm UTC](https://answers.netlify.com/t/function-not-found-error-while-running-locally-using-netlify-dev/6616/2 "2019-12-27T13:32:29Z")

</div>

Could you try changing your paths in the netlify.toml to relative paths? Like: `src/` and `functions/` and leave the base property out. Let me know if doing so helps.

---

<div class="post-metadata">

**Author:** ![AwesomeIronman](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/awesomeironman/32/5157_2.png) [@AwesomeIronman](https://answers.netlify.com/u/AwesomeIronman)\
**Post date:** [December 28, 2019, 5:07am UTC](https://answers.netlify.com/t/function-not-found-error-while-running-locally-using-netlify-dev/6616/3 "2019-12-28T05:07:10Z")

</div>

netlify.toml file content:

```
[build]
	functions = "functions/"
	publish = "src/"
[dev]
	publish = "src/"

```

These changes didn’t help  
Request to my functions still fail

---

<div class="post-metadata">

**Author:** ![throbi](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/throbi/32/5206_2.png) [@throbi](https://answers.netlify.com/u/throbi)\
**Post date:** [December 28, 2019, 11:59pm UTC](https://answers.netlify.com/t/function-not-found-error-while-running-locally-using-netlify-dev/6616/4 "2019-12-28T23:59:52Z")

</div>

Are you connecting to the Lambda server port? Functions are being served by that:

 ![image](https://global.discourse-cdn.com/netlify/original/2X/f/f584ddbf665fdff00f42de946c2fa788f7f2ca3f.png)

---

<div class="post-metadata">

**Author:** ![AwesomeIronman](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/awesomeironman/32/5157_2.png) [@AwesomeIronman](https://answers.netlify.com/u/AwesomeIronman)\
**Post date:** [December 29, 2019, 12:18pm UTC](https://answers.netlify.com/t/function-not-found-error-while-running-locally-using-netlify-dev/6616/5 "2019-12-29T12:18:28Z")

</div>

Netlify deploys over cloud work as expected:

> ![deploy](https://global.discourse-cdn.com/netlify/original/2X/2/23b74fa4e3f3ce913045fd71ad12d5a237468e52.png)

`netlify dev` command output:

> ![nd](https://global.discourse-cdn.com/netlify/original/2X/4/4cacd772d926165224050cac0c40ff32e8785e99.png)

But on my computer, `netlify dev` command gives port 3999 for frontend which fails to connect to functions port since they run on random 5xxx port, while my JavaScript code assumes frontend port 3999 (which works well when deployed)

> ![local 3999](https://global.discourse-cdn.com/netlify/original/2X/f/f7e0600f754445afd56b22d0004fe24f49e3632a.png)

My Javascript code:

> ![local js script](https://global.discourse-cdn.com/netlify/original/2X/4/4eed1b84feb7bf4ca9adda295ea22acac5bb9410.png)

On my computer `netlify dev` commands lambda server port (5xxx) serves the functions as expected:

> ![local functions](https://global.discourse-cdn.com/netlify/original/2X/6/654e1e130c62cffe16127a628ec4727a42f22689.png)

My directory structure:

> ![dir str](https://global.discourse-cdn.com/netlify/original/2X/9/93b0028f2bdce109f15835a57f4818a76eda0194.png)

In short lambda server port and frontend port is different thus `function not found` is received for frontend function requests

To answer your question exactly: No, I am connecting lambda server port from the frontend. I would never know lambda server port since `netlify dev` gives random generated lambda server port

Please help me get the functions working together with frontend on my computer with netlify dev command

---

<div class="post-metadata">

**Author:** ![Dennis](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/dennis/32/34_2.png) [@Dennis](https://answers.netlify.com/u/Dennis)\
**Post date:** [January 2, 2020, 1:43pm UTC](https://answers.netlify.com/t/function-not-found-error-while-running-locally-using-netlify-dev/6616/6 "2020-01-02T13:43:24Z")

</div>

Are you using `netlify-lambda` in your build process? Can you try not using it and see how that works? Let me know if that helps.

---

<div class="post-metadata">

**Author:** ![AwesomeIronman](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/awesomeironman/32/5157_2.png) [@AwesomeIronman](https://answers.netlify.com/u/AwesomeIronman)\
**Post date:** [January 2, 2020, 3:58pm UTC](https://answers.netlify.com/t/function-not-found-error-while-running-locally-using-netlify-dev/6616/7 "2020-01-02T15:58:27Z")

</div>

No, I don’t even have `netlify-lambda` installed!

I think at the moment `netlify dev` doesn’t support creating a dev environment where simple JS-HTML apps and netlify functions could could behave like they behave when deployed  
Since all the tutorials about `netlify dev` use either JS frameworks (react) or SSGs

---

<div class="post-metadata">

**Author:** ![perry](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/perry/32/16_2.png) [@perry](https://answers.netlify.com/u/perry)\
**Post date:** [January 9, 2020, 6:14pm UTC](https://answers.netlify.com/t/function-not-found-error-while-running-locally-using-netlify-dev/6616/8 "2020-01-09T18:14:27Z")

</div>

Hi there, sorry this is a bit of a struggle - I just chatted with the folks who work on Dev. Your best bet is to file an issue on the repo, which you can find here:

> **[GitHub - netlify/cli: Netlify Command Line Interface](https://github.com/netlify/cli)**
>
> Netlify Command Line Interface. Contribute to netlify/cli development by creating an account on GitHub.

Sorry we can’t offer more assistance at this time 😕

---

<div class="post-metadata">

**Author:** ![perry](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/perry/32/16_2.png) [@perry](https://answers.netlify.com/u/perry)\
**Post date:** [January 9, 2020, 6:14pm UTC](https://answers.netlify.com/t/function-not-found-error-while-running-locally-using-netlify-dev/6616/9 "2020-01-09T18:14:34Z")

</div>


