Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adapter-node env.path config is ignored #2238

Closed
jasonlyu123 opened this issue Aug 18, 2021 · 0 comments · Fixed by #2244
Closed

adapter-node env.path config is ignored #2238

jasonlyu123 opened this issue Aug 18, 2021 · 0 comments · Fixed by #2244
Labels
bug Something isn't working pkg:adapter-node
Milestone

Comments

@jasonlyu123
Copy link
Member

Describe the bug

Feels free to point it out if I understand something wrong. #2048 added the support for adapter-node to listen with path. However, because the port still defaults to be 3000 now. The path option would be ignored by node.js.

)}] || '0.0.0.0';\nexport const port = process.env[${JSON.stringify(port_env)}] || 3000;`

the overload currently using is the options object one:

instance.listen(listenOpts, () => {

As specified in the node.js docs when the port option is specified, the path option would be ignored. Which means it would listen on port 3000 instead of the specified path. Moreover, it would break existing apps using the PORT environment variable to listening with path. Because in this overload the option.port option would be verified if it's actually a port instead of a path.

The hosting service I am using uses a proxy approach and it uses the PORT variable to pass the named pipe. So honestly, I don't even know the difference between path and port until it breaks. I tried changing the config to let the node adapter to read the PORT variable as a path but it doesn't work.

Reproduction

use a svelte kit app and change the config to this.

// svelte.config.js
import adapt from '@sveltejs/adapter-node';
export default {
  kit: {
       adapter: adapt({
            env: {
                path: 'SOME_PATH'
            }
        })
  }
}

build the app and run `SOME_PATH=foo node build. Go to localhost:3000 in the browser.

Logs

No response

System Info

System:
    OS: Windows 10 10.0.19043
    CPU: (16) x64 AMD Ryzen 7 4800HS with Radeon Graphics  

    Memory: 4.37 GB / 15.42 GB
  Binaries:
    Node: 16.2.0 - C:\Program Files\nodejs\node.EXE        
    Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 7.13.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1023.0), Chromium (92.0.902.73)    Internet Explorer: 11.0.19041.906
  npmPackages:
    @sveltejs/adapter-node: next => 1.0.0-next.42
    @sveltejs/kit: next => 1.0.0-next.151
    svelte: ^3.34.0 => 3.38.2

Severity

blocking an upgrade

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pkg:adapter-node
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants