Interface HandlerContext

Hierarchy

  • HandlerContext

Implemented by

Properties

api: CorvaApi
cache?: State
config: AppConfig
logger: CorvaLogger
secrets?: void | Record<string, string>

In case there are some stored secrets inside Corva for the app it is possible to access that values.

⚠️ Will be undefined in case there are no secrets, need to check in code if there are any

Example

import { Corva } from '@corva/node-sdk';

export const handler = new Corva().task((event, context) => {
// in case app has secrets in Corva DC they will be injected into context
if (context.secrets) {
// some object
context.logger.info(`App secrets: ${JSON.stringify(context.secrets)}`);
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions,@typescript-eslint/no-unsafe-member-access
context.logger.info(`APP_SUPER_SECRET: ${context.secrets['APP_SUPER_SECRET']}`);
} else {
// undefined
context.logger.warn('No secrets for app!');
}

return Promise.resolve();
});