Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 01 2016 23:48
    @gojko banned @codepreneur
Slobodan Stojanović
@stojanovic
@pehaada there’s this package, but I never tried it and I am not sure if it is still maintained: https://www.npmjs.com/package/claudia-local-api.
Not sure if stackery requires CloudFormation.
Ross Coundon
@rcoundon

In the docs for create it says:
--subnet-ids: (optional) ...At least one subnet is required if you are using VPC access....

Can I set the VPC via the create command ? I don't see docs for that

Ross Coundon
@rcoundon
Nevermind - I can see it's worked out the VPC from the subnets and/or security group
aleemb
@aleemb
Should I be aware of any configuration or workarounds if I intend to use Claudia for AWS Lambda + ELB? I cannot afford to use APIG because of the cost implications.
Gojko Adzic
@gojko
@aleemb we haven’t done any ELB configuration shortcuts yet, so you may need to wire it up to ELB manually - or perhaps contribute a wiring command for ELB event sources
aleemb
@aleemb
@gojko Alright, I'll do the manual wiring, am just getting started. Since there will be no APIG support would you suggest I use your "Running Express apps in AWS Lambda" guide?
nm, that guide is geared toward APIG
Gojko Adzic
@gojko
@aleemb yep, HTTPS processing with Claudia is currently completely APIG related
The aws-serverless-express library we use to bring express apps up also needs the apig proxy events, so it won’t work out of the box
aleemb
@aleemb
@gojko would be good at some point to add some support and examples around this. For now, I am unable to get it working so will continue reading and playing around with it. I keep getting 502 bad gateway. FWIW, I fall in this category of users: https://serverless-training.com/articles/save-money-by-replacing-api-gateway-with-application-load-balancer/#how-to-choose-between-application-load-balancer-and-api-gateway
Gojko Adzic
@gojko
@aleemb I understand there’s a need for this, but it’s not something on our critical path, so it’s unlikely that I’ll have the time to do it. If you or someone else wants to take a stab at it and submit a pull request, I could probably guide you through the steps
aleemb
@aleemb
@gojko So I managed to get things running using aws-serverless-express (v4 ) via https://github.com/awslabs/aws-serverless-express/tree/v4/examples/alb) which made it super easy to wrap my express server using 4 lines. I am pushing the code with Claudia, so it's a good combo.
Chant Long
@chantlong_twitter

I am using Claudia API Builder.
The endpoint that I created when hit 20 times at the same time produces the following error.

ThrottlingException: Rate exceeded

I basically have a for loop that loops over 20 times and in each loop it calls the Claudia API Endpoint.
I do not have throttling enabled for API Gateway so it should be like the following.
Your current account level throttling rate is 10000 requests per second with a burst of 5000 requests
So I don't get why I get this error

Gojko Adzic
@gojko
@chantlong_twitter check the throttling settings for your api in the aws web console - look for the deployed stage in the api gateway web page. if may be something that's set on your API implicitly, claudia does not set any throttling limits; if the AWS web console doesn't show any throttling for that endpoint, it's best to check with AWS support, they will then be able to figure out what is causing the issue
Chant Long
@chantlong_twitter
@gojko Thanks will try that out.
Sébastien Fichot
@sebastienfi
Hi there! Anybody pass custom headers through Amazon API Gateway to AWS Lambda with ClaudiaJS? Integration Request should not use Lambda Proxy integration but a mapping template which allows custom headers sent with POST to be pass to the Lambda... Any idea ?
Gojko Adzic
@gojko
@sebastienfi claudia only uses the proxy integration, and passes things through to Lambda. If you want to enrich requests as they are passing through API Gateway, the typical solution for that with claudia would be to use stage variables in API Gateway, not custom headers. you can read those variables out from the request object in Lambda then
Sébastien Fichot
@sebastienfi
@gojko can you point the direction to an example of that?
Gojko Adzic
@gojko
check out the section on api gateway variables here: https://claudiajs.com/tutorials/versions.html
Sébastien Fichot
@sebastienfi
@gojko That does not seem like what I want to achieve. An external provider realizes a POST every minute to an endpoint of our API Gateway. This provider offers important information only as POST Headers. These information changes at every POST. I need to access these custom headers in the Lambda... Does this context precision changes what you think would be the way to answer to this matter?
Gojko Adzic
@gojko
so the headers are set on the request by the external client, not in the api gateway? you can just read those headers out directly from the request object from request.headers (or if you want them lowercase, request.normalizedHeaders) - see https://github.com/claudiajs/claudia-api-builder/blob/master/docs/request-object.md for more info
Sébastien Fichot
@sebastienfi
@gojko Sorry, what I will write will surely disappoint you, but this is not the case. Only a restricted set of headers are allowed to make it throught natively. https://aws.amazon.com/premiumsupport/knowledge-center/custom-headers-api-gateway-lambda/
Gojko Adzic
@gojko
that's the case if you use the model transformations, if you use the proxy integration (which claudia does) all headers should just pass through. if your header does not, please create a minimal example that demonstrates the problem and we can look at it to see if there is some particular naming issue there
Sébastien Fichot
@sebastienfi
@gojko Gotcha. Thank you, I will do. Thanks for your help
Mark Thomas
@markandirene

Hi

Does anyone know why I get this error when trying to deploy a Claudia app. from Windows 10?

Error: ENOTEMPTY: directory not empty, rmdir 'C:\Users\abc1\AppData\Local\Temp\IhIFxs\myapi-1.0.0-5ymemD\package\node_modules\xmlbuilder'
validating package removing optional dependencies
Gojko Adzic
@gojko
@markandirene it’s likely npm failing. Make sure you’re using the latest NPM, just in case your current version has some bugs. If that doesn’t help, try —npm-options=—no-package-lock to avoid package locks in npm, sometimes that causes issues
You can try just running claudia pack instead of deploying to experiment faster
hackerunet
@hackerunet

I have a question, I'm getting a lot of server error response in Amazon gateway and when I check what happened I got the error

errorMessage": "2019-09-18T02:13:13.370Z 7d4003d4-240c-450a-a6c6-45a6f63b5ecf Task timed out after 3.00 seconds"

So, I look for the function result and it ran successfully and also checked to see any answers in stack overflow, I got a response telling me to return the success using the amazn context, so, how can I achieve this from a async await returned from a controller to the claudia routes?

Gojko Adzic
@gojko
@hackerunet the message means that lambda is not completing work in the allocated time. there are usually two reasons for that:
  1. you have a broken promise chain somewhere, so something is not resolving/rejecting after finishing work. if you are using async/await for your endpoint functions, this usually isn't a problem, so check if you are manually creating a Promise somewhere that doesn't resolve, or if you use some library that requires callbacks and is not turned into promises correctly.
  2. the task you are executing just sometimes takes more than 3 seconds, because it's talking to a slow external resource (for example database) or performing some complex task. for slower resources, you can fix this by allowing the function more time to execute (update it with --timeout). For complex tasks, you can give it a better CPU by increasing memory (CPU cores get allocated proportionally, giving your function 1.5G gives it a whole core). By default, your function only gets 128MB I think, check the lambda docs, so it will get only about 1/10 of a CPU core. You can increase available memory by updating using --memory. Check out https://github.com/claudiajs/claudia/blob/master/docs/update.md for more info on those options
the stack overflow answer about amazon context is outdated
hackerunet
@hackerunet
@gojko thank you very much for taking time to answer. :) checking everything now.
Juan Ordaz
@juanr2001
Hi channel. I am new to claudia. It seems to be a very cool and easy to understand. However, I am having difficulty to adjust since I came from expressJS. How can I implement logging in Claudia? In expressJS is something like: app.use('logging-library').
Ross Coundon
@rcoundon
@hackerunet - also make sure you're returning the promise from your api method or handler
e.g.
api.get('/somePath', request => {
  return yourMethod();
});
Gojko Adzic
@gojko
@juanr2001 console.log('whatever') goes directly into cloudwatch
if you want to have some generic request logging, you can set up an interceptor
hackerunet
@hackerunet
@rcoundon what I offten do is return await XXXX or return XXXX where XXXX is my async await function, is this ok?
Ross Coundon
@rcoundon
@hackerunet I think, as long as you're ultimately returning a promise from the api.get callback, you'll be ok as I that's what's monitored for completion - i.e. when that promise resolves/rejects. In the example I gave above, yourMethod() would be an async function, i.e. it's not awaited at the top level, the promise is returned directly
Juan Ordaz
@juanr2001
@gojko thank you so much!
hackerunet
@hackerunet
@gojko the timeout worked and yes the database I'm using is outside my network, so, that fixed the issue, now I have another question regarding Authorizers, let's say I want to use a Custom Authorizer to check my own users database, but I also want to perform a validation in the request, if the request has not certain header with certain content I want to return the unauthorized error, but I need different authorizers that validates against different api's, so, each API has it's own header with its own content, so requests from one api will be blocked if certain user is attempting to access an API it doesn't belong to. is this viable and of course clear?
@rcoundon same question I had in my last message for custom authorizers.
can I add certain parameter to the authorizer definition and a REGEX to make api gateway check that value first?, like using Enhanced Request Authorizers
Gojko Adzic
@gojko
@hackerunet that’s really a question for AWS support, it has nothing to do with Claudia
hackerunet
@hackerunet
mmm you are right... sorry for that. the question would be, does claudia support enhanced request validation offered by amazon aws?
@gojko
aleemb
@aleemb
Came here a few days ago asking about ALB + Lambda + Claudia.JS. It was fairly easy to get up and running, I wrote a small write-up here: https://www.webskeleton.com/webdev/2019/09/20/AWS-Lambda-ALB-load-balancer.html