Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document setup #35

Closed
MartinMuzatko opened this issue May 10, 2018 · 4 comments
Closed

Document setup #35

MartinMuzatko opened this issue May 10, 2018 · 4 comments

Comments

@MartinMuzatko
Copy link

Hi there!

It is really troublesome to get started with this CLI.
First I run the CLI - netlify-lambda serve functions
And get the error - babel-loader is missing.
As I install more and more missing dependencies (there is not a single note of required packages in order to run this... Netlify also just documents that files are named after functions.
E.g. functions/test.js will be served as domain.netlify.com/.netlify/functions/test
No webpack setup required at all.

So please document the proper setup required in order to run this CLI. Thanks

@MartinMuzatko
Copy link
Author

After persisting and dealing with the little documentation there is, I finally made it after 5 days.

First:
Please make developers pay extra attention to the fact, that a netlify.toml file is required!
Since the documentation points out, that the path for the functions can also be set in the web interface, I didn't include any netlify.toml file at first. The documentation here in this repository says:

Both depends on a netlify.toml file being present in your project and configuring functions for deployment

I would understand "Deployment" as the build step
This could be highlighted, especially to what path this has to point

Second:
What path points to what? Does the netlify.toml point to the source, or the built files? Does netlify-lambda serve point to the source or the built files? I assumed that with netlify-lambda serve I would
Me and many other developers struggled with this part. See #18 #8
The issues were closed but never really resolved or documented.

Third:
Missing dependencies and webpack setup. I had to manually install the dependencies for the webpack config that comes with netlify-lambda. Say: @babel/core, babel-loader, babel-transform-class-properties, babel-transform-object-assign and babel-transform-object-rest-spread.
I had to manually install them.
#20 and #17 ran into this issue

I think generally speaking, a better documentation can make this easier to understand and faster to integrate. But there are many assumptions you have as a developer how serve/deploy would work. E.g. that the build results folder is automatically created based on the webpack config, but since there is no config by default, this is by design that the toml file points to the build results, and netlify-lambda serve points to the source.

Please update the documentation so these common pitfalls are avoided.

@swyxio
Copy link
Contributor

swyxio commented Aug 25, 2018

Appreciate this @MartinMuzatko - we are upgrading the webpack and babel versions soon and i will go over the readme with a fine tooth comb with your feedback in mind.

@KristerV
Copy link

KristerV commented Sep 9, 2018

wow thanks MartinMuzatko for the writeup. Eventually I found out that running npm i --save netlify-lambda also helps, since the dependecies are listed in it's package.

@swyxio
Copy link
Contributor

swyxio commented Jan 10, 2019

hey @MartinMuzatko and @KristerV - been a while - check out our current Readme and see if you like it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants