Skip to content

Releases: iter-idea/IDEA-AWS

Internal: SES wrapper via Nodemailer uses SESv2

08 Aug 08:57

Choose a tag to compare

  • chore: upgrade SES wrapper so that Nodemailer uses SESv2 (now that it supports it).

Controllers don't use callbacks

28 Jul 13:47

Choose a tag to compare

Breaking changes and upgrade guide

Following the warning appearing in the AWS Lambda console:

AWS Lambda plans to remove support for callback-based function handlers starting with Node.js 24. You will need to update this function to use an async handler to use Node.js 24 or later. For more information and to provide feedback on this change, see aws/aws-lambda-nodejs-runtime-interface-client#137. To disable this warning, set the AWS_LAMBDA_NODEJS_DISABLE_CALLBACK_WARNING environment variable.

We removed any use of callbacks in Generic, Stream and Resource Controllers, using instead a "return result vs throw error" approach.

Note: if any Controller make use of the callback attribute directly (now removed), a specific workaround through the return/throw mechanism must be implemented instead.

Resource Controllers

// before
export const handler = (ev: any, _: any, cb: any) => new MyRC(ev, cb).handleRequest();
// after
export const handler = async (event: any): Promise<any> => new MyRC(event).handleRequest();

// ...
class MyRC extends ResourceController {
  // before
  constructor(event: any, callback: any) {
    super(event, callback);
  // after
  constructor(event: any) {
    super(event);
    // ...
  }
  // ...
}

Note: if the Resource Controller makes use of callback (for redirects or similar scenarios), you can instead utilise the attributes returnStatusCode and returnHeaders; for example:

getResource() {  
  // ...
  // before
  this.callback(null, { statusCode: 302, headers: { Location: 'https://myRedirectURL' } });
  // after
  this.returnStatusCode = 302;
  this.returnHeaders = { Location: 'https://myRedirectURL' };
  // no need to return anything in particular
}

Stream Controllers

// before
export const handler = (ev: any, _: any, cb: any) => new MySC(ev, cb).handleRequest();
// after
export const handler = async (event: any): Promise<any> => new MySC(event).handleRequest();

Generic Controllers

// before
export const handler = (ev: any, _: any, cb: any) => new MyGC(ev, cb).handleRequest();
// after
export const handler = async (event: any): Promise<any> => new MyGC(event).handleRequest();

Example with multiple Controllers in the same handler

// before
export const handler = (ev: any, _: any, cb: any): void => {
  if (ev.Records) new WebSocketStreamController(ev, cb).handleRequest();
  else new WebSocketApiController(ev, cb).handleRequest();
};
// after
export const handler = async (ev: any): Promise<any> => {
  if (ev.Records) return new WebSocketStreamController(ev, cb).handleRequest();
  else return new WebSocketApiController(ev, cb).handleRequest();
};

// ...
// before
async handleRequest(): Promise<void> {
  try {
    // ...
    this.callback(null, { statusCode: 200 });
  } catch (error) {
    // ...
    this.callback(null, { statusCode: 400 });
  }
}
// ...
// after
async handleRequest(): Promise<any> {
  try {
    // ...
    return { statusCode: 200 };
  } catch (error) {
    // ...
    return { statusCode: 400 };
  }
}
// ...

Support to ESLint 9 and libs update

28 Jul 09:53

Choose a tag to compare

Internal libraries update.

Cognito: verify email address

24 Jan 13:26

Choose a tag to compare

  • Cognito. New method to quickly verify an email address.

Attachments: support for CDK projects

24 Dec 09:36

Choose a tag to compare

  • Attachments. The wrapper now supports both CDK projects and older ones (in compatibility mode). E.g.
    // for IDEA CDK projects, this will target the attachments folder in the media bucket
    const attachments = new Attachments(ddb, s3);
    //  for ITER suite projects, this will target the attachments bucket
    const attachments = new Attachments(ddb, s3, { compatibility: 'v1' });

Cognito: enable/disable users

20 Dec 10:06

Choose a tag to compare

  • Cognito. Information on the users now includes whether the account has been disabled, with methods to enable/disable it.

Minor fix on tracing the Resource Controller

12 Sep 08:17

Choose a tag to compare

  • RC. Limit size of body in tracing annotations.

Support to Node.js v20

22 Jul 15:36

Choose a tag to compare

v4.4.12

v4.4.12

Parse boolean query parameters (standard way)

06 May 09:07

Choose a tag to compare

  • Resource Controller. Parse boolean query parameters in a standard way (getQueryParamAsBoolean), which adds to the already existing getQueryParamAsArray. These methods are the suggested way to parse parameters from the URL's query.
  • S3: Fix the GET empty objects list.

Cognito: get groups of user

12 Mar 08:58

Choose a tag to compare

  • Cognito. Get the list of groups of a user by its email address.