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
hackerunet
@hackerunet
sorry for my estupidity, I will never ask anything again.
thanks @gojko
the issue was me checking in the wrong region in AWS console. I'm an idiot.
Ross Coundon
@rcoundon
Hi @stojanovic - Is the best place to report errata and issues encountered with your book on the Manning site or here?
Slobodan Stojanović
@stojanovic
On the Manning site, please. Thanks :)
Kevin Coleman
@kevintechie
Hello, @gojko. I finally submitted a pr with validation and tests for adding authorization scopes to API Gateway methods.
Kevin Coleman
@kevintechie
While adding the authorizationScopes support, I noticed that you don't have "root": true in your .eslintrc.json file. Is this intentional? If not, it would be nice to have so that your config is not augmented by an eslint config higher in the project path.
Slobodan Stojanović
@stojanovic
It’s probably useful to add root: true, thanks for the suggestion
Kerim Incedayi
@cevatkerim
Hi @gojko , I would like add a platform to the bot builder. Should I just submit a PR?
hackerunet
@hackerunet

I have serious issues trying to use claudia with mongoose connector to get mlab database records, I get the following error

{
  "errorType": "string",
  "errorMessage": "event does not contain routing information",
  "trace": []
}

I cannot find a way to build a class to manage mongodb connections for each function, the documentation shows that attempting to create a function to do this needs to use

export const handler = async (event, context) => {
    const db = await connectToDatabase();
    // Do something with it...
};
and basically I'll have to make every function with routing and controllers logic bundled into the database connection handler, any thoughts or documentation regarding claudia architecture patterns? or something related?
Slobodan Stojanović
@stojanovic
@cevatkerim PR is the best way, it would also be great if you can send me a bit more details(i.e., which platform, etc.) in DM and I’ll be able to give you some guidance.
Kevin Coleman
@kevintechie
Hello @gojko , now that pr #199 has been merged, do you have a sense when it will be released to npm?
Gojko Adzic
@gojko
@kevintechie there were a few regression failures when I ran it, mostly because the flag to check for authorization scopes being an array failed if it was blank, so it broke the other cognito authorizer tests; I fixed that and re-ran the test suite, as soon as it completes I'll publish it
it takes a few hours to run, so tonight most likely
just got a notification that it finished successfully, so publishing now
Gojko Adzic
@gojko
Kevin Coleman
@kevintechie
Yes, perfect. That's exactly how we're using it in our code.
Gojko Adzic
@gojko
thanks for this patch
Kevin Coleman
@kevintechie
Sorry for the bug. Can't wait for optional chaining. https://github.com/tc39/proposal-optional-chaining
Gojko Adzic
@gojko
@kevintechie no worries, that's exactly why we have so many automated tests :)
Chardine
@Chardine
Hello, does claudiajs have support for websockets?
Bill Hainaut
@billhainaut
If I want api.get('/sumpin', xxxx) to get mapped to /v2/somename/sumpin how do I make that happen with ApiBuilder? Are there options for the name of the resource/sub-resource?
raedwa01
@raedwa01
so with cognito authorizer, can I make it so the unauthenticated users are able to run certain apis and authenticated users are able to run others but no one can run our apis without something from cognito first?
Gojko Adzic
@gojko
@raedwa01 you can use an IAM Authorizer and set up two roles in cognito for authenticated and unauthenticated pools
@billhainaut you can do that with api gateway custom domains, where you can assign domain/prefix to an API Gateway stage. claudia doesn't add any specific features to that, because it's trivially easy to set up a custom domain using the existing aws cli tools or the web console. check out https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html
@Chardine web sockets are not supported at the moment
Primož Verdnik
@drye
@gojko when using claudiajs with aws-serverless-express - would it be still possible to use API gateway's Usage Plans for per-endpoint throttling? I assume not, since API gateway is just serving as a proxy?
Chant Long
@chantlong_twitter

@gojko

@chantlong_twitter we added something in 5.6 that lets people use STS tokens and assumed roles, but that picks up AWS_ROLE_ARN from the environment and thinks that you want to use STS if it is defined

Sorry for the late reply. I just happened to have AWS_ROLE_ARN in my bash profile which is used in my other repos not related to the claudia repo. I could change the env name so I can use 5.6 Thanks. I use AWS_ROLE_ARN for other parts of the aws-sdk methods like IAM methods

Subbu
@subbu-everest

Greetings!

How to update the security-group and subnets attached to the Lambda function.

I can attach security-group and subnets while creating the function using --security-group-ids and --subnet-ids flags respectively.

How to update them?

Gojko Adzic
@gojko
@subbu-everest use the aws CLI tools for that. In general, claudia does not re-implement aws cli commands where it can't provide additional value. check out https://docs.aws.amazon.com/cli/latest/reference/lambda/update-function-configuration.html - if you used an alias when creating the function, you may also need to republish the alias after updating the VPC configuration for it to take effect. you can do that with claudia set-version --version <ALIAS>
Subbu
@subbu-everest
That makes sense. Thank you @gojko
John de Freitas
@Hunger_Artist_twitter

Hello. Trying to deploy a lambda to an AWS gov cloud region, not having much luck.
aws sts get-caller-identity --profile gov returns the right account (gov is the profile I have setup locally).
When I run claudia create --region us-gov-west-1 --name myLambdaName --runtime nodejs8.10 --handle mymodule.myhander --profile gov, I get InvalidClientTokenId: The security token included in the request is invalid..

It looks like though the request to create the IAM role is sent to https://iam.amazonaws.com, instead of iam.us-gov.amazonaws.com (see https://docs.aws.amazon.com/govcloud-us/latest/UserGuide/using-govcloud-endpoints.html). I also suspect the region used in the request is us-east-1.

Version info: claudia --version returns 5.4.0

John de Freitas
@Hunger_Artist_twitter

And though I'm already passing --region us-gov-west-1, if I also export AWS_REGION=us-gov-west-1, I get a bit further. The IAM role is created, though no permissions are added to it.

The error is MalformedPolicyDocument: Partition "aws" is not valid for resource "arn:aws:logs:*:*:*"..
This is usually the case when an arn in a Gov Cloud region begins with arn:aws:... and not arn:aws-us-gov:...

John de Freitas
@Hunger_Artist_twitter
As it turns out, json-templates/log-writer.json hard-codes the "Resource": "arn:aws:logs:*:*:*" line. Once I changed that to "Resource": "arn:aws-us-gov:logs:*:*:*", everything worked. So perhaps there can be some logic to toggle between different resources, depending on the region. As well as the strange behavior where --region passed on the command line is insufficient, and the AWS_REGION envvar is required.
And although I haven't tested it, I expect a similar issue will affect the two AWS China regions, which use the aws-cn arn partition.
Gojko Adzic
@gojko
@Hunger_Artist_twitter thanks for such a detailed troubleshooting log. I guess this is the first time anyone tried to use claudia for the isolated gov region :) I’ll check if we’re hard-coding it anywhere else
Gojko Adzic
@gojko
@Hunger_Artist_twitter I've created an issue on github to track progress for this claudiajs/claudia#201
red-made
@red-made
I've a strange problem, I have a backend in aws lambda based on claudia.js api builder.. I've discovered a strange thing, when I register as a new user and the scripts is rejected the lambda retrieve error and stop the execution and in DB no new user is created. But when I fix the data and resubmit the registration on db I see two new user, one with the correct data and one with the previous wrong data, seems that a new lambda execution start from the end of the previous after the reject. Here some example code: https://pastebin.com/PwpzLArs
John de Freitas
@Hunger_Artist_twitter
Thanks @gojko . I'm also happy to help out and test potential patches/fixes.
Gojko Adzic
@gojko
@red-made make sure you are not caching something across requests in the global context. Lambda is not stateless, and it can decide to reuse a container across requests. So if you have some kind of prepared request in the global context, and it gets created once but then appended during request processing, it will try to submit the data from the cached thing as well
@Hunger_Artist_twitter thanks. I’ll definitely need help testing because I can’t really reproduce the error (no government account)
Gojko Adzic
@gojko
@Hunger_Artist_twitter looking at the gov regions now, there also seems to be some difference between FIPS and non FIPS endpoints. Is this important to you, should you be able to select between the two or do we always go for the FIPS version?
also, I'm trying to find a reliable way to identify the partition - when you run aws sts get-caller-identity, does it include the gov partition in the ARN result, or does it include the aws partition?
NeverMinD
@xenowing
hi
raedwa01
@raedwa01
I'm having a slight problem. I have data in a mariadb and am able to get my lambda to query it just fine. The problem is that I cannot seem to get the results to return back in the response.
I went ahead and created a separate express file and added a require for the handler i created. I had to create the following code to get a response to work in express
app.get('/myproc', async (req, res) => { let tmp = await myhandler.myfunction(); res.status(200).send(tmp); })
raedwa01
@raedwa01
In the api.js for my lambda, i used api.get('/myproc', async () => { return await myhandler.myfunction() } )
I know the connection is connecting to the database, I write the results to the console in the middle of the query execution. The results never show on the webpage when I run it though.
Ravi
@ivar891_gitlab
@raedwa01 can you just send the result using return and see if it helps