aws-lambdajovo-framework

JovoFramework - LAUNCH - isNewUser() is always false on AWS Lambda


I'm using jovo framework (version 1.0.0) and I'm facing the following problem:

In app.js:

app.setHandler({

  'LAUNCH': function() {
    if(this.user().isNewUser()) {
      this.tell('This will never be told on AWS Lambda.');
    }
  }
});

Running locally I can distinguish between (isNewUser === true) and (isNewUser === false) but as soon as I'm executing it as a lambda function on AWS isNewUser is always false. Why is that?

and additionally

NEW_USER': function() {
}

Isn't triggered either.

System Environment on local machine:

Lambda function:

I really appreciate any help you can provide.


Solution

  • Both 'NEW_USER' and this.user().isNewUser() need to have access to a database, where the number of sessions is stored for each user.

    When you're prototyping locally, it uses the default File Persistence database integration, which saves the data to a local db/db.json file.

    However, on AWS Lambda, the local db doesn't work, so you need to set up a DynamoDB configuration. Learn more here: Jovo Framework Docs > Database Integrations > DynamoDB.

    Please remember to give your Lambda function role the right permission to access DynamoDB data: AWS Lambda Permissions Model.