Link to chapter - https://serverless-stack.com/chapters/initialize-the-backend-repo.html
My question is regarding the size of the repo after running ‘npm install’ which created node_modules.
It seems to me the entire repo including the huge node_modules subdir is then pushed to the github.
bash-3.2$ npm install
bash-3.2$ cd ..
bash-3.2$ du -sh serverless-stack-2-api/
I imagine a lot of what’s in node_modules is only needed during development.
Is it necessary to push 127 MB of node_modules to github?
Thanks very much.
Oh yeah you shouldn’t commit the
node_modules/ dir. It is generated every time you run
A recommendation - after doing
$ git remote add origin REPO_URL
If we do
npm init (-y)
again, the change (repo field) will be reflected in package.json.
Could be a useful addition to the tutorial.
Ah good point. I’ll look into adding it in.
When I run
npm install, I get the following message:
found 128 vulnerabilities (54 low, 55 moderate, 19 high)
Is this the case for everyone else? Is there anything that can be done to remedy these vulnerabilities?
I think you need to run
npm audit fix for that.
Wow, that fixed all of them. Thanks. (Unfortunately it created a few more, which don’t seem to be fixable with npm audit fix, but a few is certainly better than 128.)
Great tutorial, I really, really learned a lot taking some time and doing this while going thru the AWS docs… Quick comment/question, though. I taking the repo here which looks like it’s branched after the “Delete Note” step in section 1…
per the serverless.yml code, it’s still looking for the resource/api-gateway-errors.yml file, but the branch actually comes from the step just before that. Obviously, it’s no problem to just grab that code and create a new file, but I wanted to point that out in case there was a reason I’m not foreseeing that you chose that particular point…
My guess was that, for wahtever reason, the step adding the API-Gateway resource file was added later and that’s the closest branch to the codebase we want to start with…
Anything I should look out for?
Thanks for the kind words.
Great catch! I should update the branch. It should be instead be the API Gateway CORS errors chapter - https://serverless-stack.com/chapters/handle-api-gateway-cors-errors.html.
So the command to clone the repo really should be:
$ git clone --branch handle-api-gateway-cors-errors --depth 1 https://github.com/AnomalyInnovations/serverless-stack-demo-api.git serverless-stack-2-api/
That branch should have the resource it is looking for.
I’ll update the chapter with this as well.