Skip to content

Maximum call stack size exceeded RangeError: Maximum call stack size exceeded #315

Description

@xhaferd

I am using this library within a lambda function to convert email contents to plain text, since Microsoft Graph API returns them in HTML format. In one execution it processes about 20-30 emails in parallel.

I am getting the following error:

ERROR	Maximum call stack size exceeded RangeError: Maximum call stack size exceeded
    at Array.flatMap (<anonymous>)
    at /var/task/node_modules/@selderee/plugin-htmlparser2/lib/hp2-builder.cjs:13:38
    at /var/task/node_modules/@selderee/plugin-htmlparser2/lib/hp2-builder.cjs:40:33
    at /var/task/node_modules/@selderee/plugin-htmlparser2/lib/hp2-builder.cjs:13:51
    at Array.flatMap (<anonymous>)
    at Picker.f (/var/task/node_modules/@selderee/plugin-htmlparser2/lib/hp2-builder.cjs:13:38)
    at Picker.pick1 (/var/task/node_modules/selderee/lib/selderee.cjs:426:30)
    at recursiveWalk (/var/task/node_modules/html-to-text/lib/html-to-text.cjs:1241:46)
    at f1 (/var/task/node_modules/html-to-text/lib/html-to-text.cjs:27:44)
    at formatBlock$1 (/var/task/node_modules/html-to-text/lib/html-to-text.cjs:1324:3)

and this is the code:

export const convertHtmlToText = (html: string): string => {
    const text = htmlToText(html, {
        wordwrap: null, // Disable word wrapping
    });
    return text;
}

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