backpack1098B
Convex Community3y ago
37 replies
backpack1098

nodemailer + convex?

Hi team! sorry it's me again. im running into some bugs when i try to use nodemailer for my app.
# case 1
.
convex/
email/
├── react-email
│   └── templates
│       └── welcome.tsx
├── send-email.ts
└── transports
    └── nodemailerApp.ts

# case 2
.
convex/
├── email
│   ├── react-email
│   │   └── templates
│   │       └── welcome.tsx
│   ├── send-email.ts
│   └── transports
│       └── nodemailerApp.ts

in scenario 1, i've been running into
⠙ Preparing Convex functions...
✘ [ERROR] Could not resolve "child_process"

    node_modules/nodemailer/lib/sendmail-transport/index.js:3:22:
      3 │ const spawn = require('child_process').spawn;
        ╵                       ~~~~~~~~~~~~~~~

  The package "child_process" wasn't found on the file system but is built into node. Are you trying
  to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
...

in scenario 2, i've been running into
⠋ Preparing Convex functions...
Unexpected Error: SyntaxError: 'from' expected. (17:49)
> 17 | import type * as email_react_email_node_modules_@babel_code_frame_LICENSE from "../email/react-email/node_modules/@babel/code-frame/LICENSE";
     |                                                 ^
  18 | import type * as email_react_email_node_modules_@babel_code_frame_lib_index from "../email/react-email/node_modules/@babel/code-frame/lib/index";
...

does anyone know what did i do wrong? i also have "jsx": "react", set in my convex/tsconfig.ts. thanks! 🙏
Was this page helpful?