Functions not working after manual deployment

Hi there,
Hopefully someone can help me. I’m having trouble deploying simple netlify lambda functions:

Site (manual deploy):](
GH Repo (so you can see the code): GitHub - jmsherry/netlify-lambda-demo

Functions show up as deployed (and re-deploys work) but there are no server logs and all I get in response is a 500.

Endpoint of the hello world:

Any help greatly appreciated! :slight_smile:

Hey @jmsherry

What do you mean by manual deployment? Drag and drop? Netlify CLI?

I deployed the repository using Netlify CLI (which shows as a manual deploy in the dashboard) and the hello-world endpoint works fine. (I haven’t tested the mail function as I don’t have a SendGrid API key handy.)

Functions will only work when deployed via git or CLI.

1 Like

Hi @coelmay ,
I meant by netlify cli. Odd that it works for you! I’ll re-deploy and try again in a different app…

I presume it looks structurally sound to you? No obvious issues?

Everything looks fine.

The only changes I made where to the netlify.toml, where I commented out the command and functions values (neither are required.)

#  command="# no build command"
#  functions="netlify/functions"
1 Like

Nope! Still not working!

Could it be a region setting?

ntl deploy --prod
Deploy path:        /Users/jamessherry/sites/netlify-fns-2022-demo2/public
Functions path:     /Users/jamessherry/sites/netlify-fns-2022-demo2/netlify/functions
Configuration path: /Users/jamessherry/sites/netlify-fns-2022-demo2/netlify.toml
Deploying to main site URL...
✔ Finished hashing 5 files and 1 functions
✔ CDN requesting 1 files and 0 functions
✔ Finished uploading 1 assets
✔ Deploy is live!

Unique Deploy URL:
Website URL:

Deploy log:

11:47:00 PM: Creating deploy upload records
11:47:01 PM: Starting post processing
11:47:01 PM: Post processing - HTML
11:47:01 PM: Post processing - header rules
11:47:01 PM: Post processing - redirect rules
11:47:01 PM: Post processing done
11:47:05 PM: Site is live ✨

This site no longer exists.

This shows that no functions were uploaded, meaning there is no difference between what was previously build and what was built in this deploy. You can add --skip-functions-cache to ensure they are rebuilt so ntl deploy --prod --skip-functions-cache

OK, I did a few deploys to copies of the site (stripping out all the netlify information):

Latest example (which I won’t delete): (function at

I get a bug with the CLI: ntl init error: TypeError: undefined is not iterable · Issue #5018 · netlify/cli · GitHub where it won’t add the functions folder and crashes during init.

If I manually create the toml file I still get the same thing:

# example netlify.toml
  command = "# no build command"
  functions = "netlify/functions"
  publish = "public"

Here is the hello world function I deployed from the repository you shared

So then there are 2 options:

  1. It’s to do with my system
  2. It’s to do with my account

Not sure how to approach that?!

Have you tried cloning the repository into a fresh directory and deploying?

So, this is what I did (also using macOS)

git clone
cd netlify-lambda-demo
npm i
ntl sites:create --name <name>  # e.g. ihao8shdaosd8ah

Create .env with appropriate values, then import to Netlify (for mail function.)

ntl env:import .env

Test locally

ntl dev

If everything is working locally, deploy

ntl deploy --prod

I’m not sure what might cause the issue, nor how exactly to determine what (potentially) is.

If you then see a 500 error, check the function logs for the deployed site via the dashboard.

@coelmay Nope! Doesn’t work for me: Screencastify

No server logs either. :frowning:

I ran through the same steps again and everything worked.

You didn’t test the hello-world endpoint locally (though I assume it would work as the other function worked too.)

It is curious the .netlify/state.json was not created when you ran ntl sites:create --name <name>. When I do this, the final output line tells me the site is linked which is (it appears) not the case for you, which is why you needed to manually link it. The reason for this I don’t know.

Are there any staff members you know of?

I run a school ( that trains new developers. I advocate using netlify a lot and I really want them to be able to use the lambda capability on the platform but can’t demonstrate it for reasons shown.

I presume you are meaning Netlify staff?

I have already flagged this thread for the attention of the support team. They (naturally) can see what is happening in the background.

As I have demonstrated, the code does work when deployed. What the difference is between you and I running exactly the same commands on exactly the same repository, I do not know.

The only other difference I can note is difference NodeJS/NPM versions

% npx envinfo --system --binaries --npmPackages netlify-cli --npmGlobalPackages netlify-cli

    OS: macOS 12.5.1
    CPU: (12) x64 Intel(R) Core(TM) i5-10600 CPU @ 3.30GHz
    Memory: 679.84 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
    Node: 16.16.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.11.0 - /usr/local/bin/npm
    netlify-cli: 11.5.1

which are different to those in the issue you created. What, if any, difference this makes, I can’t say.

Hey there, @jmsherry :wave:

Welcome to the Netlify Forums!

@coelmay flagged your thread to us. A Support Engineer will follow up with more details when they can. Thanks for your patience here!


Thanks @hillary and @coelmay! :slight_smile:

If it helps the debug:

npx envinfo --system --binaries --npmPackages netlify-cli --npmGlobalPackages netlify-cli

    OS: macOS 12.5
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 68.74 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
    Node: 16.8.0 - /var/folders/hd/jkczj0nx7zb6xywcm3x9hbn80000gn/T/fnm_multishells/3982_1661993825446/bin/node
    Yarn: 1.22.18 - /usr/local/bin/yarn
    npm: 7.21.0 - /var/folders/hd/jkczj0nx7zb6xywcm3x9hbn80000gn/T/fnm_multishells/3982_1661993825446/bin/npm
    Watchman: 2022.03.21.00 - /usr/local/bin/watchman
    netlify-cli: ^11.5.1 => 11.5.1 
    netlify-cli: 11.5.1

Hey @jmsherry,

We can see the following error in our logs:

InvalidZipFileException: Lambda was not able to unzip the file

This usually means that the zip that was uploaded, was somehow incorrect or corrupted. If you were generating the zip manually, I’d have asked you to check that, but since you’re using CLI - it should work correctly.

Since @coelmay was able to deploy and run the functions correctly, I don’t think it has anything to do with how the function code is or how it’s being generated. This to me, looks like a system-level issue on your machine. Three things to try:

  1. Does deploying via Git work? I’d highly assume that, it would, but let’s still check.
  2. Are you able to deploy the same repo using CLI from a different device?
  3. Could you check if the zips generated locally inside the .netlify folders look valid - that is, they extract and work correctly?
1 Like

Thank you for the reply.

  • I can deploy by git.
  • I’m going to test on another device tomorow
  • Unless I do ntl buildI don’t see any zip files. If I do ntl build I get the zips but they’re weird when extracted!

For hello-world I get .netlify/functions/hello-world/ and in there I get a 0 byte hello-world.js file and then an src directory and in there the source file for hello-world.

For mail it’s worse! I get netlify/functions/hello-world/ a zero-byte file and a src directory BUT in the src directory I get node_modules directory and then another netlify/functions/mail/mail.js. It’s very strange!

So, it’s definitely the CLI not the code itself!

Should it automatically create the zips when you’re doing ntl deploy? And what structure should they have??

Thanks :slight_smile:

When I run ntl build I get to ZIP archives and a manifest.json in .netlify/functions

% ll -h .netlify/functions
total 296K
-rw-r--r-- 1 coel staff  481 Sep  6 11:38
-rw-r--r-- 1 coel staff 287K Sep  6 11:38
-rw-r--r-- 1 coel staff  513 Sep  6 11:38 manifest.json

Both unzip successfully

I don’t get the manifest.json.