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

Crash after websocket connection is made #1062

Open
2 tasks done
TheNicolasDeveloper opened this issue Dec 30, 2024 · 0 comments
Open
2 tasks done

Crash after websocket connection is made #1062

TheNicolasDeveloper opened this issue Dec 30, 2024 · 0 comments

Comments

@TheNicolasDeveloper
Copy link

Checks

Describe the bug (be clear and concise)

When I attempt to connect to a proxied websocket, it crashes

The error:

TypeError: undefined is not an object (evaluating 'server.on')
      at C:\projects\Nova\services\Nova.Backend\node_modules\http-proxy-middleware\dist\http-proxy-middleware.js:56:17
      at C:\projects\Nova\services\Nova.Backend\node_modules\http-proxy-middleware\dist\http-proxy-middleware.js:50:22

Step-by-step reproduction instructions

1. Add a proxy middleware with ws set to true
2. Make a request to a websocket
3. Crash

Expected behavior (be clear and concise)

It should not crash upon a websocket request

How is http-proxy-middleware used in your project?

const frontendProxyMiddleware = createProxyMiddleware({
    target: "http://localhost:3000",
    changeOrigin: true,
    ws: true,
});

app.use(
    frontendProxyMiddleware
);

What http-proxy-middleware configuration are you using?

{
    target: "http://localhost:3000",
    changeOrigin: true,
    ws: true,
}

What OS/version and node/version are you seeing the problem?

System:
    OS: Windows 11 10.0.26100
    CPU: (16) x64 AMD Ryzen 7 7700X 8-Core Processor
    Memory: 15.11 GB / 31.15 GB
  Binaries:
    Node: 22.12.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.9.0 - C:\Program Files\nodejs\npm.CMD
    bun: 1.1.42 - ~\.bun\bin\bun.EXE
  Utilities:
    Git: 2.47.1.
    Curl: 8.10.1 - C:\WINDOWS\system32\curl.EXE
  IDEs:
    VSCode: 1.96.2 - C:\Users\Nicolas\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
    Visual Studio: 17.12.35527.113 (Visual Studio Community 2022)
  Languages:
    Java: 21.0.5
  Browsers:
    Edge: Chromium (131.0.2903.112)

Additional context (optional)

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant