jovo-plugin-inbox
v3.6.1
Published
Downloads
3
Readme
Jovo Inbox Plugin
Installation
npm install --save jovo-plugin-inbox
This plugin uses TypeORM to provide access to various databases. Depending on the SQL Database you use, an additional installation of the database driver is necessary.
MySQL or MariaDB
npm install --save mysql
PostgreSQL or CockraochDB
npm install pg --save
SQLite
npm install --save sqlite3
More databases: https://typeorm.io/#/undefined/installation
Usage
const { JovoInboxPlugin } = require('jovo-plugin-inbox');
app.use(
new JovoInboxPlugin({
appId: 'PizzaPlace',
db: {
type: 'mysql',
host: 'host',
port: 3306,
username: 'user',
password: 'pass',
database: 'jovoinbox',
},
})
);
See https://github.com/typeorm/typeorm/blob/master/docs/connection-options.md for database specific config.
Config
{
appId: string;
defaultLocale: string; // defaultLocale for platforms without a locale in the request
skipPlatforms?: string[]; // platforms where no data is stored, e.g. ['Alexa', 'GoogleAssistant']
skipLocales?: string[]; // requests from given locales are skipped, e.g. ['de', 'en-US'],
skipUserIds?: string[]; // users from given ids are skipped, e.g. ['jovo-debugger-user']
skipRequestObjects?: string[]; // paths to objects in request json, e.g. ['context.System.apiAccessToken']
skipResponseObjects?: string[]; // paths to objects in response json,
maskRequestObjects?: string[]; // paths to objects in request json that are masked, e.g. sensitive data like access tokens
maskResponseObjects?: string[]; // paths to objects in response json that are masked
maskValue: string | Function; // new value for masked objects
db: ConnectionOptions; // db connection options
}
Troubleshooting
Open database connections on AWS Lambda won't let the event loop get empty. The result is a timeout for every request.
This can be fixed by adding the following line into the handler method inindex.js
/ index.ts
exports.handler = async (event, context, callback) => {
context.callbackWaitsForEmptyEventLoop = false; // <-- ADD THIS
await app.handle(new Lambda(event, context, callback));
};