Skip to content

@sveltejs/adapter-node generates corrupted server #5431

Closed
@UnlimitedBytes

Description

@UnlimitedBytes

Describe the bug

⚠ Disclaimer

First of all I'm not a native english speaker so please forgive my sometimes bad english! ❤

Second of all I'm not entirely sure if this issue belongs to sveltejs/kit or more to sveltejs/kit/adapter-node but as they both are on the same repository I'm posting this issue here anyway.

🐞 The bug

EDIT: This issue was introduced in 1.0.0-next.79 as my other project with 1.0.0-next.78 works fine.

While testing some stuff out for further information on #5412 I discovered the inability to generate production servers using adapter-node.

When building a production server using @sveltejs/adapter-node the generated server takes forever to respond (running in clientTimeout after 300s). When I switch the handler polka middleware inside build/index.js to a custom handler like so:

const server = polka().use(
	// https://github.com/lukeed/polka/issues/173
	// @ts-ignore - nothing we can do about so just ignore it
	compression$1.exports({ threshold: 0 }),
	(req, res) => res.end('Hello world')
);

and run node build the server instantly responds with Hello world so the issue is somewhere in the sveltekit handler.

🌟A solution

I don't know what exactly causes this problem so I can't give any solution 😥.
But this needs to be fixed somehow as it makes production builds using adapter-node impossible!

Reproduction

Manual reproduction

Repository: https://github.com/UnlimitedBytes/sveltekit-adapter-node-issue

  1. Clone the repository to your local system
  2. Navigate into the repository directory
  3. Install all dependencies using npm install
  4. Build the production server using npm run build
  5. Start the production server using node build
  6. Open your webbrowser and navigate to http://127.0.0.1:3000

FAST (automatic) reproduction

Execute the following commands

git clone https://github.com/UnlimitedBytes/sveltekit-adapter-node-issue
cd sveltekit-adapter-node-issue
npm install
npm run build
node build

Open your webbrowser and navigate to http://127.0.0.1:3000

Logs

Console:
> Listening on 0.0.0.0:3000

Browser:
Loading for ever

System Info

System:
  OS: Windows 10 10.0.19044
  CPU: (8) x64 AMD Ryzen™ 7 5800X3D @ 4.50GHz
  Memory: 6.05 GB / 32.00 GB
Binaries:
  Node: 18.4.0 - C:\Program Files\nodejs\node.EXE
  Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
  npm: 8.13.1 - ~\AppData\Roaming\npm\npm.CMD
Browsers:
  Edge: Spartan (44.19041.1266.0), Chromium (103.0.1264.44)
  Internet Explorer: 11.0.19041.1566
npmPackages:
  @sveltejs/adapter-node: ^1.0.0-next.79 => 1.0.0-next.79
  @sveltejs/kit: next => 1.0.0-next.366
  svelte: ^3.44.0 => 3.49.0
  vite: ^2.9.13 => 2.9.14

Severity

EDIT:
blocking an upgrade (as this issue was introduced by .79 as I found out now)

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp0-urgentSvelteKit is broken or vulnerable for most users

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions