NodeBB Email Settings Page Causing Cloudflare 520 Error
-
I'm experiencing an issue with my NodeBB v4.4.6 installation where accessing the Email Settings page in the Admin Control Panel results in a Cloudflare 520 error ("Web server is returning an unknown error").
Details:
NodeBB version: 4.4.6 (recently upgraded from 3.12.7)
Database: MongoDB (no authentication) ( i plan to do it later)
Web server: Running behind Cloudflare (nginx)
Error occurs only on the email settings page (/api/admin/settings/email)
Other admin pages work fine
What I've tried:Installed nodebb-plugin-emailer-smtp
Disabled HTTP/2 to Origin in Cloudflare
Rebuilt and restarted NodeBB
Checked for errors in NodeBB logs (none visible)
I'm using Resend for email (have proper DNS records set up in cloudfare when I was testing Flarum forum) and need to configure NodeBB to use it. Any suggestions on how to fix this specific 520 error when accessing the email settings page? -
I'm experiencing an issue with my NodeBB v4.4.6 installation where accessing the Email Settings page in the Admin Control Panel results in a Cloudflare 520 error ("Web server is returning an unknown error").
Details:
NodeBB version: 4.4.6 (recently upgraded from 3.12.7)
Database: MongoDB (no authentication) ( i plan to do it later)
Web server: Running behind Cloudflare (nginx)
Error occurs only on the email settings page (/api/admin/settings/email)
Other admin pages work fine
What I've tried:Installed nodebb-plugin-emailer-smtp
Disabled HTTP/2 to Origin in Cloudflare
Rebuilt and restarted NodeBB
Checked for errors in NodeBB logs (none visible)
I'm using Resend for email (have proper DNS records set up in cloudfare when I was testing Flarum forum) and need to configure NodeBB to use it. Any suggestions on how to fix this specific 520 error when accessing the email settings page?Put some console.logs and see if the /admin/settings/email route is being called. https://github.com/NodeBB/NodeBB/blob/master/src/controllers/admin/settings.js#L116 this is the controller that gets called when you load that page.
Start nodebb with
node app.js
to see the logs and see what happens you load the page. -
Thanks baris for the debugging guidance. Here's what we've discovered through systematic testing:
What we tried:
Added console.log debugging to settings.js as suggested
Started NodeBB with node app.js to monitor logs
Key finding: Debug logs never appeared when accessing email settings
Infrastructure testing revealed:Admin API endpoints work correctly: All /api/admin/* routes return proper 401 (auth required) responses
Email API specifically works: /api/admin/settings/email returns 401, not 520
JavaScript template fails: /assets/templates/admin/settings/email.js returns 520 error
Current plugin status:2025-08-23T02:28:21.248Z [4567/298549] - error: [plugins/emailer-sendgrid] API key not set!
Infrastructure fixes attempted:Disabled HTTP/2 to Origin in Cloudflare
Added extended timeouts (120s) and larger buffers (512k) for admin routes in Nginx
Added specific location blocks for /community/api/admin/ routes
Issue persists
Current assessment: The issue is NOT with the admin route itself (it returns proper 401) but with NodeBB's dynamic JavaScript template generation for /assets/templates/admin/settings/email.js. This suggests the email settings page template processing is failing during compilation, possibly due to the emailer plugin error.Key question: Should the email settings page load even with a misconfigured emailer plugin, or is it expected that template generation would fail if the plugin has errors?
The admin API works fine - it's specifically the client-side template JavaScript that's failing with 520.
-
wrote last edited by [email protected]
If the javascript template is failing to load you might need to run
./nodebb build
so it is generated in the build folder. Check if it's in the folderbuild/public/templates/admin/settings
-
I did that too before I posted the reply here. I think maybe it was a rule in nginx to disallow paths which had /email, that was the main culprit.
It was a fresh installation and I thought of installing the forum again. So I did it and its working now.
Thanks for your replies though. I understand as the co founder of this software, you must be a busy guy.
Love the software.