Assumption was that AWS may have been configured on your machine already. But if not you can quickly follow along here: documentationnerds.com/blog/tech/configure-aws-cli
After investing over 48 hours into learning about serverless from various sources and blogs, I was surprised to find that this video managed to encapsulate the entire topic in just under 30 minutes. Outstanding job, Leo!
Thanks a lot, for being on-point and touching upon important parts of the topic. On the debug section, in the run configs, the "protocol" is not longer supported, and for me it was just exiting with 1 so I added the --verbose flag to know what's going on, and just adding --verbose as follows, solved the problem and the debugger works great! "args": ["offline", "start", "--httpPort", "4000", "--noTimeout", "--verbose"], Cheers!
Great tutorial Leo, I use a lot of AWS + Serverless would love to see more, especially queryStringParameters with Lambdas and Dynamo tables. If you could do a video on pathParameters for pagination and searching by queryStringParameters I think would be awesome. just an idea.
Thanks, KhanDoor! Yeah, I personally love using Serverless, I hope to eventually get to learn about those things you mentioned and if I do I will be sure to make a video on it!
Good work, but you missed explaining all the permissions in an aws iam policy file that is needed to be able to run a successful "serverless deploy" command, it took me a while to have that set up
as Luke as all ready requested, could you please do a quick addition or just foot note to this video where you talk about how to have each Lambda be self contain and deployable on it's own as well as having a parent template that imports all others, giving the option to either deploy all Lambdas at once or just a single Lambda. It is something that I see a lot of projects that grow in size require, but often hit a road block on as they are all written with the intent to deploy all Lambdas at once.
Hi Leo, Great video, I've just stepped in the land of Serverless :) and your video was of great help. I'm wondering if you've ever used it in conjunction with Hasura? Thank you again
@@CodeDunks I'm actually working with it right now and I need to create a user when a user confirms his signup. Do you know I could test a lambda that is triggered when the user confirms the signup. Right now I'm getting an error "Unrecognizable lambda output" This is my lambda: import { GraphQLClient } from 'graphql-request'; import { Callback, Context } from 'aws-lambda'; const adminSecret = process.env.ADMIN_SECRET; const hgeEndpoint = process.env.HGE_ENDPOINT; export const handler = async (event: any, context: Context, callback: Callback): Promise => { try { const headers = { headers: { 'x-hasura-admin-secret': adminSecret as string, }, }; const graphqlClient = new GraphQLClient(hgeEndpoint as string, headers); const qv = { email: event.request.userAttributes.email, }; await graphqlClient.request( `mutation InsertUser($user: users_insert_input!) { insert_users_one(object: $user) { id } }`, qv ); callback(null, event); } catch (e) { console.warn('error', e); callback(null, false); } };
I'm experiencing a peculiar error, and I'm hoping that you might have seen the same one. When I run local testing, everything works fine with imported modules. But when I deploy it to lambdas, any handler that use a library from a separate file will crash with "cannot find module as if dependencies aren't being installed. However any dependencies directly in a handler file works just fine.
Hey Glen, when you say a library from a separate file what do you mean? For example, if you have this lambda project as a sub repository and are accessing another sub repositories interface then this is expected. The reason for that is that serverless will only package up the lambda projects files. So locally it works because it can access the "other library" on your local machine, but that "other library" does not exist within the package on AWS. This link might be of some use also aws.amazon.com/premiumsupport/knowledge-center/lambda-deployment-package-nodejs/
@@CodeDunks Hello Leo, from further investigation I can see that it is just any node module that cannot be found. Which perplexes me greatly, as I've followed the same structure as you have. From the link you send, do I understand correctly that this article wants me to change my code structure to have functions in root with package.json?
@@glenjensen3683 Hmm that is odd. Couple of things you can try. 1) run yarn install again to make sure dependencies are installed correctly 2) run "yarn sls package -s dev" then check in your .serverless folder in the root of your current directory for your projects generated zip, then within that zip see that node_modules is in there with whatever dependency it says that it's missing. 3) If all else fails, try possibly copying the project from my repo in the description and see if that works.
Hey there you can look at either my video or article I made about it. Video: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-xYko2bHNgVA.html Article: documentationnerds.com/blog/tech/template-cli-with-node-and-inquirer
@leo Roese can you Please guide me? I am confused in two type serverless project build one HTTP API nodejs and express API node. what's different in that and when we create http api nodejs project and when we create express api nodejs project?
Show us how to do a multi-module (like, a serverless.yml and package.json for each module, where what goes in common vs each module, that kinda thing). Pleez, pretty pleez? Also, any thoughts for chosing between mocha and jest? I was going to go with mocha, as it seems to have larger market share (maybe?), but I'm seeing that coverage, expect, etc for mocha has additional dependencies, like chai and istanbul to install, and configuration doesn't look as easy and breezy as with jest.
I've worked with both mocha and jest and found that the overall experience with Jest is a lot better in my own personal opinion. Every industry position I've worked on has also used Jest
Hey Rekefa, I actually just got a new computer and therefore don't have the configs yet. But here is the article I used to kinda set it up. Its a combination of windows terminal and cmder. medium.com/talpor/windows-terminal-cmder-%EF%B8%8F-573e6890d143
Have been working with serverless some yrs now. Do not mix serverless concept and microservices. There are some microservices written in nodejs in a ec2 container that are not serverless and there are some serverless system that are not microservices at all. And there are some real serverless microservices and on top of this concepts there are lambdas vs non lambdas microservices and also lambdas that are restful apis or a simple lambda with no endpoint....also that brings the idea of Functional paradigm vs oop in lambdas/serverless/microservices approach....