smogon / pokemon-showdown

Pokémon battle simulator.
https://pokemonshowdown.com
MIT License
4.77k stars 2.79k forks source link

Cannot get SSL to work with Let's Encrypt certificates #9647

Closed c-schaer closed 1 year ago

c-schaer commented 1 year ago

I've been unable to get the showdown server running with SSL, I am getting the following error:

CRASH: Error: The SSL settings are misconfigured:
Error: error:0480006C:PEM routines::no start line
    at node:internal/tls/secure-context:70:13
    at Array.forEach (<anonymous>)
    at setCerts (node:internal/tls/secure-context:68:3)
    at configSecureContext (node:internal/tls/secure-context:157:5)
    at Object.createSecureContext (node:_tls_common:116:3)
    at Server.setSecureContext (node:_tls_wrap:1439:27)
    at Server (node:_tls_wrap:1303:8)
    at new Server (node:https:75:3)
    at Object.createServer (node:https:131:10)
    at new ServerStream (/pokemon/dist/server/sockets.js:317:34)
    at new ServerStream (/pokemon/dist/server/sockets.js:319:39)
    at RawProcessManager.setupChild [as _setupChild] (/pokemon/dist/server/sockets.js:478:21)
    at Immediate._onImmediate (/pokemon/dist/lib/process-manager.js:708:32)
    at process.processImmediate (node:internal/timers:478:21)

My config for ssl looks like this:

exports.ssl = {
        port: 443,
        options: {
                key: './config/ssl/privkey.pem',
                cert: './config/ssl/fullchain.pem',
        },
};

And I am following the same process noted in the example config's comments, where I am copying the files created by lets encrypt: image

Any ideas on what I need to do differently? Am I missing something obvious?

c-schaer commented 1 year ago

Nevermind, I figured it out after finding this comment. For future reference or anyone looking to solve this, my config looks like this now: image