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

fix server crash when accessing a malformed URI #5246

Merged

Conversation

ivanhofer
Copy link
Contributor

@ivanhofer ivanhofer commented Jun 22, 2022

Fix for #5090

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. All changesets should be patch until SvelteKit 1.0

@changeset-bot
Copy link

changeset-bot bot commented Jun 22, 2022

🦋 Changeset detected

Latest commit: be026cd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ivanhofer
Copy link
Contributor Author

I'm not sure how to fix the test. I would need some help there.

@benmccann
Copy link
Member

@ivanhofer I'm not sure if you've noticed, but the tests appear to be failing with this PR

@ivanhofer
Copy link
Contributor Author

@ivanhofer I'm not sure if you've noticed, but the tests appear to be failing with this PR

Yes I saw. Thats why I left the comment above. I would expect the test to work that I have written. In CI two tests are failing. Locally only the test with javaScriptEnabled fails because it waits for something that is not present on the page.
And I don't really understand how I can make the test not fail. Any hints?

@benmccann
Copy link
Member

Ah, sorry, I didn't see your comment.

It seems like the failure is coming from Vite. Probably the best course of action would be to create a small project that reproduces this using only Vite and not SvelteKit and file a bug there. See https://github.com/sveltejs/kit#bug-reporting for more details on that

It's not clear to me that this PR actually fixes anything. Is there a reason you think it might? Or should we go ahead and close this? At the very least I would mark it as a draft to make it clearer that it's not in a state to be merged

@ivanhofer
Copy link
Contributor Author

I don't think this has anything to do with vite. It is an error that SvelteKit does not handle yet. I think this might only occur when using the node adapter. I just added this info to the issue description.

The fix works. We are using it since a few weeks in two of our applications.
Also when testing it locally I get the expected outcome : a 400 error.
The tests in this CI process deliver a 500 error and I don't really get why. That's why I'm asking for help because I could not figure out what happens inside this test setup and I don't want to change something that could affect other tests.

@benmccann
Copy link
Member

The 500 on the CI is coming from Vite according to the stack trace. Did you test this fix with your own app in both dev and build mode? The Vite issue is only occuring in dev mode since that's where the Vite dev server is used

@ivanhofer
Copy link
Contributor Author

Ah, now I see that there are two different "test" calls "test:dev" and "test:prod". So there is actually a bug in SvelteKit and in vite. I'll also open an issue there.

Still there is an error when running "test:prod" with the javaScriptEnabled option, that does not come from vite. It comes from how the tests are setup.

@benmccann
Copy link
Member

benmccann commented Jun 24, 2022

I took a look at filing a Vite issue this morning, but I think Vite's mostly fine because the server doesn't crash entirely like the SvelteKit server does (although it could arguably return a 400 status code instead of 500). I think we just need to update the test in this PR

@ivanhofer
Copy link
Contributor Author

Smart way to handle the test 👍
Thanks for your investigation and help!

@Rich-Harris Rich-Harris merged commit 34f10ca into sveltejs:master Jun 29, 2022
@Rich-Harris
Copy link
Member

thanks!

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

Successfully merging this pull request may close these issues.

None yet

3 participants