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

Error middleware cannot display errors from plugin middlewares #17418

Open
7 tasks done
benmccann opened this issue Jun 7, 2024 · 0 comments · May be fixed by #17419
Open
7 tasks done

Error middleware cannot display errors from plugin middlewares #17418

benmccann opened this issue Jun 7, 2024 · 0 comments · May be fixed by #17419
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@benmccann
Copy link
Collaborator

Describe the bug

The error middleware requires JS to display anything:

import { ErrorOverlay } from '/@vite/client'

But sometimes you have an error that prevents the JS from loading:

Screenshot from 2024-06-07 15-08-58

In these cases you just get a blank page

Reproduction

n/a

Steps to reproduce

The error handler does not work with regular middlewares:

vite.middlewares.use((req, res, next) => {
	throw new Error('hello world');
});

It only works with post middlewares:

return () => {
	vite.middlewares.use((req, res) => {
		throw new Error('hello world');
	});
};

https://vitejs.dev/guide/api-plugin#configureserver

System Info

vite 5.2.8

Used Package Manager

pnpm

Logs

No response

Validations

@benmccann benmccann linked a pull request Jun 7, 2024 that will close this issue
@benmccann benmccann added this to the 5.3 milestone Jun 8, 2024
@benmccann benmccann added p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Jun 8, 2024
@benmccann benmccann removed this from the 5.3 milestone Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant