No functions deployed when deploying repo

PLEASE help us help you by writing a good post!

Site Name:
GitHub Repo: GitHub - danblock97/lol-stat-tracker: A League of Legends Stat Tracker using the Riot Games API. Built using React and Netlify Serverless functions

I have deployed the above site, it seemed to have rendered the frontend perfectly fine however, I can’t seem to get the functions to deploy (which I believe are the API endpoints) If you look in the repo, you will see a ‘client folder’ which is where Netlify would run the build command.
You will then see ‘netlify/functions’ and in there, all of the api endpoints which then link into the server.js file which you can also see.

Am I deploying this incorrectly? If so, how would I deploy it because after it deploys I see the below message:

I have just tried changing all axios.get requests to use instead of http://localhost5000 but no luck… If I change it back and start my server using ‘node server.js’ it all works.

The better the post - the faster the answer.

@DanBlock97 When you say:

Do you mean that you have your Base directory set to client?

If so, that may be your problem.

The directory documentation for functions says:

The default directory is YOUR_BASE_DIRECTORY/netlify/functions

So if you have your Base directory set to client, but your functions situated above that, then Netlify won’t be seeing those functions.

If you had your Base direcetory as client you would need to move /netlify/functions to /client/netlify/functions.

Or you could perhaps change the folder location with additional configuration as per the documentation.

1 Like

@nathanmartin Thank you, what I have now done is moved netlify/functions to inside the client folder and looks like it’s picked up all 6.

Now the issue I’m getting is it doesn’t seem to be working with the express server in the server.js file.
I.e one of my functions urls is
I have updated this which you can see in the latest commit on my linked repo however, it’s not loading anything.

Request failed with status code 502

Have I missed a step in getting the app to talk to the server.js file?

No, Netlify just doesn’t provide the kind of runtime node.js type hosting necessary for you to host that file.


You don’t need to host your own server on Netlify, all your static files are deployed to and served automatically from the CDN.

If you want to provide convenience routes for your Netlify functions you would do that with rewrites & proxies.

For example this

const searchRouter = require("./client/netlify/functions/search");
const rankedRouter = require("./client/netlify/functions/ranked");
const historyRouter = require("./client/netlify/functions/history");
const matchRouter = require("./client/netlify/functions/match");
const leaderboardRouter = require("./client/netlify/functions/leaderboard");
const championMasteryRouter = require("./client/netlify/functions/championMastery");

app.use("/search", searchRouter);
app.use("/ranked", rankedRouter);
app.use("/history", historyRouter);
app.use("/match", matchRouter);
app.use("/leaderboard", leaderboardRouter);
app.use("/champion-mastery", championMasteryRouter);

Could be in a _redirects as something like:

/search  /.netlify/functions/search  200
/ranked  /.netlify/functions/ranked  200
/history  /.netlify/functions/history  200
/match  /.netlify/functions/match  200
/leaderboard  /.netlify/functions/leaderboard  200
/champion-master  /.netlify/functions/championMastery  200

As functions automatically deploy to /.netlify/functions/filenamehere

@nathanmartin Thank you so much for your help! I have managed to change all into an _redirects file, changes my functions to become event handlers and everything works! I’ve been trying to figure this out for weeks and learned so much!