Forget Passowrd Email not sending - 504 Gateway Time-out

I am getting >504 Gateway Time-out on forget password call.
i have migrated to latest version 3.2.5 of strapi.
this was not working in the earlier version too
I have attached the error, and the admin panel of strapi subdomain configuration in NGINX


	<title>504 Gateway Time-out</title>

<body bgcolor="white">
		<h1>504 Gateway Time-out</h1>
	<center>nginx/1.14.0 (Ubuntu)</center>


Alright a few things that I need and a few suggestions.

Things to remove:

  • The 3rd server block that is doing some redirection, that shouldn’t be needed
  • Remove the include /etc.... line
  • Remove the ssl_dhparam .... line

Things I need:

  • The tail end of your Nginx error logs that show what request it was trying to make and why it failed, these should be located in /var/log/nginx/error.log, I don’t need the whole file just the lines around the error.
  • Your server.js file removing any personal information, either this is located in ./config/server.js or you may have an environment configured ./config/env/*/server.js
  • What email provider are you using?

here is the last lines of error log right after i execute the query from postman

the config/server.js (I dont have any environment configured)
module.exports = ({ env }) => ({
host: env(‘HOST’, ‘’),
port:‘PORT’, 1337),
url: ‘’,
admin: {
auth: {

I didnt change the email provider. i didnt do any settings. i tried sendgrid, but that didnt work so i reverted back. i have no complex task. just need the forget password to work via api.

PS: I did as you asked be removing those lines etc from the config file. didnt work

It would appear that Strapi isn’t responding to the request?

What provider are you using for email? Also where are you hosting?

I didn’t use any provider. i suppose strapi uses sendmail by default and it’s installed. i didnt disturb any configurations regarding emails.

I am using GCP ubunut instance. strapi is hosted behind NGINX

I believe GCP does block outbound port 25 by default (though I’ve not tested), regardless Strapi should still be responding with some kind of error :thinking:

I just ran a test with Postman against your server and I did get a response

Can you try Postman with a valid email?

yes i tried this with wrong email address. it responds this exactly as it did for you via postman.
i also tried using postman.

try with

you will get that gateway error…

PORT 25 is enabled in the GCP firewall and UFW firewall as well

Ah yeah that’s quite odd, it even stalls when using the http:1337 as well, can you check your Strapi server logs, it seems like it’s locking up for some reason and I’m wondering if it’s dumping any information to the Strapi console. (Assuming you are using pm2, those logs should be in ~/.pm2/logs, of the user running strapi, if you are using pm2)

this is the error log right after i hit the forget password

Try to delete node_modules folder and reinstall them using yarn install.
Also please share code that you use to run strapi with pm2.

okay i will do the reinstall now.
I use simple pm2 start exerche_server

I followed the guides in the docs provided by Digital Ocean Blog to run on ubuntu with strapi, bginx and PM2

Yeah it’s saying your node_modules is missing.

Just reinstalled. is this okay ?

Looks good to me just make sure to use pm2 and restart the server

ok doing that now

same issue. it doesnt work., this time no log recorded in the error log of PM2

Do you use ecosystem file for pm2 (pm2 start ecosystem.config.js) ?
Or you running it using server.js file (pm2 start server.js)?
Or you run it using packege.json script (pm2 start npm – run start)?

pm2 start ecosystem.config.js
this. ecosystem.config.js

Share the code from ecosystem file please.