Skip to content

Migration of 'forward-message-sendgrid' to @sendgrid/mail due to ES Module incompatibility with Twilio Functions #419

Description

@AkashM398

Issue:

The latest 'got' release (v12.6.0) is currently a native ES module and no longer provides a CommonJS export. Currently, the "forward-message-sendgrid" has the older 'got' release (v6.7.1) in its dependencies. While most users tend to upgrade the library in the dependencies to the latest version, they will face the following error.

Error [ERR_REQUIRE_ESM]: require() of ES Module /var/task/node_modules/got/dist/source/index.js from /var/task/handlers/ZNXXXXXXXXXXXXXXXXXXXXXXXXXXX.js not supported. Instead change the require of index.js in /var/task/handlers/ZNXXXXXXXXXXXXXXXXXXXXXXXXXXX.js to a dynamic import() which is available in all CommonJS modules

However, due to Twilio Functions currently does not support ES modules, using the dynamic import() will produce an error too.

Solution:

It is advisable to migrate this example to sendgrid-nodejs (@sendgrid/mail) as it is officially maintained by the Sendgrid team.

PR:

PR #420

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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