Skip to content

Postinstall script fails using netlify-lambda to install function dependencies #227

@babycourageous

Description

@babycourageous

Hi there -

Been trying to figure this out. Not sure if my solution is a fluke or preferred method. I have a site that is connected to Netlify with GitHub Continuous Deployment.

**My Original Settings: **

# netlify.toml

[build]
  command = "npm run build"
  publish = "_site"
  functions = "src/_functions"

netlify-lambda was a regular dependency and postinstall script was postinstall: netlify-lambda install.

Inside src/_functions was a simple fetch function with node-fetch as dependency.

Pushing to github resulted in the deploy failing due to missing function dependencies. If I deployed manually with "Clear Cache and Deploy" via the dashboard it worked.

I updated the postinstall script to the following: netlify-lambda install src/functions. Still no dice.

Finally I uninstalled netlify-lambda and re-installed as a devDependency. Now it works as expected. Pushing to github results in proper function install and site is live.

Hopefully this all makes some sense. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions