SMTP Local > Error 500

Hi,
I’m following the great tutorials from @ben on youtube and everything working fine except that confirmation email is not working.
I tried with sendgrid, mailgun and gmail. Same error : 500.

In the logs, got this :

 server-connect:server Got error? Error: Cannot find module 'nodemailer'
  server-connect:server Require stack:
  server-connect:server - /opt/node_app/lib/modules/mail.js
  server-connect:server - /opt/node_app/lib/core/app.js
  server-connect:server - /opt/node_app/lib/core/middleware.js
  server-connect:server - /opt/node_app/lib/setup/routes.js
  server-connect:server - /opt/node_app/lib/server.js
  server-connect:server - /opt/node_app/index.js
  server-connect:server     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
  server-connect:server     at Function.Module._load (internal/modules/cjs/loader.js:667:27)
  server-connect:server     at Module.require (internal/modules/cjs/loader.js:887:19)
  server-connect:server     at require (internal/modules/cjs/helpers.js:74:18)
  server-connect:server     at App.send (/opt/node_app/lib/modules/mail.js:87:28)
  server-connect:server     at App._exec (/opt/node_app/lib/core/app.js:481:57)
  server-connect:server     at App._exec (/opt/node_app/lib/core/app.js:452:28)
  server-connect:server     at processTicksAndRejections (internal/process/task_queues.js:97:5)
  server-connect:server     at async App.exec (/opt/node_app/lib/core/app.js:421:9)
  server-connect:server     at async App.define (/opt/node_app/lib/core/app.js:411:9) {
  server-connect:server   code: 'MODULE_NOT_FOUND',
  server-connect:server   requireStack: [
  server-connect:server     '/opt/node_app/lib/modules/mail.js',
  server-connect:server     '/opt/node_app/lib/core/app.js',
  server-connect:server     '/opt/node_app/lib/core/middleware.js',
  server-connect:server     '/opt/node_app/lib/setup/routes.js',
  server-connect:server     '/opt/node_app/lib/server.js',
  server-connect:server     '/opt/node_app/index.js'
  server-connect:server   ]
  server-connect:server } +6m  

And in the browser :

{
    "status": "500",
    "code": "MODULE_NOT_FOUND",
    "message": "Cannot find module 'nodemailer'\nRequire stack:\n- /opt/node_app/lib/modules/mail.js\n- /opt/node_app/lib/core/app.js\n- /opt/node_app/lib/core/middleware.js\n- /opt/node_app/lib/setup/routes.js\n- /opt/node_app/lib/server.js\n- /opt/node_app/index.js",
    "stack": "Error: Cannot find module 'nodemailer'\nRequire stack:\n- /opt/node_app/lib/modules/mail.js\n- /opt/node_app/lib/core/app.js\n- /opt/node_app/lib/core/middleware.js\n- /opt/node_app/lib/setup/routes.js\n- /opt/node_app/lib/server.js\n- /opt/node_app/index.js\n    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)\n    at Function.Module._load (internal/modules/cjs/loader.js:667:27)\n    at Module.require (internal/modules/cjs/loader.js:887:19)\n    at require (internal/modules/cjs/helpers.js:74:18)\n    at App.send (/opt/node_app/lib/modules/mail.js:87:28)\n    at App._exec (/opt/node_app/lib/core/app.js:481:57)\n    at App._exec (/opt/node_app/lib/core/app.js:452:28)\n    at processTicksAndRejections (internal/process/task_queues.js:97:5)\n    at async App.exec (/opt/node_app/lib/core/app.js:421:9)\n    at async App.define (/opt/node_app/lib/core/app.js:411:9)"
} 

I have installed nodemailer, but still got the same issue.
There is no way to use API instead of SMTP? How to fix this error 500 problem?

Thanks for your support.

Looks like the server connect mail component is missing rom the server. (/lib/core/modules/mail.js)
Try re-uploading the /lib folder

1 Like

Sorry to ask you but … how do i “re-upload the /lib folder”?

You can regenerate the “lib” folder by just deleting it and then save a server action.

Then just redeploy to use it.

1 Like

Thanks. It’s working fine now.

I came across this problem as well. Deleting the “lib” folder didn’t work for me - it didn’t regenerate

Also clicked to install NPM modules, didn’t do anything useful either

Clicking the Deploy button solved the problem

User Docker local?
I often find a “deploy” necessary in the docker (local) environment which is not necessary using other deployment methods. I guess the docker local container needs to be refreshed

Hi,

Yes, Docker :slight_smile: Sounds like it needs to be tuned a bit