uNetworking / uNetworking/uSockets

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

Open
#131 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
1.5k
Forks
307
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the SSLApp() handling of key_file_name and cert_file_name, then reproduce the example with paths containing '../'. Compare it with the working 'certs/...' case; done means valid parent-directory certificate paths no longer cause 'App construction failed'.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.