[GH-ISSUE #1746] [BUG]: ENABLE_HTTPS="false" still wants KEY and CERT PATH defined. #1140

Closed
opened 2026-02-22 18:23:19 -05:00 by yindo · 5 comments
Owner

Originally created by @reefland on GitHub (Jun 22, 2024).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1746

How are you running AnythingLLM?

Not listed

What happened?

Running under Kubernetes v1.29.5+k3s1. The .env file is provided via a configMap which is read-only. anything-llm should NOT be trying to dynamically update my configuration file as it is under version control (it was failing saying it was read-only)

So I looking into what anything-llm was trying to add. It seems recent versions started to require the ENABLE_HTTPS setting (perhaps the default should be disabled if not defined?)

I added this section to the .env file:

        ###########################################
        ######## ENABLE HTTPS SERVER ##############
        ###########################################
        # By enabling this and providing the path/filename for the key and cert,
        # the server will use HTTPS instead of HTTP.
        ENABLE_HTTPS="false"
        #HTTPS_CERT_PATH="sslcert/cert.pem"
        #HTTPS_KEY_PATH="sslcert/key.pem"

Which resulted in:

[SSL BOOT ENABLED] Loading the certificate and key for HTTPS mode...
[SSL BOOT FAILED] The "path" argument must be of type string or an instance of Buffer or URL. Received undefined - falling back to HTTP boot. {
ENABLE_HTTPS: 'false',
HTTPS_KEY_PATH: undefined,
HTTPS_CERT_PATH: undefined,
stacktrace: 'TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined\n' +

Confusing as it see's ENABLE_HTTPS: 'false', but still says [SSL BOOT ENABLED] and fails on the PATHS.

If I define the PATHS to get past error message above:

        ###########################################
        ######## ENABLE HTTPS SERVER ##############
        ###########################################
        # By enabling this and providing the path/filename for the key and cert,
        # the server will use HTTPS instead of HTTP.
        ENABLE_HTTPS="false"
        HTTPS_CERT_PATH="sslcert/cert.pem"
        HTTPS_KEY_PATH="sslcert/key.pem"

Then it fails that the files do not exist, which is correct, they don't.

[SSL BOOT ENABLED] Loading the certificate and key for HTTPS mode...
[SSL BOOT FAILED] ENOENT: no such file or directory, open 'sslcert/key.pem' - falling back to HTTP boot. {
ENABLE_HTTPS: 'false',
HTTPS_KEY_PATH: 'sslcert/key.pem',
HTTPS_CERT_PATH: 'sslcert/cert.pem',
stacktrace: "Error: ENOENT: no such file or directory, open 'sslcert/key.pem'\n" +
' at Object.openSync (node:fs:596:3)\n' +
' at Object.readFileSync (node:fs:464:35)\n' +
' at bootSSL (/app/server/utils/boot/index.js:14:27)\n' +
' at Object.<anonymous> (/app/server/index.js:41:3)\n' +
' at Module._compile (node:internal/modules/cjs/loader:1356:14)\n' +
' at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)\n' +
' at Module.load (node:internal/modules/cjs/loader:1197:32)\n' +
' at Module._load (node:internal/modules/cjs/loader:1013:12)\n' +
' at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)\n' +
' at node:internal/main/run_main_module:28:49'
}
/app/server/endpoints/agentWebsocket.js:20
app.ws("/agent-invocation/:uuid", async function (socket, request) {
^
TypeError: app.ws is not a function
at agentWebsocket (/app/server/endpoints/agentWebsocket.js:20:7)
at Object.<anonymous> (/app/server/index.js:57:1)
at Module._compile (node:internal/modules/cjs/loader:1356:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
at Module.load (node:internal/modules/cjs/loader:1197:32)
at Module._load (node:internal/modules/cjs/loader:1013:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
at node:internal/main/run_main_module:28:49
Node.js v18.19.1

I tried pointing them to actual files (but not certificates) to bypass the check above, but then it fails on file format validation.

I do not seem to be able to disable HTTPS.

Are there known steps to reproduce?

No response

Originally created by @reefland on GitHub (Jun 22, 2024). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1746 ### How are you running AnythingLLM? Not listed ### What happened? Running under Kubernetes v1.29.5+k3s1. The `.env` file is provided via a configMap which is read-only. anything-llm should NOT be trying to dynamically update my configuration file as it is under version control (it was failing saying it was read-only) So I looking into what anything-llm was trying to add. It seems recent versions started to require the `ENABLE_HTTPS` setting (perhaps the default should be disabled if not defined?) I added this section to the `.env` file: ``` ########################################### ######## ENABLE HTTPS SERVER ############## ########################################### # By enabling this and providing the path/filename for the key and cert, # the server will use HTTPS instead of HTTP. ENABLE_HTTPS="false" #HTTPS_CERT_PATH="sslcert/cert.pem" #HTTPS_KEY_PATH="sslcert/key.pem" ``` Which resulted in: ``` [SSL BOOT ENABLED] Loading the certificate and key for HTTPS mode... [SSL BOOT FAILED] The "path" argument must be of type string or an instance of Buffer or URL. Received undefined - falling back to HTTP boot. { ENABLE_HTTPS: 'false', HTTPS_KEY_PATH: undefined, HTTPS_CERT_PATH: undefined, stacktrace: 'TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined\n' + ``` Confusing as it see's `ENABLE_HTTPS: 'false',` but still says `[SSL BOOT ENABLED]` and fails on the PATHS. If I define the PATHS to get past error message above: ``` ########################################### ######## ENABLE HTTPS SERVER ############## ########################################### # By enabling this and providing the path/filename for the key and cert, # the server will use HTTPS instead of HTTP. ENABLE_HTTPS="false" HTTPS_CERT_PATH="sslcert/cert.pem" HTTPS_KEY_PATH="sslcert/key.pem" ``` Then it fails that the files do not exist, which is correct, they don't. ``` [SSL BOOT ENABLED] Loading the certificate and key for HTTPS mode... [SSL BOOT FAILED] ENOENT: no such file or directory, open 'sslcert/key.pem' - falling back to HTTP boot. { ENABLE_HTTPS: 'false', HTTPS_KEY_PATH: 'sslcert/key.pem', HTTPS_CERT_PATH: 'sslcert/cert.pem', stacktrace: "Error: ENOENT: no such file or directory, open 'sslcert/key.pem'\n" + ' at Object.openSync (node:fs:596:3)\n' + ' at Object.readFileSync (node:fs:464:35)\n' + ' at bootSSL (/app/server/utils/boot/index.js:14:27)\n' + ' at Object.<anonymous> (/app/server/index.js:41:3)\n' + ' at Module._compile (node:internal/modules/cjs/loader:1356:14)\n' + ' at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)\n' + ' at Module.load (node:internal/modules/cjs/loader:1197:32)\n' + ' at Module._load (node:internal/modules/cjs/loader:1013:12)\n' + ' at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)\n' + ' at node:internal/main/run_main_module:28:49' } /app/server/endpoints/agentWebsocket.js:20 app.ws("/agent-invocation/:uuid", async function (socket, request) { ^ TypeError: app.ws is not a function at agentWebsocket (/app/server/endpoints/agentWebsocket.js:20:7) at Object.<anonymous> (/app/server/index.js:57:1) at Module._compile (node:internal/modules/cjs/loader:1356:14) at Module._extensions..js (node:internal/modules/cjs/loader:1414:10) at Module.load (node:internal/modules/cjs/loader:1197:32) at Module._load (node:internal/modules/cjs/loader:1013:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12) at node:internal/main/run_main_module:28:49 Node.js v18.19.1 ``` I tried pointing them to actual files (but not certificates) to bypass the check above, but then it fails on file format validation. I do not seem to be able to disable HTTPS. ### Are there known steps to reproduce? _No response_
yindo added the possible bug label 2026-02-22 18:23:19 -05:00
yindo closed this issue 2026-02-22 18:23:19 -05:00
Author
Owner

@reefland commented on GitHub (Jun 22, 2024):

I reverted back to previous digest I was using:

          tag: latest@sha256:2e9649afde42e23baa056c7c1b3d55e8b65bc671fa5bee20b5c889ae932978e4

That version still fails with ENABLE_HTTPS="false" as above. However, when I comment out everything:

        ###########################################
        ######## ENABLE HTTPS SERVER ##############
        ###########################################
        # By enabling this and providing the path/filename for the key and cert,
        # the server will use HTTPS instead of HTTP.
        #ENABLE_HTTPS="false"
        #HTTPS_CERT_PATH="sslcert/cert.pem"
        #HTTPS_KEY_PATH="sslcert/key.pem"

Then anything-llm is able to start successfully:

[CommunicationKey] RSA key pair generated for signed payloads within AnythingLLM services.
Primary server in HTTP mode listening on port 3001
@reefland commented on GitHub (Jun 22, 2024): I reverted back to previous digest I was using: ``` tag: latest@sha256:2e9649afde42e23baa056c7c1b3d55e8b65bc671fa5bee20b5c889ae932978e4 ``` That version still fails with `ENABLE_HTTPS="false"` as above. However, when I comment out everything: ``` ########################################### ######## ENABLE HTTPS SERVER ############## ########################################### # By enabling this and providing the path/filename for the key and cert, # the server will use HTTPS instead of HTTP. #ENABLE_HTTPS="false" #HTTPS_CERT_PATH="sslcert/cert.pem" #HTTPS_KEY_PATH="sslcert/key.pem" ``` Then anything-llm is able to start successfully: ``` [CommunicationKey] RSA key pair generated for signed payloads within AnythingLLM services. Primary server in HTTP mode listening on port 3001 ```
Author
Owner

@reefland commented on GitHub (Jun 23, 2024):

This is probably caused commit 941179 which tried to update the .env file.

@reefland commented on GitHub (Jun 23, 2024): This is probably caused commit 941179 which tried to update the `.env` file.
Author
Owner

@timothycarambat commented on GitHub (Jun 23, 2024):

We check the existence of the ENV, not its value
https://github.com/Mintplex-Labs/anything-llm/blob/e72fa8b370212394f9d52d7dc629b568de6538c9/server/index.js#L40

@timothycarambat commented on GitHub (Jun 23, 2024): We check the _existence_ of the ENV, not its value https://github.com/Mintplex-Labs/anything-llm/blob/e72fa8b370212394f9d52d7dc629b568de6538c9/server/index.js#L40
Author
Owner

@reefland commented on GitHub (Jun 24, 2024):

@timothycarambat - can you please clarify that please, because if I set:

        ###########################################
        ######## ENABLE HTTPS SERVER ##############
        ###########################################
        # By enabling this and providing the path/filename for the key and cert,
        # the server will use HTTPS instead of HTTP.
        ENABLE_HTTPS="false"
        HTTPS_CERT_PATH="sslcert/cert.pem"
        HTTPS_KEY_PATH="sslcert/key.pem"

Anything-llm, will fail to start. It seems to be checking the value of the PATHS even when ENABLE_HTTPS: 'false'

[SSL BOOT ENABLED] Loading the certificate and key for HTTPS mode...
[SSL BOOT FAILED] ENOENT: no such file or directory, open 'sslcert/key.pem' - falling back to HTTP boot. {
ENABLE_HTTPS: 'false',
HTTPS_KEY_PATH: 'sslcert/key.pem',
HTTPS_CERT_PATH: 'sslcert/cert.pem',
stacktrace: "Error: ENOENT: no such file or directory, open 'sslcert/key.pem'\n" +
' at Object.openSync (node:fs:596:3)\n' +
' at Object.readFileSync (node:fs:464:35)\n' +
' at bootSSL (/app/server/utils/boot/index.js:14:27)\n' +
' at Object.<anonymous> (/app/server/index.js:41:3)\n' +
' at Module._compile (node:internal/modules/cjs/loader:1356:14)\n' +
' at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)\n' +
' at Module.load (node:internal/modules/cjs/loader:1197:32)\n' +
' at Module._load (node:internal/modules/cjs/loader:1013:12)\n' +
' at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)\n' +
' at node:internal/main/run_main_module:28:49'
}
/app/server/endpoints/agentWebsocket.js:20
app.ws("/agent-invocation/:uuid", async function (socket, request) {
^
TypeError: app.ws is not a function
at agentWebsocket (/app/server/endpoints/agentWebsocket.js:20:7)
at Object.<anonymous> (/app/server/index.js:57:1)
at Module._compile (node:internal/modules/cjs/loader:1356:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
at Module.load (node:internal/modules/cjs/loader:1197:32)
at Module._load (node:internal/modules/cjs/loader:1013:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
at node:internal/main/run_main_module:28:49
Node.js v18.19.1

You don't consider that an issue? Why is [SSL BOOT ENABLED] when ENABLE_HTTPS: 'false' ??

@reefland commented on GitHub (Jun 24, 2024): @timothycarambat - can you please clarify that please, because if I set: ``` ########################################### ######## ENABLE HTTPS SERVER ############## ########################################### # By enabling this and providing the path/filename for the key and cert, # the server will use HTTPS instead of HTTP. ENABLE_HTTPS="false" HTTPS_CERT_PATH="sslcert/cert.pem" HTTPS_KEY_PATH="sslcert/key.pem" ``` Anything-llm, will fail to start. It seems to be checking the value of the PATHS even when `ENABLE_HTTPS: 'false'` ``` [SSL BOOT ENABLED] Loading the certificate and key for HTTPS mode... [SSL BOOT FAILED] ENOENT: no such file or directory, open 'sslcert/key.pem' - falling back to HTTP boot. { ENABLE_HTTPS: 'false', HTTPS_KEY_PATH: 'sslcert/key.pem', HTTPS_CERT_PATH: 'sslcert/cert.pem', stacktrace: "Error: ENOENT: no such file or directory, open 'sslcert/key.pem'\n" + ' at Object.openSync (node:fs:596:3)\n' + ' at Object.readFileSync (node:fs:464:35)\n' + ' at bootSSL (/app/server/utils/boot/index.js:14:27)\n' + ' at Object.<anonymous> (/app/server/index.js:41:3)\n' + ' at Module._compile (node:internal/modules/cjs/loader:1356:14)\n' + ' at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)\n' + ' at Module.load (node:internal/modules/cjs/loader:1197:32)\n' + ' at Module._load (node:internal/modules/cjs/loader:1013:12)\n' + ' at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)\n' + ' at node:internal/main/run_main_module:28:49' } /app/server/endpoints/agentWebsocket.js:20 app.ws("/agent-invocation/:uuid", async function (socket, request) { ^ TypeError: app.ws is not a function at agentWebsocket (/app/server/endpoints/agentWebsocket.js:20:7) at Object.<anonymous> (/app/server/index.js:57:1) at Module._compile (node:internal/modules/cjs/loader:1356:14) at Module._extensions..js (node:internal/modules/cjs/loader:1414:10) at Module.load (node:internal/modules/cjs/loader:1197:32) at Module._load (node:internal/modules/cjs/loader:1013:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12) at node:internal/main/run_main_module:28:49 Node.js v18.19.1 ``` You don't consider that an issue? Why is `[SSL BOOT ENABLED]` when `ENABLE_HTTPS: 'false'` ??
Author
Owner

@timothycarambat commented on GitHub (Jun 24, 2024):

Because we dont want to check the value of the ENV since it will get confusing doing Boolean or string comparison like we do with DISABLE_TELEMETRY, which we made this mistake with already, so it is easier to check for the outright existence of the key since it is self-explanatory.

Additionally, this a developer-set key and is not managed/created by the system so we cannot anticipate its type since some will use a boolean and some will use a string.

Either set the ENV var to something or omit it entirely for this ENV var.

@timothycarambat commented on GitHub (Jun 24, 2024): Because we dont want to check the value of the ENV since it will get confusing doing Boolean or string comparison like we do with `DISABLE_TELEMETRY`, which we made this mistake with already, so it is easier to check for the outright existence of the key since it is self-explanatory. Additionally, this a developer-set key and is not managed/created by the system so we cannot anticipate its type since some will use a boolean and some will use a string. Either set the ENV var to something or omit it entirely for this ENV var.
yindo changed title from [BUG]: ENABLE_HTTPS="false" still wants KEY and CERT PATH defined. to [GH-ISSUE #1746] [BUG]: ENABLE_HTTPS="false" still wants KEY and CERT PATH defined. 2026-06-05 14:39:09 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#1140