Skip to content

Custom email template fails to compile #152

@mmmewk

Description

@mmmewk

I followed the documentation here: https://github.com/aws-samples/amazon-cognito-passwordless-auth/blob/main/CUSTOMIZE-AUTH.md to setup custom email templates and ran into an error

SyntaxError: Cannot use import statement outside a module.

This was fixed by adding:

import * as lambdaNodeJs from "aws-cdk-lib/aws-lambda-nodejs";

createAuthChallenge: {
  entry: "functions/src/passwordless/createAuthChallenge.ts",
  bundling: {
    format: lambdaNodeJs.OutputFormat.ESM,
    banner: "import{createRequire}from 'module';const require=createRequire(import.meta.url);",
  },
},

Looks like it needs ESM to use the import syntax.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions