Skip to content
New issue

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

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

Already on GitHub? # to your account

fix: avoid dev-server crash when ws proxy error #12829

Merged
merged 1 commit into from
May 8, 2023
Merged

Conversation

rawbin-
Copy link
Contributor

@rawbin- rawbin- commented Apr 11, 2023

Description

Fix #12664

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@stackblitz
Copy link

stackblitz bot commented Apr 11, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@ArnaudBarre ArnaudBarre changed the title fix: issue #12664 avoid dev-server crash when ws proxy error fix: avoid dev-server crash when ws proxy error Apr 19, 2023
@ArnaudBarre
Copy link
Member

While this PR seems to make sense, a small reproduction of the error would really help be sure this block is needed and the error was not fixed by previous commit as pointed in the linked issue

@rawbin-
Copy link
Contributor Author

rawbin- commented May 8, 2023

  1. install docker
brew install --cask docker
  1. run grafana docker
docker run -d -p 3000:3000 --name grafana grafana/grafana-oss:9.2.6
  1. change grafana docker for grafana prefix
docker cp grafana:/etc/grafana/grafana.ini ./
## change config grafana.ini to the following and enable the two config
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana
serve_from_sub_path = true
## change config end
cp ./grafana.ini grafana:/etc/grafana/grafana.ini
docker restart grafana
  1. create vite demo
npx create-vue vite-repo
  1. set proxy to grafana
  server:{
    proxy:{
        '^/grafana': {
            changeOrigin: true,
            ws: true,
            target: 'http://localhost:3000/',
        }
    }
  }
  1. run the demo and navigate to /grafana we can see the crash still on 4.3.5

or run the demo navigate to /grafana or /test

@patak-dev
Copy link
Member

/ecosystem-ci run

@vite-ecosystem-ci
Copy link

vite-ecosystem-ci bot commented May 8, 2023

📝 Ran ecosystem CI: Open

suite result
astro ❌ failure
histoire ⏹️ cancelled
iles ✅ success
ladle ✅ success
laravel ✅ success
marko ✅ success
nuxt ❌ failure
previewjs ✅ success
qwik ✅ success
rakkas ✅ success
sveltekit ✅ success
vite-plugin-ssr ❌ failure
vite-plugin-react ✅ success
vite-plugin-react-pages ✅ success
vite-plugin-react-swc ✅ success
vite-plugin-svelte ✅ success
vite-plugin-vue ❌ failure
vite-setup-catalogue ✅ success
vitepress ✅ success
vitest ✅ success

@ArnaudBarre
Copy link
Member

Is the ecosystem CI running with an old main base maybe?
Tested locally, can reproduce and patching node_module with this code correctly fix the crash.

Copy link
Member

@patak-dev patak-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the PR is using a month-old state of main. Let's merge this one 👍🏼

@patak-dev patak-dev merged commit 87e1f58 into vitejs:main May 8, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

devserver proxy to grafana crashs
3 participants