Function within a folder fails to deploy

I have a simple function I create from the “hello” sample in the Netlify Functions documentation. This function works fine locally and when deployed if I have it in functions/hello.js (functions is my top level folder in my repository and my .toml file has functions = “functions”).

However, if I place the file in functions/hello/hello.js it fails to deploy. I can run it locally with netlify dev just fine, but when I look at my deploy log I just see “0 new functions to upload”. I can see the files in GitHub so I know I committed and pushed fine. And the previous function at functions/hello.js is gone after deploy.

What am I missing? The documentation says I should be able to place the file in a folder with the same name. The FaunaDB netlify function create command also puts the files in a folder with the same name as the function.

Thanks

1 Like

Hi @nalenb, if you don’t mind, can you share the site where the function is failing to deploy?

I tried again last night with a blank project, same thing happened. Here’s the repo:

It’s hooked up to Netlify here:

https://xenodochial-tesla-2ec792.netlify.com](https://xenodochial-tesla-2ec792.netlify.com/

I added a few notes to the repo’s README to indicate what function is doing what.

Thanks

It appears I was missing the build command. Functions seem to work fine in the “functions” folder without a build command, but need a build command, even a dummy one, if you have functions inside of folders.

thanks for letting us know, @nalenb! I will touch base with some people about whether that is expected behaviour, but i am glad you found a way that works. thanks for sharing it.