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
@suraj_datta_twitter is this express? Logs work for all stages.
SURAJ DATTA
@suraj_datta_twitter
@stojanovic yes i'm using expressJS.
I've used req.apiGateway to trace API gateway details. I'm getting a path key under event object for api's related to /latest stage. But getting empty event object for /uat url's
erbsenhirn
@erbsenhirn
Okay, thanks for the info.
Mathew
@dotmat
Hey guys, is there REST API's exposed for ClaudiaJS Bots? Im trying to use PubNub Functions to a Claudia Bot, I can see all the connectors for FB, Slack, Twilio, but nothing for just a HTTPS POST.. Did I miss something?
Willo vd Merwe
@ion-willo
Hello everyone, is there a way to force Claudia to perform an npm install or similar when deploying? Currently it is bundling a Darwin binary, and cleary that will not work.
I tried installing the offending as an optional dependency and passing --no-optional-dependencies
Willo vd Merwe
@ion-willo
But that causes the package not to be installed on the Lambda causing a Module not found error
Willo vd Merwe
@ion-willo
Okay found --layers
Willo vd Merwe
@ion-willo
Is this still a thing? "...although the documentation suggests that multiple content types can be specified in the Accept header for binary responses, it seems that this breaks the conversion."
How do other Lambda implementations deal with this, then?
SURAJ DATTA
@suraj_datta_twitter
Hi All,
Did anyone faced following issue:
ERROR: aws-serverless-express connection error
It seems to happen after the lambda function times out.
jugglingcats
@jugglingcats
Hi, I'm trying to use claudia in a Github Workflow/Action. Github adds the AWS client id and secret to the environment for the action but I'm not sure how to pass this to claudia?
Ross Coundon
@rcoundon
Hi - Is there a way to use something like archiver to send a zip file as an API Gateway response from a lambda function and does anyone have examples or guidance?
2 replies
Ross Coundon
@rcoundon
async function zipData(content: string): Promise<Buffer> {
  return new Promise((resolve, reject) => {
    const filename = `/tmp/${new Date().valueOf()}.zip`;
    const dataBuffer = Buffer.alloc(content.length, content);
    const output = fs.createWriteStream(filename);
    const archive = Archiver('zip', {
      zlib: { level: 9 },
    });

    output.on('close', () => {
      async function asyncWorker(): Promise<Buffer> {
        return await readFileAsync(filename);
      }
      asyncWorker()
        .then((output) => {
          return resolve(output);
        })
        .catch((err) => {
          return reject(err);
        });
    });

    archive.on('error', (err) => {
      log.error('zipping archive error', err);
      return reject(err);
    });

    archive.pipe(output);
    archive.append(dataBuffer, { name: 'data.csv' });
    archive.finalize();
  });
}
jugglingcats
@jugglingcats
Hi, I'm trying to use claudia in a Github Workflow/Action. Github adds the AWS client id and secret to the environment for the action but I'm not sure how to pass this to claudia? Any advice?
jugglingcats
@jugglingcats
I managed to get my Github workflow working:
#!/usr/bin/env bash

mkdir -p ~/.aws
cat > ~/.aws/credentials << EOF
[deploy]
aws_access_key_id=$AWS_ACCESS_KEY_ID
aws_secret_access_key=$AWS_SECRET_ACCESS_KEY
EOF

export AWS_PROFILE=deploy
./node_modules/.bin/claudia update --no-optional-dependencies --version live
Tadej Vengust
@MoMannn
Hi, has anyone got the problem of
validating package    npm dedupe -q --no-package-lock
npm ERR! code EEXIST
npm ERR! Refusing to delete /tmp/LADlqq/xxx/package/node_modules/claudia/node_modules/.bin/mkdirp: is outside /tmp/LADlqq/xxx/package/node_modules/claudia/node_modules/mkdirp and not a link
I cannot fix this anyway. I use claudia in docker with lambda image. This worked without a problem up till now. But after I updated dependencies this started to happen
Tadej Vengust
@MoMannn
this is the command with which I run it:
claudia update --source dist --handler scripts/lambda.handler --use-local-dependencies --role api-deployment-executor --use-s3-bucket lambda-uploads --memory 1024 --timeout 300 --deploy-proxy-api --region eu-central-1 --config bin/deploy/claudia-dev.json --name app-api-staging
using claudia 5.12.0
Tadej Vengust
@MoMannn
works without a problem with 5.11.0
Kirtesh Jain
@kirteshjain
how to use claudia deploy with an existing iam role
Lucas de Araújo
@lucasnasuecia_twitter
You can use the --role parameter
Wes
@wmelton
Is there a preferred way using Express to export the module if its running on AWS but run it as a thread if devving local? This approach throws an error.
if (isLambda) {
    // You're on AWS Lambda
    module.exports = app;
} else {
    // Local or elsewhere
    app.listen(3000);
}
index.js does not export method handler
Slobodan Stojanović
@stojanovic
Create another file for running the Express server locally. For example, app.local.js, similar to the one in this example: https://link.medium.com/upJrZSfaq6
Wes
@wmelton
@stojanovic brilliant. Thank you!
Kirtesh Jain
@kirteshjain
when I upload my express api project to aws lambda
it says deployment package too large
Is there anyway I can seperate my api routes into seperate aws lambda function
Slobodan Stojanović
@stojanovic
Not out of the box. How big is your app? You can use S3 to be able to upload larger apps (up to 250mb instead of 50mb)
Kirtesh Jain
@kirteshjain
currently its 10mb
but I see most of the size is due to node_modules
Slobodan Stojanović
@stojanovic
It’s more than that, try claudia pack, that will show you the size of the zip file
Kirtesh Jain
@kirteshjain
Is there any benefit of using 1 lambda function for app vs seperate aws lambda function for each route ?
Slobodan Stojanović
@stojanovic
Use --use-s3-bucket to upload larger packages
Kirtesh Jain
@kirteshjain
ok thanks
Is there any benefit of using 1 lambda function for app vs seperate aws lambda function for each route ?
Slobodan Stojanović
@stojanovic
I would suggest using multiple Lambda functions, but no one can automatically split the express app for you.
Kirtesh Jain
@kirteshjain
what advantages I have using seperate lambda functions
I was wondering how do I deploy it as seperate lambda function from my express app. The only way I see is to go in aws and create functions there
Slobodan Stojanović
@stojanovic

If you want to have your app in AWS Lambda fast, deploy your express app directly, then start splitting it.

There are many benefits. Smaller apps are faster (you probably heard about cold start, it almost doesn’t not exist with small lambdas). It’s easier to debug (logs will be separated by routes)...

Kirtesh Jain
@kirteshjain
ok
thanks for your response
Slobodan Stojanović
@stojanovic
You can create multiple functions using Claudia or even easier using AWS SAM, but you’ll need to change your code. You can’t just deploy parts of Express app to different Lambdas.
Kirtesh Jain
@kirteshjain
how to create multiple functions using claudia ?
any article you can direct me to achieve that ?
Ghost
@ghost~529c6a01ed5ab0b3bf04d228
Hi,
I want to create a nodejs layer, in order to later create multiple functions that require it.
Is there a way to create the layer using claudia ?I have seen the announcement that linking layers is now supported (5.3), but I could not find info on creating the actual layer.