uNetworking / uSockets

Miniscule cross-platform eventing, networking & crypto for async applications
Apache License 2.0
1.26k stars 259 forks source link

App construction failed error occurs when trying to go up a directory when specifying key/cert name #131

Open modelorona opened 3 years ago

modelorona commented 3 years ago

Hiya,

This is my first time using this library, so please excuse me if this has already been brought up before. I did look for quite some time and could not manage to find anything related to it.

The issue occurs when I specify the name for the key_file_name and cert_file_name parameters in SSLApp(). I try to specify it like this

const Uws = require('uWebSockets.js');

Uws.SSLApp({
        key_file_name: '../certs/key.pem',
        cert_file_name: '../certs/cert.pem',
        passphrase: 'password'
})

where the certs folder is one above where the javascript file resides in.

However, if I move the certs folder to where the javascript file is, and change the call to

Uws.SSLApp({
        key_file_name: 'certs/key.pem',
        cert_file_name: 'certs/cert.pem',
        passphrase: 'password'
})

it works as expected.

The error that is printed out is App construction failed.

When I ran node --trace-uncaught ..., this is the output:

internal/modules/cjs/loader.js:968
  throw err;
  ^

Error: Cannot find module '/home/user/AndroidStudioProjects/project/src/server/...'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
Thrown at:
    at Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Module._load (internal/modules/cjs/loader.js:841:27)
    at executeUserEntryPoint (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47

I couldn't find anything in the documentation about how the format of the string should be, so I assumed that any valid path would work. But the error suggests otherwise.

partyblob commented 2 months ago

this is the wrong repo, https://github.com/uNetworking/uWebSockets.js (also the issue has been solved it appears)