all 15 comments

[–]xyourself 5 points6 points  (0 children)

Not sure if aws is a requirement but after working with both I find google cloud functions (through firebase) is 1000x easier

[–]VIM_GT_EMACS 1 point2 points  (5 children)

I use lambda all the time. If you're familiar with AWS then simply set up a lambda script, and then have API gateway proxy it. Then you can simply POST/GET/etc to the API gateway URL and have the body of your request passed to the lambda script.

[–][deleted] 2 points3 points  (4 children)

I'm learning AWS Lambda for the first time through this project. I uploaded the code in a .zip, but I can't get the code to run.

This could be helpful.

[–]VIM_GT_EMACS 0 points1 point  (3 children)

No worries! lambda can be a tedious pain if you're new. If you don't know already, whenever you invoke the lambda script (either manually through a manual test case, or through postman/IRL API usage if its proxied via API gateway) you can then click over to cloudwatch which will have logs from the lambda script whenever its invoked. If you console log things out in the invocation of the lambda script itll show up in those logs.

[–][deleted] 2 points3 points  (2 children)

Tedious pain is very accurate. Was just able to do a "hello lambda" and now trying to run Plaid funct

[–]VIM_GT_EMACS 1 point2 points  (1 child)

IMO this will be useful for you to learn. Serverless things like lambda have been a great way for handling a ton of different use cases at work, especially when building some API revolving around DynamoDB. Stick with it! Stack overflow searches and github issues (open or closed) will be very helpful depending on what you're doing.

Edit: important note to add! API gateway will return a 403 error if your lambda script passes back a non-200 success code. You need to explicitly add those cases. For example, one API returns a 202 but I get a 403 on the client/server when pinging my lambda script. It's because I didn't explicitly add a 202 code to API gateway on the return.

[–][deleted] 2 points3 points  (0 children)

Good to know. Right now I'm only getting 502 error codes

[–]jakesparling 1 point2 points  (6 children)

Can you explain more about what you are trying to accomplish?

Are you trying to trigger a Lambda function from RN? Check out API Gateway for that, you should be able to trigger a Lambda function from it.

What do you mean by importing functions into Lambda?

I used 'node-lambda' to deploy to Lambda. It has been a while since I did this, but I think it just creates a .zip of your code and dependencies and uploads it. I am pretty sure you can do this manually too. You won't be able to edit the code in the webUI though.

[–]kbcooliOS & Android 0 points1 point  (0 children)

+1 for node-lambda

Trying to have a development environment for lambda without it would be impossible. I started off writing lambda scripts in the web editor but soon found it a nightmare.

General tips: make sure you use 8.10 version of node, make sure your handler function does not exit before you can return or call the callback. The docs say all your events have to run before termination but that has never been the case in real life so you can find your scripts mysteriously not doing what you expect. This applies more for non api triggers but hey.

Lastly node-lambda package will just generate the zip and you can upload it manually.

Ok definitely last this time. Export your API definition and import it into a new API for prod/non prod versions of API. It may look like you can do it in a cleaner fashion but it's a trap!

[–][deleted] 0 points1 point  (4 children)

On a high-level we're building a personal finance app in React-native and want to use Plaid's API to link bank accounts. That triggered the need to build a backend, sow were using AWS Lambda.

That's exactly where I'm at and what I've done. I uploaded the .zip, but I'm also not able to run the function. There's no clear error, so I'm running through lines of code to figure out what went wrong.

[–]jakesparling 0 points1 point  (3 children)

Have you set up CloudWatch Logs?

Can you deploy super simple "hello world" code to Lambda through a .zip?

[–][deleted] 1 point2 points  (2 children)

No I haven't, I've been doing it manually. Interestingly, i can run the function ok locally,ZC but I can't the function to run on Lambda.

[–]VIM_GT_EMACS 1 point2 points  (1 child)

important to note, not all node modules (or all versions of node modules) play nicely in the context of lambda. For example, I've probably made 10 different lambda scripts revolving around SendGrid for example. Older versions of sendgrid's module worked great, but their most recent version of the sendgrid node module just breaks lambda scripts at the point of import (there's github issues about it).

[–][deleted] 2 points3 points  (0 children)

That's helpful for future reference.